mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
Bug 64157
Changed error message to make sense
This commit is contained in:
committed by
David Soria Parra
parent
160cd8d0a7
commit
a475b2c1db
@@ -25036,7 +25036,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
|
||||
@@ -2043,7 +2043,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
|
||||
TIMELIB_CHECK_NUMBER;
|
||||
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
|
||||
if (sec == TIMELIB_UNSET || length != 2) {
|
||||
add_pbf_error(s, "A two second minute could not be found", string, begin);
|
||||
add_pbf_error(s, "A two digit second could not be found", string, begin);
|
||||
} else {
|
||||
s->time->s = sec;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Test for bug #64157: DateTime::createFromFormat() reports confusing error message
|
||||
--CREDITS--
|
||||
Boro Sitnikovski <buritomath@yahoo.com>
|
||||
--INI--
|
||||
date.timezone = UTC
|
||||
--FILE--
|
||||
<?php
|
||||
DateTime::createFromFormat('s', '0');
|
||||
$lastErrors = DateTime::getLastErrors();
|
||||
print_r($lastErrors['errors'][0]);
|
||||
?>
|
||||
--EXPECT--
|
||||
A two digit second could not be found
|
||||
Reference in New Issue
Block a user