#
5a482a13 |
| 03-Dec-2024 |
Ilija Tovilo |
Fix enum to bool comparison The compiler compiles $value == true to ZEND_BOOL, which always returns true for objects (with the default cast_object handler). However, when compared to a
Fix enum to bool comparison The compiler compiles $value == true to ZEND_BOOL, which always returns true for objects (with the default cast_object handler). However, when compared to a statically unknown rhs $value == $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. Object to boolean comparison is now handled directly in zend_compare(), analogous to object to null comparison. It continuous to call the cast_object handler, but guarantees consistent behavior across ZEND_BOOL and ZEND_IS_EQUAL. Fixes GH-16954 Closes GH-17031
show more ...
|