summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorDerick Rethans <github@derickrethans.nl>2012-08-24 10:56:03 +0200
committerDerick Rethans <github@derickrethans.nl>2012-08-24 10:56:03 +0200
commitbc602495d7e15f3684aaff22b96e9dfb1122b424 (patch)
treea994c9f36fdb744dbd55058b41c827f7b1aaa04a /ext/date/php_date.c
parentde59314a60e6503550546f38fc6ebb141d2fbfdb (diff)
parent21f085720cbb8967d6f7826a18e2ce71b6f0e216 (diff)
downloadphp-git-bc602495d7e15f3684aaff22b96e9dfb1122b424.tar.gz
Merge branch 'PHP-5.4' of git.php.net:/php-src into PHP-5.4
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 13e7b753d3..7c4e7820bb 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2467,6 +2467,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
convert_to_long(*z_timezone_type);
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
+ zend_error_handling error_handling;
+
+ zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);
convert_to_string(*z_timezone);
switch (Z_LVAL_PP(z_timezone_type)) {
@@ -2474,9 +2477,9 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
case TIMELIB_ZONETYPE_ABBR: {
char *tmp = emalloc(Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 2);
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));
- php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 0 TSRMLS_CC);
+ php_date_initialize(*dateobj, tmp, Z_STRLEN_PP(z_date) + Z_STRLEN_PP(z_timezone) + 1, NULL, NULL, 1 TSRMLS_CC);
efree(tmp);
- return 1;
+ break;
}
case TIMELIB_ZONETYPE_ID:
@@ -2490,10 +2493,15 @@ static int php_date_initialize_from_hash(zval **return_value, php_date_obj **dat
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
- php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
+ php_date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 1 TSRMLS_CC);
zval_ptr_dtor(&tmp_obj);
- return 1;
+ break;
+ default:
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
+ return 0;
}
+ zend_restore_error_handling(&error_handling TSRMLS_CC);
+ return 1;
}
}
}