Bug #54102 [Opn->Nab]: Conflicts of regular expressions in parse_date.re
Edit report at https://bugs.php.net/bug.php?id=54102&edit=1
ID: 54102
Updated by: derick@php.net
Reported by: tomas dot brastavicius at quantum dot lt
Summary: Conflicts of regular expressions in parse_date.re
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Ubuntu
PHP Version: 5.3.6RC1
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
The parser tries its utter best to try to untangle what you feed it. In some cases, it has to make
these choices which seem odd. In order to avoid this, use DateTimeImmutable::createFromFormat, which
gives you full control over how something is parsed.
Previous Comments:
------------------------------------------------------------------------
[2011-02-25 18:15:22] tomas dot brastavicius at quantum dot lt
Description:
------------
Regular expression year4 conflicts with gnunocolon, and pointeddate2 with both timelong12 and
timelong24.
Test script:
---------------
<?php
echo date("Y-m-d H:i:s", strtotime("2460")) . "\n"; // year4 was used
echo date("Y-m-d H:i:s", strtotime("2011")) . "\n"; // gnunocolon was
used
echo date("Y-m-d H:i:s", strtotime("20.02.99")) . "\n"; //
pointeddate2 was used
echo date("Y-m-d H:i:s", strtotime("20.02.11")) . "\n"; // timelong24
was used
Expected result:
----------------
Used single regular expression independently on date/time range
Actual result:
--------------
2460-02-25 15:17:46
2011-02-25 20:11:00
1999-02-20 00:00:00
2011-02-25 20:02:11
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54102&edit=1
Thread (2 messages)