diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
|---|---|---|
| committer | <> | 2013-04-03 16:25:08 +0000 |
| commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
| tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/date/tests/bug44562.phpt | |
| download | php2-master.tar.gz | |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/date/tests/bug44562.phpt')
| -rw-r--r-- | ext/date/tests/bug44562.phpt | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/date/tests/bug44562.phpt b/ext/date/tests/bug44562.phpt new file mode 100644 index 0000000..89ca740 --- /dev/null +++ b/ext/date/tests/bug44562.phpt @@ -0,0 +1,38 @@ +--TEST-- +Bug #44562 (Creating instance of DatePeriod crashes) +--FILE-- +<?php +date_default_timezone_set('Europe/Oslo'); + +try +{ + $dp = new DatePeriod('2D'); +} +catch ( Exception $e ) +{ + echo $e->getMessage(), "\n"; +} + +$begin = new DateTime( "2008-07-20T22:44:53+0200" ); +$interval = DateInterval::createFromDateString( "1 day" ); + +$dp = new DatePeriod( $begin, $interval, 10 ); +foreach ( $dp as $d ) +{ + var_dump ($d->format( DATE_ISO8601 ) ); +} + +?> +--EXPECT-- +DatePeriod::__construct(): Unknown or bad format (2D) +string(24) "2008-07-20T22:44:53+0200" +string(24) "2008-07-21T22:44:53+0200" +string(24) "2008-07-22T22:44:53+0200" +string(24) "2008-07-23T22:44:53+0200" +string(24) "2008-07-24T22:44:53+0200" +string(24) "2008-07-25T22:44:53+0200" +string(24) "2008-07-26T22:44:53+0200" +string(24) "2008-07-27T22:44:53+0200" +string(24) "2008-07-28T22:44:53+0200" +string(24) "2008-07-29T22:44:53+0200" +string(24) "2008-07-30T22:44:53+0200" |
