php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17097 exec() always reports -1- as the return value of the executed command
Submitted: 2002-05-08 10:33 UTC Modified: 2002-06-06 06:03 UTC
From: djanix at hotmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0CVS-2002-05-08 OS: win32
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: djanix at hotmail dot com
New email:
PHP Version: OS:

 

 [2002-05-08 10:33 UTC] djanix at hotmail dot com
testret.c i made... :

#include <stdio.h>
int main( int argc, char *argv[] )
{
  return atol(argv[1]);
}

compiled that into testret.exe....

test.php i made... :

<?
  exec( 'c:\testret.exe 3', $rlines, $rval );
  var_dump( $rval );
?>

outputs...

int(1)

--------------------

i've traced through the source a bunch trying to find what changed that broke it - my last build (worked fine) was from the cvs head sometime in feb - so the big changes that affect exec() are the streams.  FG(pclose_ret) is not set correctly inside of exec() - i don't feel like getting into the streams right now to find it and i assume someone on the dev team has all of that fresh in their head and can probably find this problem quickly :)

and it's obviously important since i'm sure many many people rely on exec()...

 -benjamin

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-06 05:45 UTC] sander@php.net
exec() != shell_exec()
 [2002-06-06 06:03 UTC] edink@php.net
Just FYI, I could not reporoduce this. The latest sapshot prints int(3) as it should.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 19:01:36 2025 UTC