Bug #60838 [Opn->Bgs]: Output problem when script contains command
Edit report at https://bugs.php.net/bug.php?id=60838&edit=1
ID: 60838
Updated by: rasmus@php.net
Reported by: samleejboss at gmail dot com
Summary: Output problem when script contains command
-Status: Open
+Status: Bogus
Type: Bug
Package: CGI/CLI related
Operating System: Debian Squeeze
PHP Version: 5.3.9
Block user comment: N
Private report: N
New Comment:
This doesn't look like a bug to me. You are trying to pass the string "php
test.php" to grep, but since you didn't put quotes around it, you are asking grep
to look for the string "php" in a file named "test.php". You need something like
this:
echo shell_exec("ps aux|grep \"php test.php\"");
Previous Comments:
------------------------------------------------------------------------
[2012-01-22 10:23:31] samleejboss at gmail dot com
Description:
------------
A parsing/execution problem is taking place when a command, such as "php test.php", runs a
script which contains the command ("php test.php") within a string.
It seems the problem can also be recreated when the string is manipulated, like base64 decoded.
Test script:
---------------
<?php
echo shell_exec("ps aux|grep php test.php");
?>
Expected result:
----------------
root 9641 0.0 0.1 162544 10036 pts/0 S 12:19 0:00 php test.php
Actual result:
--------------
<?php
echo shell_exec("ps aux|grep php test.php");
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60838&edit=1
Thread (2 messages)