xref: /php-src/ext/date/tests/bug45866.phpt (revision b7860cd5)
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' );
16try {
17	$date->modify( "£61538461538 day" );
18} catch (DateMalformedStringException $e) {
19	echo $e::class, ': ', $e->getMessage(), "\n";
20}
21echo $date->format( 'r' ), "\n";
22?>
23--EXPECTF--
24Thu, 14 Aug 168488594 16:44:23 +0100
25Thu, 14 Aug 168488594 16:44:23 +0100
26DateMalformedStringException: DateTime::modify(): Failed to parse time string (£61538461538 day) at position 0 (%s): Unexpected character
27Wed, 29 Jul 2009 16:44:23 +0100
28