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/bug50392.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/bug50392.phpt')
| -rw-r--r-- | ext/date/tests/bug50392.phpt | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ext/date/tests/bug50392.phpt b/ext/date/tests/bug50392.phpt new file mode 100644 index 0000000..9b10023 --- /dev/null +++ b/ext/date/tests/bug50392.phpt @@ -0,0 +1,45 @@ +--TEST-- +Bug #50392 (date_create_from_format enforces 6 digits for 'u' format character) +--FILE-- +<?php +date_default_timezone_set('Europe/Bratislava'); + +$base = '2009-03-01 18:00:00'; + +for ($i = 0; $i < 8; $i++) { + $string = $base . '.' . str_repeat($i, $i); + echo $string, "\n- "; + $result = date_parse_from_format('Y-m-d H:i:s.u', $string); + echo $result['fraction'] ? $result['fraction'] : 'X', "\n"; + foreach( $result['errors'] as $error ) { + echo "- ", $error, "\n"; + } + echo "\n"; +} +?> +--EXPECT-- +2009-03-01 18:00:00. +- X +- Data missing + +2009-03-01 18:00:00.1 +- 0.1 + +2009-03-01 18:00:00.22 +- 0.22 + +2009-03-01 18:00:00.333 +- 0.333 + +2009-03-01 18:00:00.4444 +- 0.4444 + +2009-03-01 18:00:00.55555 +- 0.55555 + +2009-03-01 18:00:00.666666 +- 0.666666 + +2009-03-01 18:00:00.7777777 +- 0.777777 +- Trailing data |
