]> granicus.if.org Git - php/commitdiff
MFH: Fixed bug #29342 (strtotime() does not handle empty date string
authorIlia Alshanetsky <iliaa@php.net>
Wed, 28 Jul 2004 01:44:41 +0000 (01:44 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 28 Jul 2004 01:44:41 +0000 (01:44 +0000)
properly).

NEWS
ext/standard/datetime.c

diff --git a/NEWS b/NEWS
index f085050a50a9eb0caf9069a78ca45c819e787682..d8fc2d0c232a226d73f6548743e3daecaa62c0b2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PHP                                                                        NEWS
   strings). (Ilia, Tony)
 - Fixed bug #29368 (The destructor is called when an exception is thrown from 
   the constructor). (Marcus)
+- Fixed bug #29342 (strtotime() does not handle empty date string properly).
+  (Ilia)
 - Fixed bug #29335 (fetch functions now use MYSQLI_BOTH as default) (Georg)
 - Fixed bug #29291 (get_class_vars() return names with NULLs). (Marcus)
 - Fixed bug #29119 (html_entity_decode() misbehaves with UTF-8). (Moriyoshi)
index 4e455a86a09c316bb886206d078f187e06774678..694668198dcc8434459d27e016963ffac2a80566 100644 (file)
@@ -1080,8 +1080,10 @@ PHP_FUNCTION(strtotime)
        }
 
        convert_to_string_ex(z_time);
-       if (Z_STRLEN_PP(z_time) == 0)
-               php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Called with empty time parameter");
+       if (!Z_STRLEN_PP(z_time)) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Called with an empty time parameter.");
+               RETURN_LONG(-1);
+       }
        if (argc == 2) {
                convert_to_long_ex(z_now);
                now = Z_LVAL_PP(z_now);