ID: 25361
User updated by: sam at freepeers dot com
-Summary: Program Executation Functions fails in certain cases
Reported By: sam at freepeers dot com
Status: Open
Bug Type: Program Execution
Operating System: Windows 2000
PHP Version: 4.3.2
New Comment:
comment
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