-
-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Environment
- Crunz version: 3.7^
- PHP version: 7.4 and later
- OS: Windows 10 Pro or later
Description
On Windows, if your PHP CLI binary lives in a directory whose path contains spaces (for example, C:\Program Files\PHP\php.exe), scheduled tasks will silently fail. The command-line builder in src/Event.php (around line 1165) doesn’t wrap the PHP_BINARY constant in quotes, so Windows tries to execute C:\Program instead of the full C:\Program Files\PHP\php.exe.
How to reproduce
- Install PHP 8.0+ under a path with spaces (e.g.
C:\Program Files\PHP\php.exe). - Include a minimal schedule in your project (e.g. a
crunz.ymlthat writes output to a file or stdout). - From a CMD or PowerShell prompt, run:
php vendor/bin/crunz schedule:run
4.Observe that nothing happens and no error appears, because Windows cannot locate the (unquoted) executable.
Expected behavior
Crunz should wrap PHP_BINARY in quotes so that Windows can correctly invoke the full path, and the scheduled task runs as intended.
Actual behavior
No tasks run and no errors are reported; Windows attempts to execute the truncated path up to the first space.
Workaround
Manually patch src/Event.php (around L1165) in your vendor copy to wrap the binary in quotes, or install PHP into a path without spaces.
Possible solution
Change this line in src/Event.php:
PHP_BINARY . " {$crunzRoot} closure:run {$serializedClosure}";
to:
'"' . PHP_BINARY . '"' . " {$crunzRoot} closure:run {$serializedClosure}";
This ensures the full PHP path is quoted on Windows.