Bug #73665 [Com]: set_error_handler cant't listen E_Deprecated when opcache loaded

From: Date: Wed, 15 Sep 2021 21:03:27 +0000
Subject: Bug #73665 [Com]: set_error_handler cant't listen E_Deprecated when opcache loaded
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236633@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73665&edit=1 ID: 73665 Comment by: rkaiser at gmail dot com Reported by: lcx165 at gmail dot com Summary: set_error_handler cant't listen E_Deprecated when opcache loaded Status: Verified Type: Bug Package: opcache Operating System: Linux 64bit NTS PHP Version: 7.0.13 Block user comment: N Private report: N New Comment: This is still an issue in PHP 8.0.10. The first time a deprecation error is raised with opcache enabled, it doesn't trigger custom error handlers. Subsequent loads of the script, however, do. https://bugs.php.net/bug.php?id=81442 has an example using a different deprecation case. Previous Comments: ------------------------------------------------------------------------ [2020-09-07 07:40:43] nikic@php.net Related To: Bug #80058 ------------------------------------------------------------------------ [2020-01-30 10:23:51] nikic@php.net @rasmus at mindplay dot dk: Only triggers deprecation since 7.4. Was blocked on https://wiki.php.net/rfc/tostring_exceptions. ------------------------------------------------------------------------ [2020-01-30 10:20:24] rasmus at mindplay dot dk Has this been fixed in PHP 7.4? I was expecting to catch deprecations in my test-suite, and as you can see here, a deprecation from PHP 7.1 was not caught in my 7.2 environment: https://3v4l.org/SsL0q The deprecation can't be caught until 7.4, apparently. Now, this could be either because the issue has been resolved - or just because this particular method was flagged in documentation as deprecated in 7.1 but wasn't actually triggering a deprecation notice until 7.4. Any idea which it is? ------------------------------------------------------------------------ [2019-08-27 21:55:57] dwilks at intacct dot com I just ran into this as well and tracked it down to opcache running in Apache. Yes, it only happens once, while the script is compiling the first time before being cached. I assume it has something to do with opcache explicitly disabling the user_error_handler while compiling the script in opcache_compile_file. ------------------------------------------------------------------------ [2017-02-19 10:42:02] cmb@php.net The expected and actual results above are swapped, but otherwise I can reproduce this at least for the first page request. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73665 -- Edit this bug report at https://bugs.php.net/bug.php?id=73665&edit=1

« previous php.bugs (#236633) next »