Edit report at https://bugs.php.net/bug.php?id=64157&edit=1

 ID:                 64157
 Updated by:         d...@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

Reply via email to