php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64157 DateTime::createFromFormat() reports confusing error message
Submitted: 2013-02-05 14:09 UTC Modified: -
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: thefox at neonus dot sk Assigned:
Status: Closed Package: Date/time related
PHP Version: 5.3.21 OS: Linux
Private report: No CVE-ID:
 [2013-02-05 14:09 UTC] 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
)

Patches

Add a Patch

Pull Requests

Pull requests:

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-16 21:36 UTC] dsp@php.net
Automatic comment on behalf of dsp
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c0afe829e33c5f5690c6967a102148984836d5aa
Log: News for bugfix #64157
 [2013-09-16 21:36 UTC] dsp@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 17 12:01:59 2014 UTC