Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix GH-16187: ReflectionClass::__toString() with packed properties hash table
This commit is contained in:
Niels Dossche 2024-10-05 10:21:30 +02:00
commit 5ffe6f1644
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 15 additions and 1 deletions

View file

@ -484,7 +484,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, const
count = 0; count = 0;
if (properties && zend_hash_num_elements(properties)) { if (properties && zend_hash_num_elements(properties)) {
ZEND_HASH_MAP_FOREACH_STR_KEY(properties, prop_name) { ZEND_HASH_FOREACH_STR_KEY(properties, prop_name) {
if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */ if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */
if (!zend_hash_exists(&ce->properties_info, prop_name)) { if (!zend_hash_exists(&ce->properties_info, prop_name)) {
count++; count++;

View file

@ -0,0 +1,14 @@
--TEST--
GH-16187 (ReflectionClass::__toString() with unpacked properties)
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml = '<form name="test"></form>';
$simplexml = simplexml_load_string($xml);
$reflector = new ReflectionObject($simplexml['name']);
$reflector->__toString();
?>
DONE
--EXPECT--
DONE