@@ -2263,20 +2263,23 @@ PHPAPI zval *php_date_instantiate(zend_class_entry *pce, zval *object) /* {{{ */
2263
2263
2264
2264
/* Helper function used to store the latest found warnings and errors while
2265
2265
* parsing, from either strtotime or parse_from_format. */
2266
- static timelib_error_container * update_errors_warnings (timelib_error_container * * last_errors ) /* {{{ */
2266
+ static void update_errors_warnings (timelib_error_container * * last_errors ) /* {{{ */
2267
2267
{
2268
2268
if (DATEG (last_errors )) {
2269
2269
timelib_error_container_dtor (DATEG (last_errors ));
2270
2270
DATEG (last_errors ) = NULL ;
2271
2271
}
2272
2272
2273
+ if (last_errors == NULL || (* last_errors ) == NULL ) {
2274
+ return ;
2275
+ }
2276
+
2273
2277
if ((* last_errors )-> warning_count || (* last_errors )-> error_count ) {
2274
2278
DATEG (last_errors ) = * last_errors ;
2275
- return * last_errors ;
2276
2279
}
2277
2280
2278
2281
timelib_error_container_dtor (* last_errors );
2279
- return NULL ;
2282
+ * last_errors = NULL ;
2280
2283
} /* }}} */
2281
2284
2282
2285
static void php_date_set_time_fraction (timelib_time * time , int microseconds )
@@ -2327,7 +2330,7 @@ PHPAPI bool php_date_initialize(php_date_obj *dateobj, const char *time_str, siz
2327
2330
}
2328
2331
2329
2332
/* update last errors and warnings */
2330
- err = update_errors_warnings (& err );
2333
+ update_errors_warnings (& err );
2331
2334
2332
2335
/* If called from a constructor throw an exception */
2333
2336
if ((flags & PHP_DATE_INIT_CTOR ) && err && err -> error_count ) {
@@ -3005,7 +3008,7 @@ static bool php_date_modify(zval *object, char *modify, size_t modify_len) /* {{
3005
3008
tmp_time = timelib_strtotime (modify , modify_len , & err , DATE_TIMEZONEDB , php_date_parse_tzfile_wrapper );
3006
3009
3007
3010
/* update last errors and warnings */
3008
- err = update_errors_warnings (& err );
3011
+ update_errors_warnings (& err );
3009
3012
3010
3013
if (err && err -> error_count ) {
3011
3014
/* spit out the first library error message, at least */
0 commit comments