3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL & ~E_DEPRECATED); // test serialize() functionality on shutdown register_shutdown_function('shutdown_serialize_test'); function shutdown_serialize_test() { $bug_test = new stdClass(); $bug_test_serialized = serialize([$bug_test, $bug_test]); $bug_test_unserialized = unserialize($bug_test_serialized); if ($bug_test_unserialized === false) { echo "\nserialize() / unserialize() round trip failed on shutdown\n"; } $reference_serialized = 'a:2:{i:0;O:8:"stdClass":0:{}i:1;r:2;}'; if ($bug_test_serialized !== $reference_serialized) { echo "serialize() on shutdown does not match reference:\n"; echo "$bug_test_serialized\n"; echo "should be:\n"; echo "$reference_serialized\n"; } } // records $test into trace function crash_step_1($test) { crash_step_2(debug_backtrace()); } // works on the first trace and serializes it, which triggers the second trace function crash_step_2($trace1) { $new_trace = []; foreach ($trace1 as $traceline) { if (isset($traceline['args'])) { $new_args = []; foreach ($traceline['args'] as $traceline_arg) { $new_args[] = $traceline_arg; } $traceline['args'] = $new_args; // this fails as well # $traceline['args'] = $traceline['args']; } $new_trace[] = $traceline; } return serialize($new_trace); } class class_crash_step_3 { protected function trace2() { $trace2 = debug_backtrace(); $var_list = []; foreach ($trace2 as $traceline) { if (!isset($traceline['args'])) continue; foreach ($traceline['args'] as $tracearg) { $var_idx = false; foreach ($var_list as $found_idx => $var_list_item) { // eventually, this comparison triggers the Fatal error if ($var_list_item === $tracearg) { $var_idx = $found_idx; break; } } if ($var_idx === false) { $var_list[] = $tracearg; } } } } } // this one triggers "Fatal error: Nesting level too deep - recursive dependency?" // and corrupts serialize() during shutdown, also affecting session handlers class class_crash_step_3_variant_A extends class_crash_step_3 implements Serializable { public function serialize() { $this->trace2(); } public function unserialize($data) { } } // interface Serializable is deprecated. with magic methods, corruption does not occur, // but "Fatal error: Nesting level too deep - recursive dependency?" is still triggered class class_crash_step_3_variant_B extends class_crash_step_3 { public function __serialize() { $this->trace2(); } public function __unserialize($data) { } } $test = new class_crash_step_3_variant_A(); #$test = new class_crash_step_3_variant_B(); crash_step_1($test); echo "End of script";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.140.0130.00917.59
8.4.130.0130.00718.82
8.4.120.0070.01124.00
8.4.110.0050.00720.52
8.4.100.0120.00919.09
8.4.90.0130.00720.33
8.4.80.0070.00218.85
8.4.70.0120.00818.38
8.4.60.0080.01218.83
8.4.50.0100.00918.93
8.4.40.0130.00917.80
8.4.30.0060.01318.61
8.4.20.0130.00619.70
8.4.10.0130.00619.71
8.3.270.0100.01016.68
8.3.260.0050.00416.79
8.3.250.0110.00718.81
8.3.240.0110.00918.85
8.3.230.0050.00416.73
8.3.220.0040.00419.10
8.3.210.0040.00316.87
8.3.200.0050.00416.88
8.3.190.0090.01017.28
8.3.180.0090.01117.29
8.3.170.0070.01120.96
8.3.160.0160.00316.65
8.3.150.0140.00417.26
8.3.140.0040.00417.55
8.3.130.0000.00818.50
8.3.120.0030.00620.44
8.3.110.0050.00318.63
8.3.100.0110.00416.75
8.3.90.0000.00826.77
8.3.80.0050.00818.88
8.3.70.0060.00330.84
8.3.50.0060.00330.84
8.2.290.0080.01020.27
8.2.280.0120.00718.55
8.2.270.0110.00717.39
8.2.260.0100.01018.32
8.2.250.0070.00319.06
8.2.240.0080.00018.77
8.2.230.0100.00020.94
8.2.220.0040.00424.06
8.2.210.0090.00926.77
8.2.200.0120.00030.84
8.2.190.0090.00330.84
8.1.330.0070.00222.24
8.1.320.0100.00720.14
8.1.310.0060.01516.97
8.1.300.0060.00317.98
8.1.290.0060.00630.84
8.1.280.0070.00330.84
7.3.00.0150.00330.84
7.2.330.0070.00930.84

preferences:
27.81 ms | 403 KiB | 5 Q