#25727 [Opn->Fbk]: popen returns wrong exitcode

From: Date: Thu, 02 Oct 2003 12:20:43 +0000
Subject: #25727 [Opn->Fbk]: popen returns wrong exitcode
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-48420@lists.php.net to get a copy of this message
 ID:               25727
 Updated by:       wez@php.net
 Reported By:      eru@php.net
-Status:           Open
+Status:           Feedback
 Bug Type:         Filesystem function related
 Operating System: i386 Linux
 PHP Version:      4CVS-2003-10-02 (stable)
 New Comment:

Try using fgets()


Previous Comments:
------------------------------------------------------------------------

[2003-10-02 08:00:43] eru@php.net

Description:
------------
Apparently this has something to do with the environment-variables in
the shell, popen uses to execute the command. If I replace "echo FOO"
with "export" I get the whole line of variables and then it fails,
whereas the successful execution only has one, BASH=/bin/sh. I use php
-n so no php.ini is used.

Reproduce code:
---------------
<?php
$pp = popen("echo FOO", "r");
echo fread($pp, 4096);
var_dump(pclose($pp));
?>


Expected result:
----------------
FOO
int(0)


Actual result:
--------------
FOO
int(-1)



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


-- 
Edit this bug report at http://bugs.php.net/?id=25727&edit=1


Thread (15 messages)

« previous php.bugs (#48420) next »