Bug #71345 [NEW]: DateTime::__construct failed to parse fraction with more than 9 digits.
From: iceberg_young at 126 dot com
Operating system: Any
PHP version: 7.0.2
Package: Date/time related
Bug Type: Bug
Bug description:DateTime::__construct failed to parse fraction with more than 9 digits.
Description:
------------
DateTime::__construct cannot parse [W3] datetime format with fraction of
second has more than **9** digits.
E.g.
new \DateTime("2016-01-01T01:02:03.123456789-01:02");
will fail, while
new \DateTime("2016-01-01T01:02:03.12345678-01:02");
is ok.
Tried PHP version: 5.5.26 and 7.0.2
Tried OS: CentOS 6.7, openSUSE Tumbleweed, Windows 7
---
[W3]: http://www.w3.org/TR/NOTE-datetime-970915
Test script:
---------------
<?php
$w3 = new \DateTime("2016-01-01T01:02:03.123456789-01:02");
echo $w3->format("Y-m-d\TH:i:s.uP");
Expected result:
----------------
(No exception throw!)
2016-01-01T01:02:03.123457-01:02
Actual result:
--------------
PHP Warning: Uncaught exception 'Exception' with message
'DateTime::__construct(): Failed to parse time string
(2016-01-01T01:02:03.123456789-01:02) at position 0 (2): The timezone
could not be found in the database' in php shell code:1
--
Edit bug report at https://bugs.php.net/bug.php?id=71345&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71345&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71345&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71345&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71345&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71345&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71345&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71345&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71345&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71345&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71345&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71345&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71345&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71345&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71345&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71345&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71345&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71345&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71345&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71345&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71345&r=mysqlcfg
Thread (5 messages)
- iceberg_young at 126 dot com