Re: PEAR::System::which() inquiry
| From: | Philippe Jausions | Date: | Sun, 04 Jul 2004 03:54:13 +0000 |
| Subject: | Re: PEAR::System::which() inquiry | ||
| References: | 1 2 3 4 | Groups: | php.pear.core |
| Request: | Send a blank email to pear-core+get-422@lists.php.net to get a copy of this message | ||
Tomas V.V.Cox wrote:
Philippe Jausions wrote:Ok, I didn't see it went into the pear-core/ cvs folder... was still checking php-src... duh. Could you also patch the pear_system.phpt with the additional regression tests for System::which() and new, previously missing, System::cat() tests. That will help testing... :-) From the way you patched System::which() I see several problems: System::which('C:\\Windows\\system32\cmd') would fail The rational behind that one is mostly for UNIX tools ported to Windows and being able to use them seamlessly in a PHP script. For instance: $patchexec = System::which(GNU_BIN_PATH . 'patch'); would work on both UNIX-like and Windows OS's without changing the script or requiring GNU_BIN_PATH being in the system environment PATH... Your implementation of "honoring" safe mode creates a BC break and is not consistent. If safe mode is on, but no safe_mode_exec_dir is set, then it folds back to PATH... About the BC break, I can imagine a PHP script that generates a shell script. Now, the System::which() would not find programs in PATH if safe mode is on... -PhilippeSeveral things for the patch: For Windows, now this works: - System::which('cmd') - System::which('cmd.exe') - System::which('c:\\windows\\system32\\cmd') - System::which('c:\\windows\\system32\\cmd.exe')I've just commited that part of the patch, plus safe mode. Please test it, works nice for Linux. Thanks, Tomas V.V.Cox