mirror of
https://github.com/php/php-src.git
synced 2026-03-26 01:02:25 +01:00
These are no longer needed after https://wiki.php.net/rfc/always_enable_json Closes GH-5637
26 lines
562 B
PHP
26 lines
562 B
PHP
--TEST--
|
|
Bug #71835 (json_encode sometimes incorrectly detects recursion with JsonSerializable)
|
|
--FILE--
|
|
<?php
|
|
class SomeClass implements JsonSerializable {
|
|
public function jsonSerialize() {
|
|
return [get_object_vars($this)];
|
|
}
|
|
}
|
|
$class = new SomeClass;
|
|
$arr = [$class];
|
|
var_dump(json_encode($arr));
|
|
|
|
class SomeClass2 implements JsonSerializable {
|
|
public function jsonSerialize() {
|
|
return [(array)$this];
|
|
}
|
|
}
|
|
$class = new SomeClass2;
|
|
$arr = [$class];
|
|
var_dump(json_encode($arr));
|
|
?>
|
|
--EXPECT--
|
|
string(6) "[[[]]]"
|
|
string(6) "[[[]]]"
|