@@ -449,8 +449,11 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
449
449
zend_string * type_name ;
450
450
451
451
ZEND_HASH_MAP_FOREACH_STR_KEY_VAL (SOAP_GLOBAL (class_map ), type_name , tmp ) {
452
- if (ZSTR_LEN (ce -> name ) == Z_STRLEN_P (tmp ) &&
453
- zend_binary_strncasecmp (ZSTR_VAL (ce -> name ), ZSTR_LEN (ce -> name ), Z_STRVAL_P (tmp ), ZSTR_LEN (ce -> name ), ZSTR_LEN (ce -> name )) == 0 ) {
452
+ ZVAL_DEREF (tmp );
453
+ if (Z_TYPE_P (tmp ) == IS_STRING &&
454
+ ZSTR_LEN (ce -> name ) == Z_STRLEN_P (tmp ) &&
455
+ zend_binary_strncasecmp (ZSTR_VAL (ce -> name ), ZSTR_LEN (ce -> name ), Z_STRVAL_P (tmp ), ZSTR_LEN (ce -> name ), ZSTR_LEN (ce -> name )) == 0 &&
456
+ type_name ) {
454
457
455
458
/* TODO: namespace isn't stored */
456
459
encodePtr enc = NULL ;
@@ -1379,6 +1382,7 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
1379
1382
zend_class_entry * tmp ;
1380
1383
1381
1384
if ((classname = zend_hash_str_find_deref (SOAP_GLOBAL (class_map ), type -> type_str , strlen (type -> type_str ))) != NULL &&
1385
+ Z_TYPE_P (classname ) == IS_STRING &&
1382
1386
(tmp = zend_fetch_class (Z_STR_P (classname ), ZEND_FETCH_CLASS_AUTO )) != NULL ) {
1383
1387
ce = tmp ;
1384
1388
}
@@ -3637,48 +3641,3 @@ void delete_encoder_persistent(zval *zv)
3637
3641
assert (t -> details .map == NULL );
3638
3642
free (t );
3639
3643
}
3640
-
3641
- /* Normalize leading backslash similarly to how the engine strips it away. */
3642
- static inline zend_string * drop_leading_backslash (zend_string * str ) {
3643
- if (ZSTR_VAL (str )[0 ] == '\\' ) {
3644
- return zend_string_init (ZSTR_VAL (str ) + 1 , ZSTR_LEN (str ) - 1 , false);
3645
- } else {
3646
- return zend_string_copy (str );
3647
- }
3648
- }
3649
-
3650
- static HashTable * create_normalized_classmap_copy (HashTable * class_map )
3651
- {
3652
- HashTable * normalized = zend_new_array (zend_hash_num_elements (class_map ));
3653
-
3654
- zend_string * key ;
3655
- zval * value ;
3656
- ZEND_HASH_FOREACH_STR_KEY_VAL (class_map , key , value ) {
3657
- ZVAL_DEREF (value );
3658
-
3659
- if (key != NULL && Z_TYPE_P (value ) == IS_STRING ) {
3660
- zval zv ;
3661
- ZVAL_STR (& zv , drop_leading_backslash (Z_STR_P (value )));
3662
- zend_hash_add_new (normalized , key , & zv );
3663
- }
3664
- } ZEND_HASH_FOREACH_END ();
3665
-
3666
- return normalized ;
3667
- }
3668
-
3669
- void create_normalized_classmap (zval * return_value , zval * class_map )
3670
- {
3671
- /* Check if we need to make a copy. */
3672
- zend_string * key ;
3673
- zval * value ;
3674
- ZEND_HASH_FOREACH_STR_KEY_VAL (Z_ARR_P (class_map ), key , value ) {
3675
- if (key == NULL || Z_TYPE_P (value ) != IS_STRING || ZSTR_VAL (Z_STR_P (value ))[0 ] == '\\' ) {
3676
- /* TODO: should probably throw in some of these cases to indicate programmer error,
3677
- * e.g. in the case where a non-string (after dereferencing) is provided. */
3678
- RETURN_ARR (create_normalized_classmap_copy (Z_ARR_P (class_map )));
3679
- }
3680
- } ZEND_HASH_FOREACH_END ();
3681
-
3682
- /* We didn't have to make an actual copy, just increment the refcount. */
3683
- RETURN_COPY (class_map );
3684
- }
0 commit comments