|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: kent dot hansen at bigfoot dot com
New email:
PHP Version: OS:


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


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

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

The output is:

return value: -1

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.


Add a Patch

Pull Requests

Add a Pull Request


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


PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Mar 21 05:03:38 2023 UTC