Skip to content

finder ->in() Method error on Windows Hosts while open_basedir set #46388

Closed
@pprossi

Description

@pprossi

Symfony version(s) affected

...,5.1,6.1

Description

Hi.

I'm not quite sure if this is more of a PHP bug or a Symfonie bug.

The problem is that according to the documentation
https://symfony.com/doc/current/components/finder.html#location
Wildcards can be used for the pad specifications.

$finder->in('src/Symfony/*')

This also applied to the glob function used, but the is_dir function throws an exception here under Windows if the open_basedir option is set in PHP.ini
https://github.com/symfony/finder/blob/9b630f3427f3ebe7cd346c277a1408b00249dad9/Finder.php#L586

to understand e.g:
$php -r 'is_dir("d:\\repos\\*\\website");'

throws:
Warning: is_dir(): open_basedir restriction in effect. File(d:\repos\*\website) is not within the allowed path(s): (D:\repos) in Command line code on line 1
so the process will never come to the following glob function.

Testet version of php 7.4.25 Windows

How to reproduce

On Windows.
in php.ini set open_basedir to some path.
call the command
$php -r 'is_dir("d:\\repos\\*\\website");'

call some finder command with ->in('/somepath/*')

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions