MFH: use E_WARNING on recursion and add null to the result to keep it valid

This commit is contained in:
Antony Dovgal 2006-07-20 09:33:28 +00:00
parent 60720d285f
commit 3003cd2473
4 changed files with 11 additions and 4 deletions

View File

@ -136,7 +136,8 @@ static void json_encode_array(smart_str *buf, zval **val TSRMLS_DC) {
}
if (myht && myht->nApplyCount > 1) {
php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "recursion detected");
php_error_docref(NULL TSRMLS_CC, E_WARNING, "recursion detected");
smart_str_appendl(buf, "null", 4);
return;
}

View File

@ -25,4 +25,6 @@ array(1) {
}
}
Catchable fatal error: json_encode(): recursion detected in %s on line %d
Warning: json_encode(): recursion detected in %s on line %d
string(8) "[[null]]"
Done

View File

@ -22,4 +22,6 @@ object(stdClass)#%d (1) {
}
}
Catchable fatal error: json_encode(): recursion detected in %s on line %d
Warning: json_encode(): recursion detected in %s on line %d
string(22) "{"prop":{"prop":null}}"
Done

View File

@ -22,4 +22,6 @@ array(1) {
}
}
Catchable fatal error: json_encode(): recursion detected in %s on line %d
Warning: json_encode(): recursion detected in %s on line %d
string(8) "[[null]]"
Done