Bug #76838 [Opn]: date_parse_from_format() changed meaning of zone value in PHP 7.2 -> BC break

From: Date: Sun, 09 Sep 2018 14:53:37 +0000
Subject: Bug #76838 [Opn]: date_parse_from_format() changed meaning of zone value in PHP 7.2 -> BC break
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216944@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76838&edit=1 ID: 76838 Updated by: cmb@php.net Reported by: me at vasekpurchart dot cz Summary: date_parse_from_format() changed meaning of zone value in PHP 7.2 -> BC break Status: Open Type: Bug Package: Date/time related PHP Version: 7.2.9 Block user comment: N Private report: N New Comment: The behavioral change has been introduced by commit a063d55[1] (which later has been reverted for branches lower than PHP-7.2). I assume that the change is intentional, and I'm not sure whether it constitutes a BC break, since the DateTime properties might be regarded as private (what would have to be documented). [1] <http://git.php.net/?p=php-src.git;a=commit;h=a063d55395c818c401b7efdf6b42b4728ce3df08> Previous Comments: ------------------------------------------------------------------------ [2018-09-04 18:53:35] me at vasekpurchart dot cz Sorry, posted slightly different version of test script originally (when I tried to debug if there are more differences in the parsed result). Updated: Test script: --------------- <?php // runnable version with results https://3v4l.org/4gtdS $format = 'Y-m-d\TH:i:sO'; $timeString = '2018-09-04T16:15:55+0200'; $parsedTime = date_parse_from_format($format, $timeString); var_dump($parsedTime['zone']); ------------------------------------------------------------------------ [2018-09-04 15:31:15] me at vasekpurchart dot cz Description: ------------ In PHP 7.2 the result returned from date_parse_from_format() for zone parameter differs in moving from returning value in minutes to seconds and also the positive/negative sign differs. This is a BC break and should have been at least documented, but I have not found any mention of this in any of the http://php.net/manual/en/migration72.php links. Test script: --------------- <?php // runnable version with results https://3v4l.org/4vajJ $format = 'Y-m-d\TH:i:sO'; $timeString = '2018-09-04T16:15:55+0200'; $parsedTime = date_parse_from_format($format, $timeString); var_dump($parsedTime); Expected result: ---------------- int(-120) Actual result: -------------- int(7200) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76838&edit=1

« previous php.bugs (#216944) next »