Skip to content

Commit e766f85

Browse files
committed
Revert "Fixed bug #62852 (Unserialize invalid DateTime causes crash)"
see: http://news.php.net/php.bugs/173451 This reverts commit 46a3f25.
1 parent 3098183 commit e766f85

File tree

2 files changed

+4
-27
lines changed

2 files changed

+4
-27
lines changed

ext/date/php_date.c

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2544,19 +2544,16 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
25442544
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
25452545
convert_to_long(*z_timezone_type);
25462546
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
2547-
zend_error_handling error_handling;
2548-
2549-
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
25502547
convert_to_string(*z_timezone);
25512548

25522549
switch (Z_LVAL_PP(z_timezone_type)) {
25532550
case TIMELIB_ZONETYPE_OFFSET:
25542551
case TIMELIB_ZONETYPE_ABBR: {
25552552
char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
25562553
snprintf(tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2, "%s %s", Z_STRVAL_PP(z_date), Z_STRVAL_PP(z_timezone));
2557-
php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC);
2554+
php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
25582555
efree(tmp);
2559-
break;
2556+
return 1;
25602557
}
25612558

25622559
case TIMELIB_ZONETYPE_ID:
@@ -2570,15 +2567,10 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
25702567
tzobj->tzi.tz = tzi;
25712568
tzobj->initialized = 1;
25722569

2573-
php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
2570+
php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
25742571
zval_ptr_dtor(&tmp_obj);
2575-
break;
2576-
default:
2577-
zend_restore_error_handling(&error_handling TSRMLS_CC);
2578-
return 0;
2572+
return 1;
25792573
}
2580-
zend_restore_error_handling(&error_handling TSRMLS_CC);
2581-
return 1;
25822574
}
25832575
}
25842576
}

ext/date/tests/bug62852.phpt

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)