From:
Operating system: Windows 7
PHP version: 5.3.8
Package: Program Execution
Bug Type: Bug
Bug description:proc_open fails to read quoted whitespaced directories in
Windows
Description:
------------
Trying to execute via proc_open:
"C:/Program Files (x86)/Git/bin/git.exe" status --porcelain
--untracked-files=all
-- "D:/home/aldo/git/test whitespace"
is like not using them, since the result of STDERR is:
'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
Test script:
---------------
<?php
$command = sprintf(
'"%s" status --porcelain --untracked-files=all -- "%s"', // Git command
'C:/Program Files (x86)/Git/bin/git.exe', // Git executable
'D:/home/aldo/git/test with whitespace' // Directory
);
// $command = '"C:/Program Files (x86)/Git/bin/git.exe" status --porcelain
--untracked-files=all -- "D:/home/aldo/git/test with whitespace"';
$proc = proc_open(
$command,
array (
array ( "pipe", "r" ),
array ( "pipe", "w" ),
array ( "pipe", "w" )
),
$pipes
);
echo stream_get_contents( $pipes[2] );
// Outputs: 'C:/Program' is not recognized as an internal or external
command,
// operable program or batch file.
?>
Expected result:
----------------
proc_open read the quotes correctly and manages to run git-status smoothly
Actual result:
--------------
'C:/Program' is not recognized as an internal or external command,
operable program or batch file.
--
Edit bug report at https://bugs.php.net/bug.php?id=60181&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60181&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60181&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60181&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60181&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60181&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60181&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60181&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60181&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60181&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60181&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60181&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60181&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60181&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60181&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60181&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60181&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60181&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60181&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60181&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60181&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60181&r=mysqlcfg