RE: [PHP-DEV] Bug #3867: Exec() no longer returns the command output line

From: Date: Sun, 19 Mar 2000 03:44:30 +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-17015@lists.php.net to get a copy of this message
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: http://phpclasses.UpperDesign.com/?user=mlemos@acm.org -- E-mail: mlemos@acm.org URL: http://www.mlemos.e-na.net/ PGP key: http://www.mlemos.e-na.net/ManuelLemos.pgp --

« previous php.dev (#17015) next »