Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:104274 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 52116 invoked from network); 7 Feb 2019 12:19:38 -0000 Received: from unknown (HELO mail-yw1-f53.google.com) (209.85.161.53) by pb1.pair.com with SMTP; 7 Feb 2019 12:19:38 -0000 Received: by mail-yw1-f53.google.com with SMTP id p17so4353872ywg.0 for ; Thu, 07 Feb 2019 01:01:14 -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=UTFEByrdbNCI9PxgoMifyxAbuIGAtED/Ri/kjg02c+g=; b=VkPudY+dzPdp6n6FnAKPjP3wQXhRkuwyx2KpRt32eyCeGWCVPaWuD4rEbIYl0Ifbem gHNgIs/u37JgpvlZsc6WXIx+jSUk25TyL9+rlauBeO+D9IjP+evhEKaCRBxA6we1hP8Q NGBcSmt+WHSDUbtoDucxyrCe4Xs5njCMwmBsuVpws/WZts1AuZaHI9g8KKHDE6F/fkAa pLEuCJlcPBZR9HKJscrdHMZGscvll2DsYhvgstT8vyrKmRD/w9pvuVocRe+s+3ecOQiF HH56/NkG7A54ONHkb5bsHrcfkb5DriGX5g+GeUAVd7h1w2iadr+Go30BCGD+Yj2C99bO uIoQ== 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=UTFEByrdbNCI9PxgoMifyxAbuIGAtED/Ri/kjg02c+g=; b=jU8RiWjrI5wBUVQ0S8PWpNYOW/XeGujm+yp+ok5j76CXF/FlyzAQSSgJs1gdNLkM4O ajSrOdlKymVbKtNv9rI1pp/O7V9ZgxdonAxrWp6vtLpjdAfScWldXdBs83EW6b90QmHH pBFAKbG2nvexK5kw/hzI4O48EIekvxtm279oCZ2WLehh9y+WWiUBUkaM5vlX1zKc1tkP /gQRdtPVCYV7k1xp5BsA/mAl6FmcAQEtXD200fO7H6PsTYGVlfYaCuGYGQjRN5vkHp5u v8eDNUFTGSJO0iflRYqyVcwtcLNoHSyqA7S1WmWcjhBeKq/5zABPejj359u2UlEE9OuN 7LzA== X-Gm-Message-State: AHQUAub6xU8oT5wQQxpLPQYfWzXx2TdjF6jam571os5tnBvyun57E6ts S4S1YIz3Yw0juw0MDVswEnURtuislfGXRZ8m8M0= X-Google-Smtp-Source: AHgI3IZW2JO+JRqpF7Ck9BmYfiVb1qMjYt49vCK55ujSU/ZQt46pXYGHnENpQJzG5NXvmbNdELPI5mgxxWPksHzCPiM= X-Received: by 2002:a81:5507:: with SMTP id j7mr12219941ywb.491.1549530074067; Thu, 07 Feb 2019 01:01:14 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 7 Feb 2019 10:01:01 +0100 Message-ID: To: Pierre Joye Cc: Girgias , Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000a2386b05814a1547" Subject: Re: [PHP-DEV] Don't silence fatal errors From: benjamin.morel@gmail.com (Benjamin Morel) --000000000000a2386b05814a1547 Content-Type: text/plain; charset="UTF-8" > > 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. flock doesn't protect from other failures, such as a fread()ing a file located on NFS. As it stands now, @ may still useful to mute warnings and throw exceptions instead. The other solution today is to set up a temporary error handler before calling the native function, and restore the previous error handler right after, such as here . This allows to get the error message, but might incur a small performance penalty. IMO, @ can be safely removed the day PHP converts current warnings to exceptions. On Thu, 7 Feb 2019 at 02:32, Pierre Joye wrote: > 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] > > > > Best regards > > > > George Peter Banyard > > > > [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. > > best, > Pierre > > > > > > --000000000000a2386b05814a1547--