Bug #80058 [Opn->Wfx]: Unparenthesized `a ? b : c ? d : e` does not trigger own error handler

From: Date: Fri, 04 Sep 2020 10:38:16 +0000
Subject: Bug #80058 [Opn->Wfx]: Unparenthesized `a ? b : c ? d : e` does not trigger own error handler
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228882@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80058&edit=1 ID: 80058 Updated by: nikic@php.net Reported by: jochem dot blok at fasterforward dot nl Summary: Unparenthesized a ? b : c ? d : e does not trigger own error handler -Status: Open +Status: Wont fix Type: Bug Package: Unknown/Other Function Operating System: Ubuntu 20.04 PHP Version: 7.4.10 Block user comment: N Private report: N New Comment: This is a compile-time error, that is triggered before your set_error_handler() call. To catch it, set_error_handler() needs to be called before the file is included. Previous Comments: ------------------------------------------------------------------------ [2020-09-04 10:34:59] jochem dot blok at fasterforward dot nl Description: ------------ Error "Unparenthesized a ? b : c ? d : e is deprecated. Use either (a ? b : c) ? d : e or a ? b : (c ? d : e)" does not trigger own error handler. Callingerror_get_last() does return this error. Test script: --------------- function shutdown() { $error = error_get_last(); var_dump($error); } register_shutdown_function('shutdown'); function myErrorHandler($errno, $errstr, $errfile, $errline) { echo "\n\n--------------- ERROR ---------------------\n\n"; echo "\n".'errno = '; print_r($errno); echo "\n".'errstr = '; print_r($errstr); echo "\n".'errfile = '; print_r($errfile); echo "\n".'errline = '; print_r($errline); return true; } set_error_handler("myErrorHandler"); $a = 1; $b = 2; $c = 3; $d = 4; $e = 5; echo $a ? $b : $c ? $d : $e; parse_str ('wrweqr'); Expected result: ---------------- As you can see parse_str is handle by the own error handler. "echo $a ? $b : $c ? $d : $e;" should also be handled. Actual result: -------------- Only parse_str is handled. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80058&edit=1

« previous php.bugs (#228882) next »