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
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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:

<?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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 02:02:52 2024 UTC