@@ -2720,15 +2720,11 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
2720
2720
php_timezone_obj * tzobj ;
2721
2721
2722
2722
z_date = zend_hash_str_find (myht , "date" , sizeof ("data" )- 1 );
2723
- if (z_date ) {
2724
- convert_to_string (z_date );
2723
+ if (z_date && Z_TYPE_P (z_date ) == IS_STRING ) {
2725
2724
z_timezone_type = zend_hash_str_find (myht , "timezone_type" , sizeof ("timezone_type" )- 1 );
2726
- if (z_timezone_type ) {
2727
- convert_to_long (z_timezone_type );
2725
+ if (z_timezone_type && Z_TYPE_P (z_timezone_type ) == IS_LONG ) {
2728
2726
z_timezone = zend_hash_str_find (myht , "timezone" , sizeof ("timezone" )- 1 );
2729
- if (z_timezone ) {
2730
- convert_to_string (z_timezone );
2731
-
2727
+ if (z_timezone && Z_TYPE_P (z_timezone ) == IS_STRING ) {
2732
2728
switch (Z_LVAL_P (z_timezone_type )) {
2733
2729
case TIMELIB_ZONETYPE_OFFSET :
2734
2730
case TIMELIB_ZONETYPE_ABBR : {
@@ -2742,7 +2738,6 @@ static int php_date_initialize_from_hash(php_date_obj **dateobj, HashTable *myht
2742
2738
2743
2739
case TIMELIB_ZONETYPE_ID : {
2744
2740
int ret ;
2745
- convert_to_string (z_timezone );
2746
2741
2747
2742
tzi = php_date_parse_tzfile (Z_STRVAL_P (z_timezone ), DATE_TIMEZONEDB );
2748
2743
@@ -3657,7 +3652,9 @@ static int php_date_timezone_initialize_from_hash(zval **return_value, php_timez
3657
3652
3658
3653
if ((z_timezone_type = zend_hash_str_find (myht , "timezone_type" , sizeof ("timezone_type" )- 1 )) != NULL ) {
3659
3654
if ((z_timezone = zend_hash_str_find (myht , "timezone" , sizeof ("timezone" )- 1 )) != NULL ) {
3660
- convert_to_long (z_timezone_type );
3655
+ if (Z_TYPE_P (z_timezone_type ) != IS_LONG ) {
3656
+ return FAILURE ;
3657
+ }
3661
3658
if (SUCCESS == timezone_initialize (* tzobj , Z_STRVAL_P (z_timezone ))) {
3662
3659
return SUCCESS ;
3663
3660
}
@@ -3682,7 +3679,9 @@ PHP_METHOD(DateTimeZone, __set_state)
3682
3679
3683
3680
php_date_instantiate (date_ce_timezone , return_value );
3684
3681
tzobj = Z_PHPTIMEZONE_P (return_value );
3685
- php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht );
3682
+ if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht ) != SUCCESS ) {
3683
+ php_error_docref (NULL , E_ERROR , "Timezone initialization failed" );
3684
+ }
3686
3685
}
3687
3686
/* }}} */
3688
3687
@@ -3698,7 +3697,9 @@ PHP_METHOD(DateTimeZone, __wakeup)
3698
3697
3699
3698
myht = Z_OBJPROP_P (object );
3700
3699
3701
- php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht );
3700
+ if (php_date_timezone_initialize_from_hash (& return_value , & tzobj , myht ) != SUCCESS ) {
3701
+ php_error_docref (NULL , E_ERROR , "Timezone initialization failed" );
3702
+ }
3702
3703
}
3703
3704
/* }}} */
3704
3705
0 commit comments