blob: 3248689bf94d0628a7f69d241c7cb775b2c5cae9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
--TEST--
json_encode() & endless loop - 1
--SKIPIF--
<?php if (!extension_loaded("json")) print "skip"; ?>
--FILE--
<?php
$a = array();
$a[] = &$a;
var_dump($a);
echo "\n";
var_dump(json_encode($a));
var_dump(json_last_error(), json_last_error_msg());
echo "\n";
var_dump(json_encode($a, JSON_PARTIAL_OUTPUT_ON_ERROR));
var_dump(json_last_error(), json_last_error_msg());
echo "Done\n";
?>
--EXPECTF--
array(1) {
[0]=>
&array(1) {
[0]=>
*RECURSION*
}
}
bool(false)
int(6)
string(%d) "Recursion detected"
string(6) "[null]"
int(6)
string(%d) "Recursion detected"
Done
|