-
Notifications
You must be signed in to change notification settings - Fork 6
Bug: Fix PHP Warning: "scandir(): No such file or directory" in require-drivers.php #38
Description
Description
Laravel Valet Windows 3.3.0, fresh install on new device.
Device is Windows 11 IoT Enterprise LTSC
PHP 8.5.4 (cli) (built: Mar 10 2026 23:30:42) (ZTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Built by The PHP Group
Zend Engine v4.5.4, Copyright (c) Zend Technologies
with Xdebug v3.5.1, Copyright (c) 2002-2026, by Derick Rethans
with Zend OPcache v8.5.4, Copyright (c), by Zend Technologies
Warning: scandir(C:\Users\dan\scoop\persist\composer\home\vendor\ycodetech\valet-windows\cli\includes/legacy): The system cannot find the file specifi (code: 2) in C:\Users\dan\scoop\persist\composer\home\vendor\ycodetech\valet-windows\cli\includes\require-drivers.php on line 43
Warning: scandir(C:\Users\dan\scoop\persist\composer\home\vendor\ycodetech\valet-windows\cli\includes/legacy): Failed to open directory: No such file or directory in C:\Users\dan\scoop\persist\composer\home\vendor\ycodetech\valet-windows\cli\includes\require-drivers.php on line 43
Warning: scandir(): (errno 2): No such file or directory in C:\Users\dan\scoop\persist\composer\home\vendor\ycodetech\valet-windows\cli\includes\require-drivers.php on line 43
Warning: foreach() argument must be of type array|object, false given in C:\Users\dan\scoop\persist\composer\home\vendor\ycodetech\valet-windows\cli\includes\require-drivers.php on line 43
the line is here
if (is_dir($legacyDriversDir)) { // i add this line to fix the issue
foreach (scandir($legacyDriversDir) as $file) {
if (substr($file, 0, 1) !== '.') {
require_once "$legacyDriversDir/$file";
}
}
} // and this line
Steps To Reproduce
just fresh install valet on new device,
Diagnosis
The issue was that scandir() was being called unconditionally on the $includesDir/legacy directory. Since that directory didn't exist, it resulted in path resolution warnings and caused the foreach loop to receive false instead of an array.