From: boen dot robot at gmail dot com Operating system: Windows XP Professional SP2 PHP version: 5CVS-2007-04-29 (snap) PHP Bug Type: Program Execution Bug description: Quotes don't work on a program's path.
Description: ------------ When executing a command with system(), exec(), passthru() or shell_exec(), quotes in the program's path are not accepted and nothing is returned (except error code 1). The same command with quotes around the path works from the command line. Without quotes, the program only works if there are no spaces in the paths, which is where the real problem lies. Reproduce code: --------------- <?php ini_set('display_errors','On'); ini_set('error_reporting',1); print system('"D:\vasko\Software\XSLT2\saxonsa8-8n\bin\transform.exe" -a "D:\htdocs\XML\_benchmark\reference.xml"',$status); print $status; ?> Returns 1 (because of the "print $status" - otherwise it's an empty default HTML). <?php ini_set('display_errors','On'); ini_set('error_reporting',1); print system('D:\vasko\Software\XSLT2\saxonsa8-8n\bin\transform.exe -a "D:\htdocs\XML\_benchmark\reference.xml"',$status); print $status; ?> Returns the output of the program, and 0 after it. This particular case works, but if the path had spaces, there would be no way to execute the program... not withing PHP anyway (a bat file could be a solution, but still...). Expected result: ---------------- The program should run even if the path to it has quotes and it's output should be then printed. Actual result: -------------- The first code, when executed results in an error, which wouldn't be raised with the same command executed directly from the command line. -- Edit bug report at http://bugs.php.net/?id=41224&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41224&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41224&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41224&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41224&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41224&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41224&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41224&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41224&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41224&r=support Expected behavior: http://bugs.php.net/fix.php?id=41224&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41224&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41224&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41224&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41224&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41224&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41224&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41224&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41224&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41224&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41224&r=mysqlcfg