|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80058 Unparenthesized `a ? b : c ? d : e` does not trigger own error handler
Submitted: 2020-09-04 10:34 UTC Modified: 2020-09-07 07:40 UTC
From: jochem dot blok at fasterforward dot nl Assigned:
Status: Wont fix Package: Unknown/Other Function
PHP Version: 7.4.10 OS: Ubuntu 20.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
27 - 4 = ?
Subscribe to this entry?

 [2020-09-04 10:34 UTC] jochem dot blok at fasterforward dot nl
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();


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;


$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-04 10:38 UTC]
-Status: Open +Status: Wont fix
 [2020-09-04 10:38 UTC]
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.
 [2020-09-04 12:38 UTC] jochem dot blok at fasterforward dot nl
This is indeed the case when opcache is disbaled. BUT if you enable opcase the error is not handled by the error handler. Only by the shutdown handler.
 [2020-09-07 07:40 UTC]
Yes, opcache disables custom error handlers during compilation. I also checked that the opcache.replay_warnings mode in PHP 8 doesn't affect this.

It looks like this opcache issue already has a bug report at bug #73665.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 21 08:01:27 2024 UTC