@@ -2161,6 +2161,10 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
21612161 if (ctx -> attributeGroups != NULL ) {
21622162 tmp = (sdlTypePtr )schema_find_by_ref (ctx -> attributeGroups , attr -> ref );
21632163 if (tmp ) {
2164+ if (zend_hash_index_find_ptr (& ctx -> fixupInProgress , (zend_ulong )tmp ) != NULL ) {
2165+ soap_error1 (E_ERROR , "Parsing Schema: recursive attributeGroup 'ref' attribute '%s'" , attr -> ref );
2166+ }
2167+ zend_hash_index_add_ptr (& ctx -> fixupInProgress , (zend_ulong )tmp , tmp );
21642168 if (tmp -> attributes ) {
21652169 zend_hash_internal_pointer_reset (tmp -> attributes );
21662170 while ((tmp_attr = zend_hash_get_current_data_ptr (tmp -> attributes )) != NULL ) {
@@ -2196,6 +2200,7 @@ static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashT
21962200 }
21972201 }
21982202 }
2203+ zend_hash_index_del (& ctx -> fixupInProgress , (zend_ulong )tmp );
21992204 }
22002205 }
22012206 efree (attr -> ref );
@@ -2210,6 +2215,9 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
22102215 sdlTypePtr tmp ;
22112216
22122217 if (ctx -> sdl -> groups && (tmp = zend_hash_str_find_ptr (ctx -> sdl -> groups , model -> u .group_ref , strlen (model -> u .group_ref ))) != NULL ) {
2218+ if (zend_hash_index_find_ptr (& ctx -> fixupInProgress , (zend_ulong )tmp ) != NULL ) {
2219+ soap_error1 (E_ERROR , "Parsing Schema: recursive group 'ref' attribute '%s'" , model -> u .group_ref );
2220+ }
22132221 schema_type_fixup (ctx , tmp );
22142222 efree (model -> u .group_ref );
22152223 model -> kind = XSD_CONTENT_GROUP ;
@@ -2253,6 +2261,8 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
22532261 sdlTypePtr tmp ;
22542262 sdlAttributePtr attr ;
22552263
2264+ zend_hash_index_add_ptr (& ctx -> fixupInProgress , (zend_ulong )type , type );
2265+
22562266 if (type -> ref != NULL ) {
22572267 if (ctx -> sdl -> elements != NULL ) {
22582268 tmp = (sdlTypePtr )schema_find_by_ref (ctx -> sdl -> elements , type -> ref );
@@ -2305,6 +2315,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
23052315 }
23062316 }
23072317 }
2318+ zend_hash_index_del (& ctx -> fixupInProgress , (zend_ulong )type );
23082319}
23092320
23102321void schema_pass2 (sdlCtx * ctx )
@@ -2313,6 +2324,8 @@ void schema_pass2(sdlCtx *ctx)
23132324 sdlAttributePtr attr ;
23142325 sdlTypePtr type ;
23152326
2327+ zend_hash_init (& ctx -> fixupInProgress , 0 , NULL , NULL , 0 );
2328+
23162329 if (ctx -> attributes ) {
23172330 ZEND_HASH_FOREACH_PTR (ctx -> attributes , attr ) {
23182331 schema_attribute_fixup (ctx , attr );
@@ -2346,6 +2359,8 @@ void schema_pass2(sdlCtx *ctx)
23462359 zend_hash_destroy (ctx -> attributeGroups );
23472360 efree (ctx -> attributeGroups );
23482361 }
2362+
2363+ zend_hash_destroy (& ctx -> fixupInProgress );
23492364}
23502365
23512366void delete_model (zval * zv )
0 commit comments