[PHP-DEV] PHP 4.0 Bug #8466: Return status of executed command not passed correct in Exec() and System() From: kent.hansen <email protected>
Date: 12/28/00

From: kent.hansen <email protected>
Operating system: Linux (RedHat 6.2)
PHP version: 4.0.4
PHP Bug Type: Program Execution
Bug description: Return status of executed command not passed correct in Exec() and System()

The functions Exec() and System() fails to pass the return status of the command to the return_var variable. It always passes "-1".

This script reproduces the bug:

<?php
 $rc=0;
 unset($array);

 exec ("ls /", $array, $rc);
 echo "return value: $rc<br>";
 echo "output:<br>";

 $rows=count($array);
 for ($i=0; $i<$rows; $i++) {
  echo $array[$i]."<br>";
 }
?>

The output is:

return value: -1
output:
bin
boot
dev
...etc...

The "return value" is also "-1" if I change "/" to "/dont/exists/".

This bug is introduced in version 4.0.4, exec() worked in version 4.0.3pl1.

-- 
Edit Bug report at: http://bugs.php.net/?id=8466&edit=1

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