Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98732 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2137 invoked from network); 5 Apr 2017 12:19:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Apr 2017 12:19:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.proweb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.proweb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.54 as permitted sender) X-PHP-List-Original-Sender: david.proweb@gmail.com X-Host-Fingerprint: 209.85.213.54 mail-vk0-f54.google.com Received: from [209.85.213.54] ([209.85.213.54:36023] helo=mail-vk0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3E/E8-19282-0C0E4E85 for ; Wed, 05 Apr 2017 08:19:12 -0400 Received: by mail-vk0-f54.google.com with SMTP id s68so5786231vke.3 for ; Wed, 05 Apr 2017 05:19:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=NShumhYVFW1+Q/KQp9cDsHHbRdtU+URRhtwFCZKnQzc=; b=M38rTsMxi7e2e5jtWXv81O86bq5uuD+BVenDBcB5YO0g3Gm+Pi7TyV4AMnXsBUSyso Tm5eqRV2MOgFjw+hTY/tZX1NisYnjWawTN6R823mW4j1HM1jvEci7eFFVMppkSrVGWiQ lP/pEHnks9MKwNhTEFCxBDRZV3E6hwsEy7yx3O1Xr80AoS22fiSfuVy6uVIf2MQNYC5r KIVhF+24aGIesREhxuGV+sk8heUJzytLPC48TBzTSY9jQTBC8Qz6wJMvgJgawNu2VdLJ 2cSBBlE7dbj5ExVAiqzuBdF55/vM6W7tNhWMTc2WL6qV2K1hW4Nq5uxT+c9OLMesx5A3 SFKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NShumhYVFW1+Q/KQp9cDsHHbRdtU+URRhtwFCZKnQzc=; b=nITX2r6dWIX+1piT7SHZpN6P6uba1ritW+0kG6Y/5d4de2P3WqWrKWMAq51gqMqXdz HqMnEWr9R8DsiiInB44/7IybwYfego4tZGj8X51W0JvIQM7zDvDmmVULBSLw7o19Xeen xmH9Zgci4ge7xugTKmD0D1bWi0qCjfCN6z4AoVylZSJJ2uIRv5PHi4fdD8ByBy8noVjW U4lEVwF+UJAEJ328uAODIUAEWluNuoCO1jgYlOvcBElKrj1BRGJo7hjD1N7MJHJHUG6O PfekprJuiIoH0tW5t1i3YPUXP2PdPymTYxaQqEysPPPsDFk1TrzAuUZYM5LdA0OBja/w bOwQ== X-Gm-Message-State: AFeK/H38lfAhQPl0Lv8TwIjw0njVLySI3nnHTReZapM834HOM7wrRDJBbS+B0C+kGqepVC56FS8ARdiV7b6g1A== X-Received: by 10.31.16.69 with SMTP id g66mr10963144vki.66.1491394749482; Wed, 05 Apr 2017 05:19:09 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.132.81 with HTTP; Wed, 5 Apr 2017 05:18:49 -0700 (PDT) Date: Wed, 5 Apr 2017 09:18:49 -0300 Message-ID: To: PHP Internals Content-Type: multipart/alternative; boundary=001a11432afc4350aa054c6a66a7 Subject: Throw an exception for possible file race condition From: david.proweb@gmail.com (David Rodrigues) --001a11432afc4350aa054c6a66a7 Content-Type: text/plain; charset=UTF-8 Currently we should uses the @-operator on mkdir(), for instance, to check a race condition. Something like: if (!@mkdir('test')) { throw new SomeException(); } Should be fine if we can do something like that, instead: try { mkdir('test'); } catch (FileExistsException $exception) { throw new SomeException(); } It will avoid the @-operator and make the result more reliable (for instance, if you don't uses the @-operator in this case and is catched by a race condition). -- David Rodrigues --001a11432afc4350aa054c6a66a7--