Bug #81442 [NEW]: Deprecation warning(?) does not trigger error handler

From: Date: Wed, 15 Sep 2021 18:50:32 +0000
Subject: Bug #81442 [NEW]: Deprecation warning(?) does not trigger error handler
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236630@lists.php.net to get a copy of this message
From: rkaiser at gmail dot com Operating system: CentOS 7.7 PHP version: 8.0.10 Package: Unknown/Other Function Bug Type: Bug Bug description:Deprecation warning(?) does not trigger error handler Description: ------------ If you have a function with parameter with a default value preceding a required parameter (https://www.php.net/manual/en/migration80.deprecated.php), you get a deprecation warning (or notice? not clear which it is). However this warning doesn't get caught by set_error_handler() for some reason. I first noticed this while using opcache (see https://bugs.php.net/bug.php?id=73665) but then noticed it repros even without opcache enabled. Test script: --------------- set_error_handler(function ($errno, $errstr, $errfile, $errline) { // This never hits die('caught in error handler'); }); function test($a = 1, $b ) { echo 'this executes'; } // Displays "Deprecated: Required parameter $b follows optional parameter $a" test(null, null); Expected result: ---------------- I would expect the error handler to catch this warning. Actual result: -------------- Function executes and displays the warning. If set_error_handler() is not supposed to catch this, is there another mechanism in PHP 8 to catch this warning at runtime? It's often not practical to fix the references in 3rd party code that hasn't been updated for PHP 8 yet. -- Edit bug report at https://bugs.php.net/bug.php?id=81442&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81442&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81442&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81442&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81442&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81442&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81442&r=support Expected behavior: https://bugs.php.net/fix.php?id=81442&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81442&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81442&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81442&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81442&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81442&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81442&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81442&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81442&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81442&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81442&r=mysqlcfg

« previous php.bugs (#236630) next »