Skip to content

Commit 5ffe6f1

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16187: ReflectionClass::__toString() with packed properties hash table
2 parents ed8d6b5 + 6631aa9 commit 5ffe6f1

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

ext/reflection/php_reflection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, const
484484

485485
count = 0;
486486
if (properties && zend_hash_num_elements(properties)) {
487-
ZEND_HASH_MAP_FOREACH_STR_KEY(properties, prop_name) {
487+
ZEND_HASH_FOREACH_STR_KEY(properties, prop_name) {
488488
if (prop_name && ZSTR_LEN(prop_name) && ZSTR_VAL(prop_name)[0]) { /* skip all private and protected properties */
489489
if (!zend_hash_exists(&ce->properties_info, prop_name)) {
490490
count++;

ext/reflection/tests/gh16187.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
GH-16187 (ReflectionClass::__toString() with unpacked properties)
3+
--EXTENSIONS--
4+
simplexml
5+
--FILE--
6+
<?php
7+
$xml = '<form name="test"></form>';
8+
$simplexml = simplexml_load_string($xml);
9+
$reflector = new ReflectionObject($simplexml['name']);
10+
$reflector->__toString();
11+
?>
12+
DONE
13+
--EXPECT--
14+
DONE

0 commit comments

Comments
 (0)