Commit d6ff86a581e for php
commit d6ff86a581e5e4465e497ef419c3144028024d17
Merge: 3349db007fb 467b203d9f8
Author: Arnaud Le Blanc <arnaud.lb@gmail.com>
Date: Tue Nov 17 17:42:37 2026 +0100
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
Fix object_properties_load() with integer keys (#25495)
diff --cc NEWS
index 84e70e056c1,84cee28fa27..9b52776e7b0
--- a/NEWS
+++ b/NEWS
@@@ -34,8 -26,9 +34,11 @@@ PH
. Fixed bug GH-25311 (Assertion ret == SUCCESS in array_map()/array_filter()
after delayed out-of-memory). (ndossche)
. Fixed AST export of by-reference property hooks. (Jorg Sowa)
+ . Fixed AST export of property hook parameter lists and attributes.
+ (Jorg Sowa)
+ . Fixed object_properties_load() adding integer keys to property tables, which
+ made the properties unreadable and clone hit an assertion.
+ (Nicolas Grekas)
- Curl:
. Fixed curl_reset() retaining CURLOPT_PRIVATE after reset. (lacatoire)
diff --cc Zend/zend_API.c
index 4dba7fa25b0,e7c593bae62..55aa6ae8497
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@@ -1851,14 -1805,17 +1851,17 @@@ ZEND_API void object_properties_load(ze
}
} else {
if (UNEXPECTED(object->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) {
- zend_throw_error(NULL, "Cannot create dynamic property %s::$" ZEND_LONG_FMT, ZSTR_VAL(object->ce->name), h);
+ zend_throw_error(NULL, "Cannot create dynamic property %pS::$" ZEND_LONG_FMT, object->ce->name, h);
return;
} else if (!(object->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES)) {
- zend_error(E_DEPRECATED, "Creation of dynamic property %s::$" ZEND_LONG_FMT " is deprecated",
- ZSTR_VAL(object->ce->name), h);
+ zend_error(E_DEPRECATED, "Creation of dynamic property %pS::$" ZEND_LONG_FMT " is deprecated",
+ object->ce->name, h);
}
- prop = zend_hash_index_update(zend_std_get_properties_ex(object), h, prop);
+ /* Property tables only have string keys */
+ zend_string *name = zend_long_to_str(h);
+ prop = zend_hash_update(zend_std_get_properties_ex(object), name, prop);
+ zend_string_release_ex(name, false);
zval_add_ref(prop);
}
} ZEND_HASH_FOREACH_END();