Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104282 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 91312 invoked from network); 7 Feb 2019 14:38:21 -0000 Received: from unknown (HELO mail-yw1-f54.google.com) (209.85.161.54) by pb1.pair.com with SMTP; 7 Feb 2019 14:38:21 -0000 Received: by mail-yw1-f54.google.com with SMTP id p17so4482912ywg.0 for ; Thu, 07 Feb 2019 03:19:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Cr7v/1dN7yVSJG3E+X+hDKMKePBEqC8XXbn+uVM4PH0=; b=Tb7mdVOZqA3DH2uLfgFgNoV5+uLE5S102eAD34Y6j7+qeQ4GrYLUerLj5zVrQ/UjDF IAOvx4QoL7HgcfipB06JA2e55fksSMWHmb2R7LPYbGDq5Ar7/4DXCy7zAKErTyT0o2X1 jOKDsDPp8frDwPSvAYtDRSHy3369HcbsmRmMXQyasKB0bD6huZulCQnHkGiS3AHBZlBZ ygupYkYOYZjxa+HxNFZX3PHW2W8ukFIHsWj1cKBoHiEVleU64WIWS/JCiba0SnUAmQ+v Hwf1qlZcMr8v4qTRQVStrptA10gbfP9iOMXM5lyUc+xuQGhPkCnNBhSLBklZaYv3akBs 4w4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Cr7v/1dN7yVSJG3E+X+hDKMKePBEqC8XXbn+uVM4PH0=; b=QJl+NB5ZVGxbNcs7zeYFOGLQMW4oZoIGZE7YMRtFuZbJRB2DYcfbuLQ3fKolUZfUBG SMJ0vxhPZ/7OtdzyTc/vefZl3m1uq2Qc3GFIneK3Iyuj93MxKjXPX7Qh4BP1QsPvHQNR HUy1AQuWUXXYk57AAG17O52Cq0jJV3mgV44sf1vfEspEHkcpWAXRDfNBDYaH5b1LVCF0 eIwnzxPPQ39XRbrgMqp2qRGwJ/fprGc1jKTPlW3TB0fnFc2aLU6xfSuROSp6B4HfG6i9 qOD6kYOwoqDMsw0g6DkThoh9gBZG4zTufYz+o30FDyo5qNPl+UOJc38i9mS/tzY56R0b 7VZA== X-Gm-Message-State: AHQUAuZozOviXpEjsyDcSw0Pt88pYzzxyO/dBq2+6/i31wEwCFSJ+yZn N0RGEy9W6ilzQbpulnWzK9iPV68C1MApuJSyrCHB2ie1 X-Google-Smtp-Source: AHgI3IackrROM5Hc99ceZgpILX1Ydelf/xfaZtJNbAHNkYXPyYoyav4XWWXJPIqXYoBeRcuEUoR8hIP7g5SgbHPoulE= X-Received: by 2002:a81:5512:: with SMTP id j18mr12291572ywb.222.1549538398477; Thu, 07 Feb 2019 03:19:58 -0800 (PST) MIME-Version: 1.0 References: <38CCB7C0-C97D-41F1-8EB7-BA5FE8FD01F5@cschneid.com> In-Reply-To: <38CCB7C0-C97D-41F1-8EB7-BA5FE8FD01F5@cschneid.com> Date: Thu, 7 Feb 2019 12:19:46 +0100 Message-ID: To: Christian Schneider Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000cea09b05814c05c6" Subject: Re: [PHP-DEV] Don't silence fatal errors From: benjamin.morel@gmail.com (Benjamin Morel) --000000000000cea09b05814c05c6 Content-Type: text/plain; charset="UTF-8" > > Please don't do that either, I don't want to convert > @mkdir("foo"); > to > try { mkdir("foo"); } catch (Exception $e) {} > just to stop my script from exiting if the directory already exists. What you really want is either another function that does not throw an exception in the specific case of "the directory already exists", or a switch to not throw an exception in this specific case: there might be other reasons that make mkdir() fail, such as a permission error. By blindly silencing mkdir(), *you have no guarantee that the directory will exist after this call is executed*. When mkdir() fails for another reason, I can tell you that *you do want an exception*. Also, some applications might assume that the directory does not already exist, and want to fail if it does. So both use cases must be available in the API. On Thu, 7 Feb 2019 at 10:17, Christian Schneider wrote: > Am 07.02.2019 um 10:01 schrieb Benjamin Morel : > > IMO, @ can be safely removed the day PHP converts current warnings to > exceptions. > > Please don't do that either, I don't want to convert > @mkdir("foo"); > to > try { mkdir("foo"); } catch (Exception $e) {} > just to stop my script from exiting if the directory already exists. > > - Chris > > --000000000000cea09b05814c05c6--