From:             twm at twmacinta dot com
Operating system: Red Hat Enterprise Linux ES 3
PHP version:      5.2.5
PHP Bug Type:     CGI related
Bug description:  Invalid escaping for passthru() in CLI

Description:
------------
When I run a PHP script which uses passthru() to execute a command with
characters that need escaping, the escaping is incorrect when the script is
run from the command line, but it is fine when the script is run from
within Apache.  This was causing the script
"ext/standard/tests/file/bug22414.phpt" to fail when I attempted to run
"make test" after building PHP 5.2.5 on RHEL3.  I have created a simplified
script for this report to demonstrate the problem, though I will note that
I can also reproduce it reliably with "bug22414.phpt".

I should mention that I also tried my test script from the command line in
Mac OS X 10.5 running PHP 5.2.5 and Ubuntu 7.10 running PHP 5.2.3 and it
worked correctly in both cases.  So, my suspicion is that there is an older
library on RHEL3 which is causing the parsing the be incorrect.  It passes
all the requirements checks made by './configure', though.

I ran the test code below using the '-n' option to PHP so as to eliminate
my "php.ini" as the problem.


Reproduce code:
---------------
header("Content-Type: text/plain");
$textEscaped = escapeshellarg("Tim's Test");
print("Before: {$textEscaped}\n");
print("After: ");
passthru("/bin/echo {$textEscaped}");


Expected result:
----------------
Before: 'Tim'\''s Test'
After: Tim's Test


Actual result:
--------------
Before: 'Tim'\''s Test'
After: Tim\s Test'


-- 
Edit bug report at http://bugs.php.net/?id=44801&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44801&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44801&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44801&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44801&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44801&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44801&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44801&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44801&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44801&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44801&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44801&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44801&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44801&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44801&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44801&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44801&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44801&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44801&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44801&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44801&r=mysqlcfg

Reply via email to