[php-src] Issue #19010: opendir() sporadic failure on Docker-mounted filesystem

From: Date: Wed, 02 Jul 2025 15:55:24 +0000
Subject: [php-src] Issue #19010: opendir() sporadic failure on Docker-mounted filesystem
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-250362@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/19010 Author: wayne530 ### Description Additional details: 1. Not all paths or files exhibit this behavior 2. A second immediate call to opendir() succeeds 3. Other built-ins, like \RecursiveDirectoryIterator that also (presumably) use opendir() also fail on the first attempt while a second immediate call succeeds The following code: ```php <?php $directory = 'some/relative/path/to/a/directory'; var_dump(opendir($directory)); var_dump(opendir($directory)); ``` Resulted in this output: ``` WARNING opendir(some/relative/path/to/a/directory): Failed to open directory: No such file or directory in test.php. bool(false) resource(12345) of type (stream) ``` But I expected this output instead: ``` resource(12345) of type (stream) resource(12346) of type (stream) ``` To confirm it is filesystem dependent, running the same code on the same path on the host machine does not produce an error. Host machine is running macOS 15.4. Docker Desktop is current as of submitting this issue (v4.42.1). To further try to rule out php involvement, I also tried UNIX commands inside the container that require calling opendir(), such as find and these work without issue. Additionally, the following C code works without issues from inside the container: ```c #include <dirent.h> #include <stdio.h> int main() { DIR *dirp; dirp = opendir("some/relative/path/to/a/directory"); if (dirp == NULL) { printf("Error calling opendir()"); return -1; } closedir(dirp); return 0; } ``` ### PHP Version ```plain PHP 8.3.22 (cli) (built: Jun 11 2025 00:56:01) (NTS) Copyright (c) The PHP Group Zend Engine v4.3.22, Copyright (c) Zend Technologies with Zend OPcache v8.3.22, Copyright (c), by Zend Technologies ``` ### Operating System Debian bookworm (container)

« previous php.bugs (#250362) next »