Skip to content

Commit e092ff9

Browse files
committed
feedback
1 parent aaac439 commit e092ff9

File tree

2 files changed

+30
-37
lines changed

2 files changed

+30
-37
lines changed

ext/standard/tests/general_functions/gh20840.phpt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,11 @@ for ($i = 0; $i < 5000; $i++) {
2828
$node = $newNode;
2929
}
3030

31-
try {
32-
var_dump($firstNode);
33-
} catch (Error $e) {
34-
echo $e->getMessage(), "\n";
35-
}
31+
var_dump($firstNode);
3632

3733
while ($next = $firstNode->next) {
3834
$firstNode->next = $next->next;
3935
}
4036
?>
4137
--EXPECTF--
42-
object(Node)#1 (1) {
43-
%a
44-
}
45-
Maximum call stack size of %d bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached. Infinite recursion?
38+
object(Node)#%d (%d) {%anesting level too deep%a}

ext/standard/var.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -67,38 +67,38 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze
6767
{
6868
const char *prop_name, *class_name;
6969

70-
if (UNEXPECTED(php_serialize_check_stack_limit())) {
71-
return;
72-
}
73-
74-
if (key == NULL) { /* numeric key */
75-
php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
76-
} else { /* string key */
77-
int unmangle = zend_unmangle_property_name(key, &class_name, &prop_name);
78-
php_printf("%*c[", level + 1, ' ');
79-
80-
if (class_name && unmangle == SUCCESS) {
81-
if (class_name[0] == '*') {
82-
php_printf("\"%s\":protected", prop_name);
70+
if (UNEXPECTED(zend_call_stack_overflowed(EG(stack_limit)))) {
71+
php_printf("%*cnesting level too deep", level + 1, ' ');
72+
} else {
73+
if (key == NULL) { /* numeric key */
74+
php_printf("%*c[" ZEND_LONG_FMT "]=>\n", level + 1, ' ', index);
75+
} else { /* string key */
76+
int unmangle = zend_unmangle_property_name(key, &class_name, &prop_name);
77+
php_printf("%*c[", level + 1, ' ');
78+
79+
if (class_name && unmangle == SUCCESS) {
80+
if (class_name[0] == '*') {
81+
php_printf("\"%s\":protected", prop_name);
82+
} else {
83+
php_printf("\"%s\":\"%s\":private", prop_name, class_name);
84+
}
8385
} else {
84-
php_printf("\"%s\":\"%s\":private", prop_name, class_name);
86+
php_printf("\"");
87+
PHPWRITE(ZSTR_VAL(key), ZSTR_LEN(key));
88+
php_printf("\"");
8589
}
86-
} else {
87-
php_printf("\"");
88-
PHPWRITE(ZSTR_VAL(key), ZSTR_LEN(key));
89-
php_printf("\"");
90+
ZEND_PUTS("]=>\n");
9091
}
91-
ZEND_PUTS("]=>\n");
92-
}
9392

94-
if (Z_TYPE_P(zv) == IS_UNDEF) {
95-
ZEND_ASSERT(ZEND_TYPE_IS_SET(prop_info->type));
96-
zend_string *type_str = zend_type_to_string(prop_info->type);
97-
php_printf("%*cuninitialized(%s)\n",
98-
level + 1, ' ', ZSTR_VAL(type_str));
99-
zend_string_release(type_str);
100-
} else {
101-
php_var_dump(zv, level + 2);
93+
if (Z_TYPE_P(zv) == IS_UNDEF) {
94+
ZEND_ASSERT(ZEND_TYPE_IS_SET(prop_info->type));
95+
zend_string *type_str = zend_type_to_string(prop_info->type);
96+
php_printf("%*cuninitialized(%s)\n",
97+
level + 1, ' ', ZSTR_VAL(type_str));
98+
zend_string_release(type_str);
99+
} else {
100+
php_var_dump(zv, level + 2);
101+
}
102102
}
103103
}
104104
/* }}} */

0 commit comments

Comments
 (0)