[php-src] Issue #21507: Confusing error message

From: Date: Mon, 23 Mar 2026 21:24:07 +0000
Subject: [php-src] Issue #21507: Confusing error message
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251836@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/21507 Author: exakat ### Description The following code: ```php <?php class X { const A = '1'; } $c = 'b'; isset(X::{$c}); ``` Resulted in this (valid) output: ``` atal error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) ``` but I cannot use `null !== X::{$c}`, which also yields a Fatal Error. With a constant, this message should recommend using 'defined()' instead, or on top of the current recommendation. ### PHP Version ```plain Tested on PHP 8.5, but any version since 8.3 ``` ### Operating System Not applicable.

« previous php.bugs (#251836) next »