@@ -2779,12 +2779,9 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
2779
2779
timelib_tzinfo * tzi ;
2780
2780
php_timezone_obj * tzobj ;
2781
2781
2782
- if (zend_hash_find (myht , "date" , 5 , (void * * ) & z_date ) == SUCCESS ) {
2783
- convert_to_string (* z_date );
2784
- if (zend_hash_find (myht , "timezone_type" , 14 , (void * * ) & z_timezone_type ) == SUCCESS ) {
2785
- convert_to_long (* z_timezone_type );
2786
- if (zend_hash_find (myht , "timezone" , 9 , (void * * ) & z_timezone ) == SUCCESS ) {
2787
- convert_to_string (* z_timezone );
2782
+ if (zend_hash_find (myht , "date" , 5 , (void * * ) & z_date ) == SUCCESS && Z_TYPE_PP (z_date ) == IS_STRING ) {
2783
+ if (zend_hash_find (myht , "timezone_type" , 14 , (void * * ) & z_timezone_type ) == SUCCESS && Z_TYPE_PP (z_timezone_type ) == IS_LONG ) {
2784
+ if (zend_hash_find (myht , "timezone" , 9 , (void * * ) & z_timezone ) == SUCCESS && Z_TYPE_PP (z_timezone ) == IS_STRING ) {
2788
2785
2789
2786
switch (Z_LVAL_PP (z_timezone_type )) {
2790
2787
case TIMELIB_ZONETYPE_OFFSET :
@@ -2799,7 +2796,6 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
2799
2796
2800
2797
case TIMELIB_ZONETYPE_ID : {
2801
2798
int ret ;
2802
- convert_to_string (* z_timezone );
2803
2799
2804
2800
tzi = php_date_parse_tzfile (Z_STRVAL_PP (z_timezone ), DATE_TIMEZONEDB TSRMLS_CC );
2805
2801
@@ -3716,9 +3712,8 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
3716
3712
zval * * z_timezone = NULL ;
3717
3713
zval * * z_timezone_type = NULL ;
3718
3714
3719
- if (zend_hash_find (myht , "timezone_type" , 14 , (void * * ) & z_timezone_type ) == SUCCESS ) {
3715
+ if (zend_hash_find (myht , "timezone_type" , 14 , (void * * ) & z_timezone_type ) == SUCCESS && Z_TYPE_PP ( z_timezone_type ) == IS_LONG ) {
3720
3716
if (zend_hash_find (myht , "timezone" , 9 , (void * * ) & z_timezone ) == SUCCESS ) {
3721
- convert_to_long (* z_timezone_type );
3722
3717
if (SUCCESS == timezone_initialize (* tzobj , Z_STRVAL_PP (z_timezone ) TSRMLS_CC )) {
3723
3718
return SUCCESS ;
3724
3719
}
@@ -3743,7 +3738,9 @@ PHP_METHOD(DateTimeZone, __set_state)
3743
3738
3744
3739
php_date_instantiate (date_ce_timezone , return_value TSRMLS_CC );
3745
3740
tzobj = (php_timezone_obj * ) zend_object_store_get_object (return_value TSRMLS_CC );
3746
- php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht TSRMLS_CC );
3741
+ if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht TSRMLS_CC ) != SUCCESS ) {
3742
+ php_error_docref (NULL , E_ERROR , "Timezone initialization failed" );
3743
+ }
3747
3744
}
3748
3745
/* }}} */
3749
3746
@@ -3759,7 +3756,9 @@ PHP_METHOD(DateTimeZone, __wakeup)
3759
3756
3760
3757
myht = Z_OBJPROP_P (object );
3761
3758
3762
- php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht TSRMLS_CC );
3759
+ if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht TSRMLS_CC ) != SUCCESS ) {
3760
+ php_error_docref (NULL , E_ERROR , "Timezone initialization failed" );
3761
+ }
3763
3762
}
3764
3763
/* }}} */
3765
3764
0 commit comments