File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ public function getUriRetriever()
102102    public  function  resolve ($ schema$ sourceUrinull )
103103    {
104104        if  (self ::$ depthself ::$ maxDepth
105+             self ::$ depth0 ;
105106            throw  new  JsonDecodingException (JSON_ERROR_DEPTH );
106107        }
107108        ++self ::$ depth
Original file line number Diff line number Diff line change 99
1010namespace  JsonSchema \Tests ;
1111
12+ use  JsonSchema \Exception \JsonDecodingException ;
13+ 
1214/** 
1315 * @group RefResolver 
1416 */ 
@@ -355,4 +357,27 @@ public function testMaxDepthExceeded()
355357
356358        $ resolverresolve ($ jsonSchema
357359    }
360+ 
361+     public  function  testDepthRestoration ()
362+     {
363+         // stub schema 
364+         $ jsonSchemanew  \stdClass ;
365+         $ jsonSchemaid  = 'stub ' ;
366+         $ jsonSchemaadditionalItems  = new  \stdClass ();
367+         $ jsonSchemaadditionalItems ->additionalItems  = 'stub ' ;
368+ 
369+         // stub resolver 
370+         \JsonSchema \RefResolver::$ maxDepth1 ;
371+         $ resolvernew  \JsonSchema \RefResolver ();
372+ 
373+         try  {
374+             $ resolverresolve ($ jsonSchema
375+         } catch  (JsonDecodingException $ e
376+ 
377+         }
378+ 
379+         $ reflectionnew  \ReflectionProperty ('\JsonSchema\RefResolver ' , 'depth ' );
380+         $ reflectionsetAccessible (true );
381+         $ this assertEquals (0 , $ reflectiongetValue ());
382+     }
358383}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments