@@ -195,8 +195,9 @@ public function search(string $path, string $ext = 'php', bool $prioritizeApp =
195
195
196
196
foreach ($ this ->getNamespaces () as $ namespace ) {
197
197
if (isset ($ namespace ['path ' ]) && is_file ($ namespace ['path ' ] . $ path )) {
198
- $ fullPath = $ namespace ['path ' ] . $ path ;
199
- $ fullPath = realpath ($ fullPath ) !== false ? realpath ($ fullPath ) : $ fullPath ;
198
+ $ fullPath = $ namespace ['path ' ] . $ path ;
199
+ $ resolvedPath = realpath ($ fullPath );
200
+ $ fullPath = $ resolvedPath !== false ? $ resolvedPath : $ fullPath ;
200
201
201
202
if ($ prioritizeApp ) {
202
203
$ foundPaths [] = $ fullPath ;
@@ -273,14 +274,16 @@ protected function getNamespaces()
273
274
*/
274
275
public function findQualifiedNameFromPath (string $ path )
275
276
{
276
- $ path = realpath ($ path ) !== false ? realpath ($ path ) : $ path ;
277
+ $ resolvedPath = realpath ($ path );
278
+ $ path = $ resolvedPath !== false ? $ resolvedPath : $ path ;
277
279
278
280
if (! is_file ($ path )) {
279
281
return false ;
280
282
}
281
283
282
284
foreach ($ this ->getNamespaces () as $ namespace ) {
283
- $ namespace ['path ' ] = realpath ($ namespace ['path ' ]) !== false ? realpath ($ namespace ['path ' ]) : $ namespace ['path ' ];
285
+ $ resolvedNamespacePath = realpath ($ namespace ['path ' ]);
286
+ $ namespace ['path ' ] = $ resolvedNamespacePath !== false ? $ resolvedNamespacePath : $ namespace ['path ' ];
284
287
285
288
if ($ namespace ['path ' ] === '' ) {
286
289
continue ;
@@ -332,8 +335,9 @@ public function listFiles(string $path): array
332
335
helper ('filesystem ' );
333
336
334
337
foreach ($ this ->getNamespaces () as $ namespace ) {
335
- $ fullPath = $ namespace ['path ' ] . $ path ;
336
- $ fullPath = realpath ($ fullPath ) !== false ? realpath ($ fullPath ) : $ fullPath ;
338
+ $ fullPath = $ namespace ['path ' ] . $ path ;
339
+ $ resolvedPath = realpath ($ fullPath );
340
+ $ fullPath = $ resolvedPath !== false ? $ resolvedPath : $ fullPath ;
337
341
338
342
if (! is_dir ($ fullPath )) {
339
343
continue ;
@@ -366,8 +370,9 @@ public function listNamespaceFiles(string $prefix, string $path): array
366
370
367
371
// autoloader->getNamespace($prefix) returns an array of paths for that namespace
368
372
foreach ($ this ->autoloader ->getNamespace ($ prefix ) as $ namespacePath ) {
369
- $ fullPath = rtrim ($ namespacePath , '/ ' ) . '/ ' . $ path ;
370
- $ fullPath = realpath ($ fullPath ) !== false ? realpath ($ fullPath ) : $ fullPath ;
373
+ $ fullPath = rtrim ($ namespacePath , '/ ' ) . '/ ' . $ path ;
374
+ $ resolvedPath = realpath ($ fullPath );
375
+ $ fullPath = $ resolvedPath !== false ? $ resolvedPath : $ fullPath ;
371
376
372
377
if (! is_dir ($ fullPath )) {
373
378
continue ;
@@ -393,8 +398,9 @@ public function listNamespaceFiles(string $prefix, string $path): array
393
398
*/
394
399
protected function legacyLocate (string $ file , ?string $ folder = null )
395
400
{
396
- $ path = APPPATH . ($ folder === null ? $ file : $ folder . '/ ' . $ file );
397
- $ path = realpath ($ path ) !== false ? realpath ($ path ) : $ path ;
401
+ $ path = APPPATH . ($ folder === null ? $ file : $ folder . '/ ' . $ file );
402
+ $ resolvedPath = realpath ($ path );
403
+ $ path = $ resolvedPath !== false ? $ resolvedPath : $ path ;
398
404
399
405
if (is_file ($ path )) {
400
406
return $ path ;
0 commit comments