php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8466 Return status of executed command not passed correct in Exec() and System()
Submitted: 2000-12-28 17:29 UTC Modified: 2001-02-22 18:40 UTC
From: kent dot hansen at bigfoot dot com Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.0.4 OS: Linux (RedHat 6.2)
Private report: No CVE-ID: None
 [2000-12-28 17:29 UTC] kent dot hansen at bigfoot dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-22 05:19 UTC] stas@php.net
seems to be dup of #8992
 [2001-02-22 18:40 UTC] sniper@php.net
Fixed in CVS.

--Jani

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 07:01:25 2019 UTC