summaryrefslogtreecommitdiff
path: root/ext/date/php_date.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-02-17 21:16:53 +0800
committerXinchen Hui <laruence@php.net>2015-02-17 21:16:53 +0800
commited1967c7062db55eed7713b27812d4af7350dfa7 (patch)
tree154b207777578418315134ce3d32415a475b9f07 /ext/date/php_date.c
parente22759b1e550b29117531fdce07df618234e79a0 (diff)
parent0a331f49c1c39fc84b972c5f609d56ca21565a69 (diff)
downloadphp-git-ed1967c7062db55eed7713b27812d4af7350dfa7.tar.gz
Merge branch 'PHP-5.6' of https://git.php.net/repository/php-src into PHP-5.6
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r--ext/date/php_date.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index f8571b91b5..6a9cd47525 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2807,12 +2807,9 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
timelib_tzinfo *tzi;
php_timezone_obj *tzobj;
- if (zend_hash_find(myht, "date", 5, (void**) &z_date) == SUCCESS) {
- convert_to_string(*z_date);
- 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) {
- convert_to_string(*z_timezone);
+ if (zend_hash_find(myht, "date", 5, (void**) &z_date) == SUCCESS && Z_TYPE_PP(z_date) == IS_STRING) {
+ if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS && Z_TYPE_PP(z_timezone_type) == IS_LONG) {
+ if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS && Z_TYPE_PP(z_timezone) == IS_STRING) {
switch (Z_LVAL_PP(z_timezone_type)) {
case TIMELIB_ZONETYPE_OFFSET:
@@ -2827,7 +2824,6 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
case TIMELIB_ZONETYPE_ID: {
int ret;
- convert_to_string(*z_timezone);
tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
@@ -3744,9 +3740,8 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
zval **z_timezone = NULL;
zval **z_timezone_type = NULL;
- if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS) {
+ if (zend_hash_find(myht, "timezone_type", 14, (void**) &z_timezone_type) == SUCCESS && Z_TYPE_PP(z_timezone_type) == IS_LONG) {
if (zend_hash_find(myht, "timezone", 9, (void**) &z_timezone) == SUCCESS) {
- convert_to_long(*z_timezone_type);
if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_PP(z_timezone) TSRMLS_CC)) {
return SUCCESS;
}
@@ -3771,7 +3766,9 @@ PHP_METHOD(DateTimeZone, __set_state)
php_date_instantiate(date_ce_timezone, return_value TSRMLS_CC);
tzobj = (php_timezone_obj *) zend_object_store_get_object(return_value TSRMLS_CC);
- php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht TSRMLS_CC);
+ if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht TSRMLS_CC) != SUCCESS) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Timezone initialization failed");
+ }
}
/* }}} */
@@ -3787,7 +3784,9 @@ PHP_METHOD(DateTimeZone, __wakeup)
myht = Z_OBJPROP_P(object);
- php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht TSRMLS_CC);
+ if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht TSRMLS_CC) != SUCCESS) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Timezone initialization failed");
+ }
}
/* }}} */