Bug #19090 [Opn->Dup]: exec() does not work with spaces in command line
| From: | mrook@php.net | Date: | Wed, 24 Oct 2012 20:51:58 +0000 |
| Subject: | Bug #19090 [Opn->Dup]: exec() does not work with spaces in command line | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-9229@lists.php.net to get a copy of this message | ||
Edit report at https://pear.php.net/bugs/bug.php?id=19090&edit=1
ID: 19090
Updated by: mrook@php.net
Reported By: carcus88 at gmail dot com
Summary: exec() does not work with spaces in command line
-Status: Open
+Status: Duplicate
Type: Bug
Package: VersionControl_SVN
Operating System: Windows
Package Version: 0.4.0
PHP Version: 5.2.12
Roadmap Versions:
New Comment:
-Status: Open
+Status: Duplicate
Previous Comments:
------------------------------------------------------------------------
[2012-06-11 10:56:22] alex_le
Seems duplicate of Bug #18130
------------------------------------------------------------------------
[2011-11-30 05:26:22] carcus88
Description:
------------
If you have spaces in your command line for svn.exe then exec() will not
work. In order for it to work the entire command should be double quoted
again. See the test script for a easy example.
Test script:
---------------
<?php
$cmd = '"C:\Program Files\CollabNet Subversion\svn.exe" status
--username user --password password "C:\Program Files\Apache Software
Foundation\Apache2.2\htdocs\index.htm"';
# Fail
# exec("$cmd 2>&1", $out, $ret_var);
# Success
exec("\"$cmd 2>&1\"", $out, $ret_var);
?>
Expected result:
----------------
I expected the svn executable to be invoked, it was not.
Actual result:
--------------
If you comment out the exec() under # Fail you will see errors in $out
because exec() does not deal with quoted path unless the whole string is
quoted again.
------------------------------------------------------------------------
--
Edit this bug report at https://pear.php.net/bugs/bug.php?id=19090&edit=1