3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo implements \JsonSerializable { public function jsonSerialize() { return new self; } } var_dump(json_encode(new Foo));
based on PQj2L
Output for 5.4.0 - 5.6.30, hhvm-3.17.3 - 3.20.2, 7.0.0 - 7.2.2

Process exited with code 139.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Stack overflow in /in/tLMv6:-1 Stack trace: #0 (): Foo->jsonSerialize() #1 /in/tLMv6(-1): json_encode() #2 {main}
Process exited with code 255.
Output for hhvm-3.21.0 - 3.21.3
Fatal error: Uncaught Error: Stack overflow in /in/tLMv6:5 Stack trace: #0 (): Foo->jsonSerialize() #1 /in/tLMv6(9): json_encode() #2 {main}
Process exited with code 255.
Output for hhvm-3.15.4
Assertion failure: /tmp/tmp.IY1ufrEsc9/hphp/runtime/base/runtime-error.cpp:48: void HPHP::raise_error(const string&): assertion `0' failed.
Process exited with code 134.
Output for hhvm-3.13.2
Assertion failure: /tmp/tmp.7cqYbndD88/hphp/runtime/base/runtime-error.cpp:48: void HPHP::raise_error(const string&): assertion `0' failed.
Process exited with code 134.
Output for hhvm-3.12.14
Assertion failure: /tmp/tmp.V3wJAhcnRu/hphp/runtime/base/runtime-error.cpp:48: void HPHP::raise_error(const string&): assertion `0' failed.
Process exited with code 134.
Output for hhvm-3.11.1
Assertion failure: /tmp/tmp.6N2uyq9UKg/hphp/runtime/base/runtime-error.cpp:48: void HPHP::raise_error(const string&): assertion `0' failed.
Process exited with code 134.
Output for hhvm-3.10.1
Fatal error: Stack overflow in /in/tLMv6 on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Interface 'JsonSerializable' not found in /in/tLMv6 on line 3
Process exited with code 255.
Output for 5.0.5 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tLMv6 on line 3 Fatal error: Interface 'JsonSerializable' not found in /in/tLMv6 on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/tLMv6 on line 3 Fatal error: Class 'JsonSerializable' not found in /in/tLMv6 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '{' in /in/tLMv6 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting '{' in /in/tLMv6 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'{'' in /in/tLMv6 on line 3
Process exited with code 255.