xref: /PHP-8.0/ext/date/tests/bug45866.phpt (revision 8ac4d119)
1--TEST--
2Bug #45866 (decimal values fed to DateTime->modify() causes long execution times)
3--INI--
4date.timezone=UTC
5--FILE--
6<?php
7$date = new DateTime( '2009-07-29 16:44:23 Europe/London' );
8$date->modify( "+1.61538461538 day" );
9echo $date->format( 'r' ), "\n";
10
11$date = new DateTime( '2009-07-29 16:44:23 Europe/London' );
12$date->modify( "61538461538 day" );
13echo $date->format( 'r' ), "\n";
14
15$date = new DateTime( '2009-07-29 16:44:23 Europe/London' );
16$date->modify( "£61538461538 day" );
17echo $date->format( 'r' ), "\n";
18?>
19--EXPECTF--
20Thu, 14 Aug 168488594 16:44:23 +0000
21Thu, 14 Aug 168488594 16:44:23 +0000
22
23Warning: DateTime::modify(): Failed to parse time string (£61538461538 day) at position 0 (%s): Unexpected character in %sbug45866.php on line 11
24Wed, 29 Jul 2009 16:44:23 +0100
25