From:
Operating system: Win 7
PHP version: 5.3.3
Package: Date/time related
Bug Type: Bug
Bug description:date_parse parse 24:xx:xx as valid time
Description:
------------
In the 24-hour time notation, the day begins at midnight, 00:00, and the
last minute of the day begins at 23:59.
Date_parse function returns no warning and no error when any time starting
with hour "24" is used as parameter. But some error is expected, because
2010-1-1 24:59:59 is NOT valid date.
This can cause serious errors in scripts that use date_parse for validating
dateTime strings.
Test script:
---------------
<?php
date_parse('2010-1-1 24:00:00');
//This is invalid date, but date_parse returns no error and warning
//Expected: error "Unexpected character"
//date_parse('2010-1-1 24:59:59');
//This is also invalid date, but date_parse returns no error and warning
//Expected: error "Unexpected character"
?>
Expected result:
----------------
Array (
[year] => 2010
[month] => 1
[day] => 1
[hour] => 0
[minute] => 0
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array ( )
[error_count] => 1
[errors] => Array ([9]=>'Unexpected character')
[is_localtime] =>false
)
Actual result:
--------------
Array (
[year] => 2010
[month] => 1
[day] => 1
[hour] => 24 <===== wrong
[minute] => 0
[second] => 0
[fraction] => 0
[warning_count] => 0
[warnings] => Array ( )
[error_count] => 0 <===== wrong
[errors] => Array ( ) <===== wrong
[is_localtime] =>false
)
--
Edit bug report at http://bugs.php.net/bug.php?id=52430&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52430&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52430&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52430&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52430&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52430&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52430&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52430&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52430&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52430&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52430&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52430&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52430&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52430&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52430&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52430&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52430&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52430&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52430&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52430&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52430&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52430&r=mysqlcfg