summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoro Sitnikovski <bsitnikovski@sugarcrm.com>2013-09-13 02:20:19 +0200
committerDavid Soria Parra <dsp@php.net>2013-09-16 03:42:49 +0200
commita475b2c1db3512eabfece71430cb49065f558e40 (patch)
tree2483377a1ed3942c5ce6b0e7d67a5aa2c3806c8a
parent160cd8d0a7205cacab9800318abb63a540587c4f (diff)
downloadphp-git-a475b2c1db3512eabfece71430cb49065f558e40.tar.gz
Bug 64157
Changed error message to make sense
-rw-r--r--ext/date/lib/parse_date.c2
-rw-r--r--ext/date/lib/parse_date.re2
-rw-r--r--ext/date/tests/bug64157.phpt14
3 files changed, 16 insertions, 2 deletions
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 2ad4d31edb..f510a665e8 100644
--- a/ext/date/lib/parse_date.c
+++ b/ext/date/lib/parse_date.c
@@ -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;
}
diff --git a/ext/date/lib/parse_date.re b/ext/date/lib/parse_date.re
index f874682ce6..df33508f50 100644
--- a/ext/date/lib/parse_date.re
+++ b/ext/date/lib/parse_date.re
@@ -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;
}
diff --git a/ext/date/tests/bug64157.phpt b/ext/date/tests/bug64157.phpt
new file mode 100644
index 0000000000..fb71495430
--- /dev/null
+++ b/ext/date/tests/bug64157.phpt
@@ -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