File tree 1 file changed +24
-7
lines changed
src/Symfony/Component/Finder/Iterator
1 file changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,29 @@ public function current()
79
79
}
80
80
81
81
/**
82
- * @return \RecursiveIterator
82
+ * @return bool
83
+ */
84
+ #[\ReturnTypeWillChange]
85
+ public function hasChildren (bool $ allowLinks = false )
86
+ {
87
+ $ hasChildren = parent ::hasChildren ($ allowLinks );
88
+
89
+ if (!$ hasChildren || !$ this ->ignoreUnreadableDirs ) {
90
+ return $ hasChildren ;
91
+ }
92
+
93
+ try {
94
+ parent ::getChildren ();
95
+
96
+ return true ;
97
+ } catch (\UnexpectedValueException $ e ) {
98
+ // If directory is unreadable and finder is set to ignore it, skip children
99
+ return false ;
100
+ }
101
+ }
102
+
103
+ /**
104
+ * @return \RecursiveDirectoryIterator
83
105
*
84
106
* @throws AccessDeniedException
85
107
*/
@@ -100,12 +122,7 @@ public function getChildren()
100
122
101
123
return $ children ;
102
124
} catch (\UnexpectedValueException $ e ) {
103
- if ($ this ->ignoreUnreadableDirs ) {
104
- // If directory is unreadable and finder is set to ignore it, a fake empty content is returned.
105
- return new \RecursiveArrayIterator ([]);
106
- } else {
107
- throw new AccessDeniedException ($ e ->getMessage (), $ e ->getCode (), $ e );
108
- }
125
+ throw new AccessDeniedException ($ e ->getMessage (), $ e ->getCode (), $ e );
109
126
}
110
127
}
111
128
You can’t perform that action at this time.
0 commit comments