ID:               25727
 User updated by:  [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           Open
 Bug Type:         Filesystem function related
 Operating System: i386 Linux
 PHP Version:      4CVS-2003-10-02 (stable)
 New Comment:

I always questions "suggestions" given without explanation and I will
continue to do so in the future.

Now that you've given me one I can assure you that the outcome is just
the same. Please note, that I tested this snippet on at least 4
different systems with different accounts and got the behaviours
described in expected/actual result.


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

[2003-10-02 09:00:17] [EMAIL PROTECTED]

If you pclose before all the data has been read, you might
cause the child process to terminate abnormally, and this
might explain the exit code.

In addition, fread() will only read a "packet" from a pipe,
so you might not be getting all the data before you pclose
it.

*that's* what fread/fgets() has got to do with it;
in future, please don't question my suggestions and just
provide the requested feedback.



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

[2003-10-02 08:38:42] [EMAIL PROTECTED]

What has the fread/fgets to do with the problem? I'm talking about the
exitcode here. The fread-line is just a demonstration, that the command
is carried out correctly.

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

[2003-10-02 08:20:43] [EMAIL PROTECTED]

Try using fgets()

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

[2003-10-02 08:00:43] [EMAIL PROTECTED]

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

Reply via email to