[php-src] PR #17031: Fix enum to bool comparison
| From: | iluuu1994 | Date: | Tue, 03 Dec 2024 13:30:48 +0000 |
| Subject: | [php-src] PR #17031: Fix enum to bool comparison | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-29872@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/17031
Author: iluuu1994
The compiler compiles $enum == true to ZEND_BOOL, which always returns true for objects (with the
default cast_object handler). However, when compared to a statically unknown value $enum == $true,
the resulting opcode ZEND_IS_EQUAL would call the objects compare handler.
The zend_objects_not_comparable() handler, which is installed for enums and other internal classes,
blanketly returns false. This does not match the ZEND_BOOL semantics.
We now handle bools in zend_objects_not_comparable() explicitly.
Fixes GH-16954