]> granicus.if.org Git - php/commitdiff
MFH: use E_WARNING on recursion and add null to the result to keep it valid
authorAntony Dovgal <tony2001@php.net>
Thu, 20 Jul 2006 09:33:28 +0000 (09:33 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 20 Jul 2006 09:33:28 +0000 (09:33 +0000)
ext/json/json.c
ext/json/tests/003.phpt
ext/json/tests/004.phpt
ext/json/tests/005.phpt

index 99e80fa913de6383af90ad5adaf986512e1568c1..1b7de735d9b3026c39401ece602d9c4d412ddc72 100644 (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;
     }
 
index bb5619d9dd9143a5a12c0120d417e22782da6582..6ae92bbebd1d0b91dd319ff87b9989df8e84e38f 100644 (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
index 21777ba2a16ba246f7fd8aeb2c9bd235b20cb1ee..884d874205473549c158158bc40713a96cda6cda 100644 (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
index b11168702c51c2498bb22b2d6fe42176471fbc77..f6a8977d184f183221083366d5400ce95095f978 100644 (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