Bug #64157 [Opn->Csd]: DateTime::createFromFormat() reports confusing error message
| From: | dsp@php.net | Date: | Mon, 16 Sep 2013 21:36:20 +0000 |
| Subject: | Bug #64157 [Opn->Csd]: DateTime::createFromFormat() reports confusing error message | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-181614@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64157&edit=1
ID: 64157
Updated by: dsp@php.net
Reported by: thefox at neonus dot sk
Summary: DateTime::createFromFormat() reports confusing error
message
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.3.21
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dsp
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c0afe829e33c5f5690c6967a102148984836d5aa
Log: News for bugfix #64157
Previous Comments:
------------------------------------------------------------------------
[2013-02-05 14:09:44] thefox at neonus dot sk
Description:
------------
Parsing invalid, single-digit input, for seconds using the 's' format reports confusing
and incorrect error message: "A two second minute could not be found" caused probably by
copying the error message for minutes ("A two digit minute could not be found") but
replacing wrong word with "second".
Actually experienced in 5.3.10 but the error message is present also in the source code for 5.3.21
(I can't get my hands on this version).
Test script:
---------------
<?php
DateTime::createFromFormat('s', '0');
$lastErrors = DateTime::getLastErrors();
print_r($lastErrors['errors']);
Expected result:
----------------
Array
(
[0] => A two digit second could not be found
)
Actual result:
--------------
Array
(
[0] => A two second minute could not be found
)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=64157&edit=1