Registering the constant may happen under another name due to
lowercasing. This will cause the lookup to the constant to fail.
Instead of looking it up, just change the Zend API to return a pointer
instead.
This commit is contained in:
Niels Dossche 2025-06-30 09:09:55 +02:00 committed by GitHub
parent db157e3168
commit 4a18c895ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 34 additions and 16 deletions

View file

@ -592,7 +592,7 @@ register_constant:
/* non persistent */
ZEND_CONSTANT_SET_FLAGS(&c, 0, PHP_USER_CONSTANT);
c.name = zend_string_copy(name);
if (zend_register_constant(&c) == SUCCESS) {
if (zend_register_constant(&c) != NULL) {
RETURN_TRUE;
} else {
RETURN_FALSE;