1--TEST-- 2DateTimeZone compare handler 3--FILE-- 4<?php 5class MyDateTimeZone extends DateTimeZone 6{ 7 function __construct() 8 { 9 } 10} 11 12$mdtz = new MyDateTimeZone(); 13$dtzID = new DateTimeZone("Europe/Kyiv"); 14$dtzAbbr = new DateTimeZone("CEST"); 15$dtzUTC = new DateTimeZone("-5:00"); 16 17 18try { 19 var_dump($mdtz < $dtzID); 20} catch (\DateObjectError $e) { 21 echo $e::class, ': ', $e->getMessage(), "\n"; 22} 23 24try { 25 var_dump($dtzID < $mdtz); 26} catch (\DateObjectError $e) { 27 echo $e::class, ': ', $e->getMessage(), "\n"; 28} 29 30try { 31 var_dump($dtzID < $dtzAbbr); 32} catch (\DateException $e) { 33 echo $e::class, ': ', $e->getMessage(), "\n"; 34} 35 36try { 37 var_dump($dtzAbbr < $dtzUTC); 38} catch (\DateException $e) { 39 echo $e::class, ': ', $e->getMessage(), "\n"; 40} 41?> 42--EXPECT-- 43DateObjectError: Trying to compare uninitialized DateTimeZone objects 44DateObjectError: Trying to compare uninitialized DateTimeZone objects 45DateException: Cannot compare two different kinds of DateTimeZone objects 46DateException: Cannot compare two different kinds of DateTimeZone objects 47