php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75378 [REGRESSION] IntlDateFormatter::parse() does not change $position argument
Submitted: 2017-10-15 07:28 UTC Modified: 2017-10-15 10:56 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: d dot naumenko dot a at gmail dot com Assigned: dmitry (profile)
Status: Closed Package: intl (PECL)
PHP Version: 7.2.0RC4 OS: Ubuntu 16.04.3
Private report: No CVE-ID: None
 [2017-10-15 07:28 UTC] d dot naumenko dot a at gmail dot com
Description:
------------
IntlDateFormatter::parse() does not change $position argument

https://3v4l.org/i1mPA

Regression was probably introduced by this commit: https://github.com/php/php-src/commit/40ecad34022b6e687cc654d47c88f8cef5d418f

Test script:
---------------
<?php

$formatter = new IntlDateFormatter("en-GB", IntlDateFormatter::NONE, IntlDateFormatter::NONE, 'UTC', null, 'yyyy-MM-dd');
$position = 0;
$parsedDate = $formatter->parse("2017-10-12", $position);
var_dump($parsedDate, $position);

Expected result:
----------------
The 2nd argument $position which is passed by reference will contain the position at which parsing ended. It works as expected before 7.2.0alpha2

Actual result:
--------------
Always 0. See 3v4l results

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-15 10:56 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: dmitry
 [2017-10-15 10:56 UTC] cmb@php.net
> Regression was probably introduced by this commit:
> https://github.com/php/php-src/commit/40ecad34022b6e687cc654d47c88f8cef5d418f

Confirmed with git bisect.

Dmitry, could you please have a look at this issue?
 [2017-10-16 11:09 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=863acd775389984e32cf7800258b68a815e12d41
Log: Fixed bug #75378 ([REGRESSION] IntlDateFormatter::parse() does not change $position argument)
 [2017-10-16 11:09 UTC] laruence@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC