Annotation of embedaddon/php/ext/date/tests/bug50392.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #50392 (date_create_from_format enforces 6 digits for 'u' format character)
3: --FILE--
4: <?php
5: date_default_timezone_set('Europe/Bratislava');
6:
7: $base = '2009-03-01 18:00:00';
8:
9: for ($i = 0; $i < 8; $i++) {
10: $string = $base . '.' . str_repeat($i, $i);
11: echo $string, "\n- ";
12: $result = date_parse_from_format('Y-m-d H:i:s.u', $string);
13: echo $result['fraction'] ? $result['fraction'] : 'X', "\n";
14: foreach( $result['errors'] as $error ) {
15: echo "- ", $error, "\n";
16: }
17: echo "\n";
18: }
19: ?>
20: --EXPECT--
21: 2009-03-01 18:00:00.
22: - X
23: - Data missing
24:
25: 2009-03-01 18:00:00.1
26: - 0.1
27:
28: 2009-03-01 18:00:00.22
29: - 0.22
30:
31: 2009-03-01 18:00:00.333
32: - 0.333
33:
34: 2009-03-01 18:00:00.4444
35: - 0.4444
36:
37: 2009-03-01 18:00:00.55555
38: - 0.55555
39:
40: 2009-03-01 18:00:00.666666
41: - 0.666666
42:
43: 2009-03-01 18:00:00.7777777
44: - 0.777777
45: - Trailing data
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>