#25361 [Opn->Bgs]: Program Execution Functions fail in certain cases
| From: | sniper@php.net | Date: | Tue, 02 Sep 2003 23:08:11 +0000 |
| Subject: | #25361 [Opn->Bgs]: Program Execution Functions fail in certain cases | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-47093@lists.php.net to get a copy of this message | ||
ID: 25361
Updated by: sniper@php.net
Reported By: sam at freepeers dot com
-Status: Open
+Status: Bogus
Bug Type: Program Execution
Operating System: Windows 2000
PHP Version: 4.3.2
New Comment:
PHP uses "cmd.exe /c" for executing programs under windows.
You can try your examples on command line:
cmd.exe /c "your long command" "another file"
And you'll see it does not work. This is not PHP problem but yet
another windows problem.
You must always use the '8.3' format of the paths/filenames.
Previous Comments:
------------------------------------------------------------------------
[2003-09-02 11:07:00] sam at freepeers dot com
Description:
------------
Running PHP on Windows 2000 with IIS 5.
Basic program executation does not work in certain cases.
This is ok:
$output =
C:\executable.exe C:\\file1.txt;
Now, lets suppose that both the filename and the executable names
contain spaces, and therefore each are to be enclosed in quotes. Then
it fails:
This is not ok:
$output = "C:\executable.exe" "C:\\file1.txt";
This is ok again:
$output = C:\executable.exe "C:\\file1.txt";
This is also ok:
$output = "C:\executable.exe" C:\\file1.txt;
So, the problem arises when BOTH the command and the file are enclosed
in quotes. In some cases you do need to enclose both the command and
the file in quotes. You will not be able to.
This affects all forms of command execution (exec, system,
backticks...)
Reproduce code:
---------------
1. Create file called "Test.txt" and put it into C: drive. Put some
random text in it.
2. Try this code:
<?php
$output = "";
$output = more C:\\Test.txt;
echo "Test.txt contains $output. This works<br><br>";
$output = "";
$output = "more" C:\\Test.txt;
echo "Test.txt contains $output. This works<br><br>";
$output = "";
$output = more "C:\\Test.txt";
echo "Test.txt contains $output. This works<br><br>";
$output = "";
$output = "more" "C:\\Test.txt";
echo "Test.txt contains $output. This does not works<br><br>";
?>
Expected result:
----------------
Test.txt contains Contents of file. . This works
Test.txt contains Contents of file. . This works
Test.txt contains Contents of file. . This works
Test.txt contains Contents of file. . This does not works
Actual result:
--------------
Test.txt contains Contents of file. . This works
Test.txt contains Contents of file. . This works
Test.txt contains Contents of file. . This works
Test.txt contains . This does not works
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25361&edit=1