File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 21
21
*/
22
22
class RefResolver
23
23
{
24
+ /**
25
+ * HACK to prevent too many recursive expansions.
26
+ * Happens e.g. when you want to validate a schema against the schema
27
+ * definition.
28
+ *
29
+ * @var integer
30
+ */
31
+ protected static $ depth = 0 ;
32
+
24
33
/**
25
34
* @var UriRetrieverInterface
26
35
*/
@@ -81,7 +90,13 @@ public function getUriRetriever()
81
90
*/
82
91
public function resolve ($ schema , $ sourceUri = null )
83
92
{
93
+ if (self ::$ depth > 7 ) {
94
+ return ;
95
+ }
96
+ ++self ::$ depth ;
97
+
84
98
if (! is_object ($ schema )) {
99
+ --self ::$ depth ;
85
100
return ;
86
101
}
87
102
@@ -109,6 +124,8 @@ public function resolve($schema, $sourceUri = null)
109
124
foreach (array ('dependencies ' , 'patternProperties ' , 'properties ' ) as $ propertyName ) {
110
125
$ this ->resolveObjectOfSchemas ($ schema , $ propertyName , $ sourceUri );
111
126
}
127
+
128
+ --self ::$ depth ;
112
129
}
113
130
114
131
/**
You can’t perform that action at this time.
0 commit comments