PHP :: Bug #41709 :: error in date_parse function

Bug #41709 error in date_parse function
Submitted: 2007-06-15 20:46 UTC Modified: 2007-07-12 19:01 UTC
From: xsuchy09 at gmail dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.2.3 OS: Windows XP
Private report: No CVE-ID: None

 [2007-06-15 20:46 UTC] xsuchy09 at gmail dot com

Description:
------------
date_parse function returns wrong value in year index in returned array when  parameter is '00.00.0000 - 00:00:00'

Reproduce code:
---------------
$date_string = '00.00.0000 - 00:00:00';
print_r(date_parse($date_string));

Expected result:
----------------
Array ( [year] => 0000 [month] => 0 [day] => 0 [hour] => 0 [minute] => 0 [second] => 0 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [11] => Unexpected character ) [is_localtime] => )

Actual result:
--------------
Array ( [year] => 2000 [month] => 0 [day] => 0 [hour] => 0 [minute] => 0 [second] => 0 [fraction] => 0 [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [11] => Unexpected character ) [is_localtime] => )

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2007-07-09 19:13 UTC] derick@php.net

This is actually a bug, it should only go to "2000" if a two-digit year (like "00") is used.

 [2007-07-12 19:01 UTC] derick@php.net

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.