Bug #73426 [Opn->Asn]: createFromFormat with 'z' format char results in incorrect time

From: Date: Mon, 31 Oct 2016 10:31:02 +0000
Subject: Bug #73426 [Opn->Asn]: createFromFormat with 'z' format char results in incorrect time
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-205105@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73426&edit=1 ID: 73426 Updated by: derick@php.net Reported by: vaclav dot sir at gmail dot com Summary: createFromFormat with 'z' format char results in incorrect time -Status: Open +Status: Assigned Type: Bug Package: Date/time related PHP Version: 7.1.0RC5 -Assigned To: +Assigned To: derick Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2016-10-31 07:54:46] vaclav dot sir at gmail dot com Description: ------------ When you use the 'z' format character after the time ('H:i:s z'), the time information gets parsed incorrectly. If you use the 'z' char in front of the time ('z H:i:s'), it parses fine. Affected versions are 7.1.0RC4 and 7.1.0RC5: https://3v4l.org/QOS7s Test script: --------------- <?php $date = '12:00:00 15'; $format = 'H:i:s z'; var_dump(DateTime::createFromFormat($format, $date)); Expected result: ---------------- object(DateTime)#1 (3) { ["date"]=> string(26) "2016-01-16 12:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Actual result: -------------- object(DateTime)#1 (3) { ["date"]=> string(31) "2016-01-16 11:59:55.-2147483648" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73426&edit=1

« previous php.bugs (#205105) next »