Skip to content

Commit a475b2c

Browse files
bor0dsp
authored andcommitted
Bug 64157
Changed error message to make sense
1 parent 160cd8d commit a475b2c

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

ext/date/lib/parse_date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25036,7 +25036,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
2503625036
TIMELIB_CHECK_NUMBER;
2503725037
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
2503825038
if (sec == TIMELIB_UNSET || length != 2) {
25039-
add_pbf_error(s, "A two second minute could not be found", string, begin);
25039+
add_pbf_error(s, "A two digit second could not be found", string, begin);
2504025040
} else {
2504125041
s->time->s = sec;
2504225042
}

ext/date/lib/parse_date.re

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ timelib_time *timelib_parse_from_format(char *format, char *string, int len, tim
20432043
TIMELIB_CHECK_NUMBER;
20442044
sec = timelib_get_nr_ex((char **) &ptr, 2, &length);
20452045
if (sec == TIMELIB_UNSET || length != 2) {
2046-
add_pbf_error(s, "A two second minute could not be found", string, begin);
2046+
add_pbf_error(s, "A two digit second could not be found", string, begin);
20472047
} else {
20482048
s->time->s = sec;
20492049
}

ext/date/tests/bug64157.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Test for bug #64157: DateTime::createFromFormat() reports confusing error message
3+
--CREDITS--
4+
Boro Sitnikovski <buritomath@yahoo.com>
5+
--INI--
6+
date.timezone = UTC
7+
--FILE--
8+
<?php
9+
DateTime::createFromFormat('s', '0');
10+
$lastErrors = DateTime::getLastErrors();
11+
print_r($lastErrors['errors'][0]);
12+
?>
13+
--EXPECT--
14+
A two digit second could not be found

0 commit comments

Comments
 (0)