From:             sam at freepeers dot com
Operating system: Windows 2000
PHP version:      4.3.2
PHP Bug Type:     Program Execution
Bug description:  Program Executation Functions fails in certain cases

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 bug report at http://bugs.php.net/?id=25361&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25361&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25361&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25361&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25361&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25361&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25361&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25361&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25361&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25361&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25361&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25361&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25361&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25361&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25361&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25361&r=gnused

Reply via email to