Commit:    a475b2c1db3512eabfece71430cb49065f558e40
Author:    Boro Sitnikovski <bsitnikov...@sugarcrm.com>         Fri, 13 Sep 
2013 02:20:19 +0200
Committer: David Soria Parra <d...@php.net>      Mon, 16 Sep 2013 03:42:49 +0200
Parents:   160cd8d0a7205cacab9800318abb63a540587c4f
Branches:  PHP-5.4 PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=a475b2c1db3512eabfece71430cb49065f558e40

Log:
Bug 64157
Changed error message to make sense

Bugs:
https://bugs.php.net/64157

Changed paths:
  M  ext/date/lib/parse_date.c
  M  ext/date/lib/parse_date.re
  A  ext/date/tests/bug64157.phpt


Diff:
diff --git a/ext/date/lib/parse_date.c b/ext/date/lib/parse_date.c
index 2ad4d31..f510a66 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 f874682..df33508 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 0000000..fb71495
--- /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 <buritom...@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


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to