summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-07-20 09:33:28 +0000
committerAntony Dovgal <tony2001@php.net>2006-07-20 09:33:28 +0000
commit3003cd2473fe2a12ba052d6304bd5846100fd1cc (patch)
treec57dabf613c729f4d018046320dcb654638278b0 /ext/json
parent60720d285f6c0ec42bb15946f9eb5f5516e46b7f (diff)
downloadphp-git-3003cd2473fe2a12ba052d6304bd5846100fd1cc.tar.gz
MFH: use E_WARNING on recursion and add null to the result to keep it valid
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/json.c3
-rw-r--r--ext/json/tests/003.phpt4
-rw-r--r--ext/json/tests/004.phpt4
-rw-r--r--ext/json/tests/005.phpt4
4 files changed, 11 insertions, 4 deletions
diff --git a/ext/json/json.c b/ext/json/json.c
index 99e80fa913..1b7de735d9 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -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;
}
diff --git a/ext/json/tests/003.phpt b/ext/json/tests/003.phpt
index bb5619d9dd..6ae92bbebd 100644
--- a/ext/json/tests/003.phpt
+++ b/ext/json/tests/003.phpt
@@ -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
diff --git a/ext/json/tests/004.phpt b/ext/json/tests/004.phpt
index 21777ba2a1..884d874205 100644
--- a/ext/json/tests/004.phpt
+++ b/ext/json/tests/004.phpt
@@ -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
diff --git a/ext/json/tests/005.phpt b/ext/json/tests/005.phpt
index b11168702c..f6a8977d18 100644
--- a/ext/json/tests/005.phpt
+++ b/ext/json/tests/005.phpt
@@ -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