@@ -449,8 +449,11 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
449449 zend_string * type_name ;
450450
451451 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 ) {
454457
455458 /* TODO: namespace isn't stored */
456459 encodePtr enc = NULL ;
@@ -1379,6 +1382,7 @@ static zval *to_zval_object_ex(zval *ret, encodeTypePtr type, xmlNodePtr data, z
13791382 zend_class_entry * tmp ;
13801383
13811384 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 &&
13821386 (tmp = zend_fetch_class (Z_STR_P (classname ), ZEND_FETCH_CLASS_AUTO )) != NULL ) {
13831387 ce = tmp ;
13841388 }
@@ -3630,48 +3634,3 @@ void delete_encoder_persistent(zval *zv)
36303634 assert (t -> details .map == NULL );
36313635 free (t );
36323636}
3633-
3634- /* Normalize leading backslash similarly to how the engine strips it away. */
3635- static inline zend_string * drop_leading_backslash (zend_string * str ) {
3636- if (ZSTR_VAL (str )[0 ] == '\\' ) {
3637- return zend_string_init (ZSTR_VAL (str ) + 1 , ZSTR_LEN (str ) - 1 , false);
3638- } else {
3639- return zend_string_copy (str );
3640- }
3641- }
3642-
3643- static HashTable * create_normalized_classmap_copy (HashTable * class_map )
3644- {
3645- HashTable * normalized = zend_new_array (zend_hash_num_elements (class_map ));
3646-
3647- zend_string * key ;
3648- zval * value ;
3649- ZEND_HASH_FOREACH_STR_KEY_VAL (class_map , key , value ) {
3650- ZVAL_DEREF (value );
3651-
3652- if (key != NULL && Z_TYPE_P (value ) == IS_STRING ) {
3653- zval zv ;
3654- ZVAL_STR (& zv , drop_leading_backslash (Z_STR_P (value )));
3655- zend_hash_add_new (normalized , key , & zv );
3656- }
3657- } ZEND_HASH_FOREACH_END ();
3658-
3659- return normalized ;
3660- }
3661-
3662- void create_normalized_classmap (zval * return_value , zval * class_map )
3663- {
3664- /* Check if we need to make a copy. */
3665- zend_string * key ;
3666- zval * value ;
3667- ZEND_HASH_FOREACH_STR_KEY_VAL (Z_ARR_P (class_map ), key , value ) {
3668- if (key == NULL || Z_TYPE_P (value ) != IS_STRING || ZSTR_VAL (Z_STR_P (value ))[0 ] == '\\' ) {
3669- /* TODO: should probably throw in some of these cases to indicate programmer error,
3670- * e.g. in the case where a non-string (after dereferencing) is provided. */
3671- RETURN_ARR (create_normalized_classmap_copy (Z_ARR_P (class_map )));
3672- }
3673- } ZEND_HASH_FOREACH_END ();
3674-
3675- /* We didn't have to make an actual copy, just increment the refcount. */
3676- RETURN_COPY (class_map );
3677- }
0 commit comments