Commit 5e78df3
committed
Fix infinite recursion in TypeTraverser with cycle detection
Add cycle detection to prevent infinite recursion when processing circular type dependencies, particularly with constructs like `is_callable(is_array(...))` that can cause TypeTraverser to loop indefinitely between mapInternal() and traverseInternal().
The fix tracks visited types using spl_object_hash() and returns the type as-is when a cycle is detected, preventing memory exhaustion and timeouts during static analysis.
Fixes: Memory exhaustion with nested callable types1 parent 76363f4 commit 5e78df3
1 file changed
+16
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
| |||
0 commit comments