1--TEST-- 2DateTime invalid serialization data 3--FILE-- 4<?php 5$propertySets = [ 6 /* Two correct ones */ 7 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 1, 'timezone' => "+02:30" ], 8 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 3, 'timezone' => "Europe/Kyiv" ], 9 /* Error situations */ 10 [ 'date' => 2023.113, 'timezone_type' => 1, 'timezone' => "+02:30" ], 11 [ 'date' => 2023.113, 'timezone_type' => 3, 'timezone' => "Europe/Kyiv" ], 12 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 1.4, 'timezone' => "+02:30" ], 13 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 3.4, 'timezone' => "Europe/Kyiv" ], 14 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 1, 'timezone' => 2.5 ], 15 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 3, 'timezone' => 2.5 ], 16 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 3, 'timezone' => "Europe/Lviv" ], 17 [ 'date' => "2023-01-13 12:29:30", 'timezone_type' => 4, 'timezone' => "Europe/Kyiv" ], 18]; 19 20foreach( $propertySets as $propertySet ) 21{ 22 try { 23 $d = DateTime::__set_state( $propertySet ); 24 echo "OK\n"; 25 } catch (\Error $e) { 26 echo $e::class, ': ', $e->getMessage(), "\n"; 27 } 28} 29?> 30--EXPECT-- 31OK 32OK 33Error: Invalid serialization data for DateTime object 34Error: Invalid serialization data for DateTime object 35Error: Invalid serialization data for DateTime object 36Error: Invalid serialization data for DateTime object 37Error: Invalid serialization data for DateTime object 38Error: Invalid serialization data for DateTime object 39Error: Invalid serialization data for DateTime object 40Error: Invalid serialization data for DateTime object 41