RE: [PHP-DEV] Bug #3867: Exec() no longer returns the command output line
| From: | Mike Robinson | Date: | Sun, 19 Mar 2000 04:28:54 +0000 |
| Subject: | RE: [PHP-DEV] Bug #3867: Exec() no longer returns the command output line | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-17013@lists.php.net to get a copy of this message | ||
>From: mlemos@acm.org
>Operating system: Linux RH 6.0
>PHP version: 3.0.15
>PHP Bug Type: Misbehaving function
>Bug description: Exec() no longer returns the command output line
>The Exec() command no longer returns the command output line
>like it used to until the version 3.0.14. Try this:
><?
>echo Exec("pwd"),"\n";
>?>
Hmmm.
From the manual...
"string exec(string command, string [array], int [return_var]);
exec() executes the given command, however it does not output anything."
<snip>
"If the array argument is present, then the specified array will be filled
with every line of output from the command."
<snip>
So... echo exec("pwd") would output nothing, as stated. However, if I
execute the following script in the /home/httpd/html directory:
<?php
Exec("pwd",$result);
echo "$result[0]\n";
?>
the output is "/home/httpd/html", as expected.
I may be hallucinating, but I've never known exec() to
output anything, unless the output is dumped to the array
specified in the second argument.
>This bug also shows in PHP 4.0b4pl1.
The behaviour is the same I agree. I believe it's the expected
behaviour.
/mike