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

2011-10-31 Thread php at aldomx dot com
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=60181edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60181r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60181r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=60181r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60181r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=60181r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60181r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=60181r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=60181r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=60181r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=60181r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=60181r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=60181r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=60181r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60181r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=60181r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=60181r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=60181r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=60181r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=60181r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=60181r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=60181r=mysqlcfg



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

2011-10-31 Thread php at aldomx dot com
Edit report at https://bugs.php.net/bug.php?id=60181edit=1

 ID: 60181
 User updated by:php at aldomx dot com
 Reported by:php at aldomx dot com
 Summary:proc_open fails to read quoted whitespaced
 directories in Windows
 Status: Open
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 7
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

Sorry, I forgot to specify when you use 2 or more quoted arguments (in my 
example git directory in program files and working directory)


Previous Comments:

[2011-10-31 22:43:35] paj...@php.net

Works just fine:

?php
$descriptorspec = array(
   1 = array(pipe, w),
   2 = array(pipe, w)
);

$cmd = 'c:\\test\\bin with space\\t.bat';
$process = proc_open($cmd, $descriptorspec, $pipes);
echo stream_get_contents($pipes[1]);
echo stream_get_contents($pipes[2]);

$return_value = proc_close($process);
echo command returned $return_value\n;

where t.bat contains only dir for testing


[2011-10-31 22:05:01] php at aldomx dot com

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 this bug report at https://bugs.php.net/bug.php?id=60181edit=1


Bug #60181 [Fbk-Opn]: proc_open fails to read quoted whitespaced directories in Windows

2011-10-31 Thread php at aldomx dot com
Edit report at https://bugs.php.net/bug.php?id=60181edit=1

 ID: 60181
 User updated by:php at aldomx dot com
 Reported by:php at aldomx dot com
 Summary:proc_open fails to read quoted whitespaced
 directories in Windows
-Status: Feedback
+Status: Open
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 7
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

Yes, same result


Previous Comments:

[2011-10-31 23:08:37] paj...@php.net

Have you tries to use escape shell args?


[2011-10-31 22:51:41] php at aldomx dot com

Sorry, I forgot to specify when you use 2 or more quoted arguments (in my 
example git directory in program files and working directory)


[2011-10-31 22:43:35] paj...@php.net

Works just fine:

?php
$descriptorspec = array(
   1 = array(pipe, w),
   2 = array(pipe, w)
);

$cmd = 'c:\\test\\bin with space\\t.bat';
$process = proc_open($cmd, $descriptorspec, $pipes);
echo stream_get_contents($pipes[1]);
echo stream_get_contents($pipes[2]);

$return_value = proc_close($process);
echo command returned $return_value\n;

where t.bat contains only dir for testing


[2011-10-31 22:05:01] php at aldomx dot com

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 this bug report at https://bugs.php.net/bug.php?id=60181edit=1


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

2011-10-31 Thread php at aldomx dot com
Edit report at https://bugs.php.net/bug.php?id=60181edit=1

 ID: 60181
 User updated by:php at aldomx dot com
 Reported by:php at aldomx dot com
 Summary:proc_open fails to read quoted whitespaced
 directories in Windows
 Status: Open
 Type:   Bug
 Package:Program Execution
 Operating System:   Windows 7
 PHP Version:5.3.8
 Block user comment: N
 Private report: N

 New Comment:

As additional information, using the same string with exec(), system() or 
passthru() works fine, proc_open() is the only one with this issue.


Previous Comments:

[2011-10-31 23:13:03] php at aldomx dot com

Yes, same result


[2011-10-31 23:08:37] paj...@php.net

Have you tries to use escape shell args?


[2011-10-31 22:51:41] php at aldomx dot com

Sorry, I forgot to specify when you use 2 or more quoted arguments (in my 
example git directory in program files and working directory)


[2011-10-31 22:43:35] paj...@php.net

Works just fine:

?php
$descriptorspec = array(
   1 = array(pipe, w),
   2 = array(pipe, w)
);

$cmd = 'c:\\test\\bin with space\\t.bat';
$process = proc_open($cmd, $descriptorspec, $pipes);
echo stream_get_contents($pipes[1]);
echo stream_get_contents($pipes[2]);

$return_value = proc_close($process);
echo command returned $return_value\n;

where t.bat contains only dir for testing


[2011-10-31 22:05:01] php at aldomx dot com

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 this bug report at https://bugs.php.net/bug.php?id=60181edit=1