Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow using "zip.cmd" on Windows #131

Open
axiac opened this issue Apr 13, 2017 · 0 comments
Open

Allow using "zip.cmd" on Windows #131

axiac opened this issue Apr 13, 2017 · 0 comments

Comments

@axiac
Copy link

axiac commented Apr 13, 2017

Zippy tries to find zip, unzip and other external executable files using the class Symfony\Component\Process\ExecutableFinder provided by the symfony/process package.

This class searches the provided name in the directories set in the PATH environment variable. On Windows it also tries to add the file extensions that are registered in the PATHEXT environment variable as "executable" extensions (.exe, .com, .cmd, .bat a.s.o). This means that if it tries to find zip on Windows it may return (with full path) some zip.cmd or zip.bat that is present in path.
And this is how it should work.

Unfortunately, the path returned by ExecutableFinder::find() is then checked by Zippy using the PHP function is_executable() that returns TRUE only for valid executable files whose extension is .exe.

This makes impossible using zip.cmd or zip.bat instead of zip.exe even if they are in path and are perfectly valid executable files.

I suggest using is_executable() only when the operating system is not Windows.


As a side note, any file whose extension is recorded in the Windows registry with the verb open is "executable" on Windows. It can be open using the associated program by double-clicking it on Windows Explorer, by using the "start" command in a Command Prompt or by passing it as the first argument ($command or $cmd) to any PHP function that launches another program (system(), exec(), shell_exec(), proc_open() etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant