derick          Sun Feb  3 14:22:56 2008 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/date   php_date.c 
  Log:
  - Fixed invalid read errors as found by GCOV.
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.55&r2=1.43.2.45.2.56&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.55 
php-src/ext/date/php_date.c:1.43.2.45.2.56
--- php-src/ext/date/php_date.c:1.43.2.45.2.55  Sat Feb  2 17:26:23 2008
+++ php-src/ext/date/php_date.c Sun Feb  3 14:22:55 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_date.c,v 1.43.2.45.2.55 2008/02/02 17:26:23 derick Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.56 2008/02/03 14:22:55 derick Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -1684,7 +1684,7 @@
        timelib_time   *now;
        timelib_tzinfo *tzi;
        timelib_error_container *err = NULL;
-       int free_tzi = 0, type = TIMELIB_ZONETYPE_ID, new_dst;
+       int free_tzi = 0, type = TIMELIB_ZONETYPE_ID, new_dst, errors_found = 0;
        char *new_abbr;
        timelib_sll     new_offset;
        
@@ -1695,22 +1695,17 @@
                timelib_time_dtor(dateobj->time);
        }
        dateobj->time = timelib_strtotime(time_str_len ? time_str : "now", 
time_str_len ? time_str_len : sizeof("now") -1, &err, DATE_TIMEZONEDB);
-       if (err) {
-               if (ctor && err && err->error_count) {
+
+       if (err && err->error_count) {
+               if (ctor) {
                        /* spit out the first library error message, at least */
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to 
parse time string (%s) at position %d (%c): %s", time_str,
-                                                       
err->error_messages[0].position, err->error_messages[0].character, 
err->error_messages[0].message);
+                               err->error_messages[0].position, 
err->error_messages[0].character, err->error_messages[0].message);
                }
-               timelib_error_container_dtor(err);
-       }
-
-
-       if (ctor && err && err->error_count) {
-               /* spit out the first library error message, at least */
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to parse 
time string (%s) at position %d (%c): %s", time_str,
-                       err->error_messages[0].position, 
err->error_messages[0].character, err->error_messages[0].message);
+               errors_found = 1;
        }
-       if (err && err->error_count) {
+       timelib_error_container_dtor(err);
+       if (errors_found) {
                return 0;
        }
 

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

Reply via email to