Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104271 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43187 invoked from network); 7 Feb 2019 11:56:21 -0000 Received: from unknown (HELO mail-wr1-f43.google.com) (209.85.221.43) by pb1.pair.com with SMTP; 7 Feb 2019 11:56:21 -0000 Received: by mail-wr1-f43.google.com with SMTP id l9so10477804wrt.13 for ; Thu, 07 Feb 2019 00:37:57 -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=3UVdtOce8oW2G1PbWRyVSE9SIYtWCvnIH7EvKv9CdPY=; b=TZ6e71nbsRWpPlBiXW1GdtBQ0XPiq6CMff42QXNtvUreF5sKpjlKz/F+gfZiJfPle8 y4bvV9eK36FW/eY/bko1BUZsZIvyK2W3LJbuW+VBf7Wd8f82xl9uUHbhMdBdFY+NAbE8 HLTgTsY3dYtoeE5QgkusN/vEMpnmmuGXRUyuYG9I0jgeEwhll7qbNCKudFC3vO306vct B8P1pPeQq5QKiF7hpOurgfN8UhVkLXYtj3WzErnza7oh8qeCdWi1G7OZ/XpCjMFYr0Qh sHAp41e6etR5c21pkuq5sNKt3+aLC2oiBKFNBvP4d3lyyN+Qq9Oz4gwi0caSHsixepxn L1Sw== 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=3UVdtOce8oW2G1PbWRyVSE9SIYtWCvnIH7EvKv9CdPY=; b=A4VXoyoS/mBvCKrpThOPMYIGq2sZZ17onRS8klrdFPIyz5sDEzy0aQE3GE0pSOsvhG uPdxjFXYmU4xEaDJQ+krAo3lg0UA2qJzmkRkQTawIA7pD1o1AlHta0Aouu303eA+x6Uq dzRbqFhr0JaAM2Yn4Y/LFl4XIeEGvE737lr9tEUOeVpzX8Wyo6cgWey1pP9NHuETgDHv WszwArjKr2Um8qIsrBhc+hwCCTKqw+LE7y/GvKfA9QhlPKfCN9JzjRx26/j1yZU0xG2Q vFbxC/jMU5+pGe98JxLsXtsW+xZfLQNdLwFAYOPUSf4JzbctS1Sph/g/1/sOGB2jRFnd CD0w== X-Gm-Message-State: AHQUAubv5SJ+VhydB+lS33JSYN3Cx3cNtkbIt7EdYnjpOsAo/v5dhzc4 3q/IHo5/7/2xaY4f2l9uGs81qpRh24pgl6zuk5tT9g== X-Google-Smtp-Source: AHgI3IYxJxi1NBunYkW7Mpr4fMfz0FCS2LWaY/gcFFWZXaPh8JDI+KEGvJb2q0o1hz5QHzxwuGKBHVUXdlc4yYO/vuM= X-Received: by 2002:adf:f703:: with SMTP id r3mr11025443wrp.93.1549528676120; Thu, 07 Feb 2019 00:37:56 -0800 (PST) MIME-Version: 1.0 References: <220843E5-03CD-4E7E-8DB5-1062C24AB8CE@cschneid.com> In-Reply-To: <220843E5-03CD-4E7E-8DB5-1062C24AB8CE@cschneid.com> Date: Thu, 7 Feb 2019 08:37:43 +0700 Message-ID: To: Christian Schneider Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Don't silence fatal errors From: pierre.php@gmail.com (Pierre Joye) On Thu, Feb 7, 2019 at 3:14 PM Christian Schneider wrote: > > Am 07.02.2019 um 02:32 schrieb Pierre Joye : > > On Thu, Feb 7, 2019, 8:07 AM Girgias >> The most common case which comes to mind is to suppress erros while file reading. > >> Because even if you check a file exists it could be deleted inbetween the check and the > >> read command. As you can see this is even written in the documentation [1] > >> > >> [1] https://secure.php.net/manual/en/function.fopen.php > > > > That is one the cases I meant. Also this is a bug in the user code. I can > > imagine doing it on purpose for performance reasons (if the file is created/deleted by other apps) tho'. > > flock is what should be used here. > > Sorry if I'm missing something but would flock() help with file_get_contents() and an external program deleting a file? > > We have the following fields where we sometimes use @ to suppress error_log entries so they do not hide real problems not handled by our code already: > - filesystem operations like file_get_contents() or mkdir() which can have (benevolent) races > - json_decode() of external data (we check the validity of the data afterwards anyway) > - DB connections which we log more detailed separately where the generic error is not interesting > > In general I agree with the notion of using @ as little as possible but I think it will has use cases where using error_reporting() instead would decrease code readability. > > Please do not remove @ ;-) My thought that @ mainly relates to another RFC where errors/warning are very inconsistently reported or designed (like forcing one to use @). 8 would be a good candidate to clean that up, like the TypeError RFC. best, Pierre