Bug #69497 [Com]: new DateTime('midnighty') is accepted
Edit report at https://bugs.php.net/bug.php?id=69497&edit=1
ID: 69497
Comment by: anikanov dot d at live dot ru
Reported by: php at christian-stuedemann dot de
Summary: new DateTime('midnighty') is accepted
Status: Open
Type: Bug
Package: Date/time related
PHP Version: 5.6.8
Block user comment: N
Private report: N
New Comment:
I have the same issue. I am think the problem in "re2c".
Generated file contain unnecessary lines like 23142 - 23144.
https://github.com/php/php-src/blob/master/ext/date/lib/parse_date.c#L23142
Previous Comments:
------------------------------------------------------------------------
[2015-04-21 13:18:24] php at christian-stuedemann dot de
Description:
------------
---
From manual page: http://www.php.net/datetime.construct
---
Even if it's a misspelling of the documented date format, an additional character added to the
end of 'midnight' (e.g. 'midnighty' or 'midnighta') is accepted by the
DateTime constructor. Longer terms (like 'midnightyyyy') are not accepted and throw an
Exception like expected.
Test script:
---------------
try {
new DateTime('midnighty');
return 'this might never be returned, bug found';
}catch(Exception $e){
return 'bug fixed';
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69497&edit=1
Thread (5 messages)