]> granicus.if.org Git - php/commitdiff
- Apperently you can't store NULL pointer values into Zend hashes - god know
authorDerick Rethans <derick@php.net>
Wed, 12 Oct 2005 19:49:35 +0000 (19:49 +0000)
committerDerick Rethans <derick@php.net>
Wed, 12 Oct 2005 19:49:35 +0000 (19:49 +0000)
  why not - so we won't store those in the cache anymore.

ext/date/php_date.c

index 32f255888917f20a53a3043e689f95d57443c9d5..26b3e44da8d07b06a2e5ee90a19744a74dd16b3d 100644 (file)
@@ -192,9 +192,7 @@ static void _php_date_tzinfo_dtor(void *tzinfo)
 {
        timelib_tzinfo **tzi = (timelib_tzinfo **)tzinfo;
 
-       if (*tzi) {
-               timelib_tzinfo_dtor(*tzi);
-       }
+       timelib_tzinfo_dtor(*tzi);
 }
 
 /* {{{ PHP_RINIT_FUNCTION */
@@ -291,7 +289,9 @@ static timelib_tzinfo *php_date_parse_tzfile(char *formal_tzname, timelib_tzdb *
        }
 
        tzi = timelib_parse_tzfile(formal_tzname, tzdb);
-       zend_hash_add(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL);
+       if (tzi) {
+               zend_hash_add(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL);
+       }
        return tzi;
 }
 /* }}} */