RE: [PHP-DEV] Bug #3867: Exec() no longer returns the command output line From: Manuel Lemos (mlemos <email protected>)
Date: 03/18/00

Hello Mike,

On 19-Mar-00 02:28:54, you wrote:

>>From the manual...

>"string exec(string command, string [array], int [return_var]);

>exec() executes the given command, however it does not output anything."

><snip>

You have cut the relevant part right after that:

It simply returns the last line from the result of the command.

>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.

No, you are just confusing command output with the function return value.
What the manual means is that, unlike System(), Exec() does not dump the
output of the executed command to the output of the script. But that has
nothing with the Exec() function return value which should be set to the
last outputted line of executed command.

Exec() always worked this was since a long time ago before the output and
result parameters were supported. That is why they are optional.

>>This bug also shows in PHP 4.0b4pl1.

>The behaviour is the same I agree. I believe it's the expected
>behaviour.

Something was broken between 3.0.14 and 3.0.15 that probably was passed to
under PHP 4.0b4pl1 . If you try the example under PHP 3.0.14 you'll that
it stopped working under 3.0.15 . A site of mine broke when I upgraded to
3.0.15. That's why I don't like to upgrade to the very latest version.
There is a risk of new bugs like this one. I know I can replace the
function return value by something like (count($output) ?
$output[count($output)-1] : ""), but the bug is still there.

Regards,
Manuel Lemos

Web Programming Components using PHP Classes.
Look at: email protected>?subject=RE:%20[PHP-DEV]%20Bug%20#3867:%20Exec()%20no%20longer%20returns%20the%20command%20output%20line&replyto=1841.113T1535T1044344mlemos <email protected>">mlemos <email protected>">http://phpclasses.UpperDesign.com/?user=mlemos <email protected>

--
E-mail: mlemos <email protected>
URL: http://www.mlemos.e-na.net/
PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp
--

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>