Bug #60181 [NEW]: proc_open fails to read quoted whitespaced directories in Windows

From: Date: Mon, 31 Oct 2011 22:05:02 +0000
Subject: Bug #60181 [NEW]: proc_open fails to read quoted whitespaced directories in Windows
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-164742@lists.php.net to get a copy of this message
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



Thread (13 messages)

« previous php.bugs (#164742) next »