php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51107 date_parse_from_format does not parse after 'O' or 'Z' - format
Submitted: 2010-02-21 19:51 UTC Modified: 2010-04-25 19:57 UTC
From: mail at henkbulder dot nl Assigned: felipe (profile)
Status: Closed Package: Date/time related
PHP Version: 5.3.1 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mail at henkbulder dot nl
New email:
PHP Version: OS:

 

 [2010-02-21 19:51 UTC] mail at henkbulder dot nl
Description:
------------
date_parse_from_format doesn't seem to parse anything after (at the right hand of) a timezone-offset ('O' or 'Z'). 

I shuffled the date-string (and format-strings accordingly) around a few times, and the only way to properly fill the array seems to be putting timezone-offset at the end of the string.

Reproduce code:
---------------
$testdate = "Sat Feb 20 +0000 15:37:44 2010";
$createdarr = date_parse_from_format("D M d O G:i:s Y", $testdate);
print_r($createdarr);


Expected result:
----------------
Array
(
    [year] => 2010
    [month] => 2
    [day] => 20
    [hour] => 15
    [minute] => 37
    [second] => 44
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 0
    [errors] => Array
        (
        )

    [is_localtime] => 1
    [zone_type] => 1
    [zone] => 0
    [is_dst] => 
)


Actual result:
--------------
Array
(
    [year] => 
    [month] => 2
    [day] => 20
    [hour] => 
    [minute] => 
    [second] => 
    [fraction] => 
    [warning_count] => 0
    [warnings] => Array
        (
        )

    [error_count] => 1
    [errors] => Array
        (
            [30] => Data missing
        )

    [is_localtime] => 1
    [zone_type] => 1
    [zone] => 0
    [is_dst] => 
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-02-21 20:57 UTC] jani@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2010-03-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-04-25 19:57 UTC] felipe@php.net
-Status: No Feedback +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-04-25 19:57 UTC] felipe@php.net
I can't reproduce it, it looks already fixed.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 10:01:32 2024 UTC