Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ var_export($obj, true);
===DONE===
--EXPECTF--

Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
Warning: var_export does not handle circular references in %s on line 9
===DONE===
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ var_export($a, true);
===DONE===
--EXPECTF--

Fatal error: Nesting level too deep - recursive dependency? in %s on line 9
Warning: var_export does not handle circular references in %s on line 9
===DONE===
10 changes: 10 additions & 0 deletions ext/standard/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC)
break;
case IS_ARRAY:
myht = Z_ARRVAL_PP(struc);
if(myht && myht->nApplyCount > 0){
smart_str_appendl(buf, "NULL", 4);
zend_error(E_WARNING, "var_export does not handle circular references");
return;
}
if (level > 1) {
smart_str_appendc(buf, '\n');
buffer_append_spaces(buf, level - 1);
Expand All @@ -469,6 +474,11 @@ PHPAPI void php_var_export_ex(zval **struc, int level, smart_str *buf TSRMLS_DC)

case IS_OBJECT:
myht = Z_OBJPROP_PP(struc);
if(myht && myht->nApplyCount > 0){
smart_str_appendl(buf, "NULL", 4);
zend_error(E_WARNING, "var_export does not handle circular references");
return;
}
if (level > 1) {
smart_str_appendc(buf, '\n');
buffer_append_spaces(buf, level - 1);
Expand Down