[php-src] Issue #14691: glob wrapper not work on windows with open_basedir set ?!

From: Date: Thu, 27 Jun 2024 16:05:16 +0000
Subject: [php-src] Issue #14691: glob wrapper not work on windows with open_basedir set ?!
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247162@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/14691 Author: tsybot ### Description If we enable open_basedir option and set it to C:\php_build\ And now we go try glob:// with "wildcard": ```php <?php $it = new DirectoryIterator("glob://C:\\php_build\\*"); ``` or ```php <?php $it = new DirectoryIterator("glob://C:\\php_build\\inside_open_basedir\\*"); ``` We recevie: ``` Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(): open_basedir restriction in effect. File(C:\php_build\*) is not within the allowed path(s): (C:\php_build\) ``` or ``` Fatal error: Uncaught UnexpectedValueException: DirectoryIterator::__construct(): open_basedir restriction in effect. File(C:\php_build\inside_open_basedir\*) is not within the allowed path(s): (C:\php_build\) ``` Its because function virtual_file_ex always return 1 when see * or ? symbols in path on windows virtual_file_ex -> return 1 -> expand_filepath_with_mode -> return NULL -> expand_filepath_ex -> expand_filepath -> php_check_specific_open_basedir -> return -1 https://github.com/php/php-src/blob/54e5e7b507c15e29f2fc64c64047ded68283576a/Zend/zend_virtual_cwd.c#L1101 https://github.com/php/php-src/blob/54e5e7b507c15e29f2fc64c64047ded68283576a/main/fopen_wrappers.c#L839 https://github.com/php/php-src/blob/54e5e7b507c15e29f2fc64c64047ded68283576a/main/fopen_wrappers.c#L168 And so, if open_basedir enabled glob:// not working on windows ? is this correct behavior? ### PHP Version PHP 8.0.22 ### Operating System Windows Server 2022

« previous php.bugs (#247162) next »