php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25727 --enable-sigchild is causing unexpected behaviour (for example with popen())
Submitted: 2003-10-02 08:00 UTC Modified: 2004-03-09 19:16 UTC
From: eru@php.net Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5CVS OS: i386 Linux
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: eru@php.net
New email:
PHP Version: OS:

 

 [2003-10-02 08:00 UTC] 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)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-02 09:00 UTC] wez@php.net
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-03 20:24 UTC] sniper@php.net
And finally: What was the configure line you used to configure PHP? (should have asked this the very beginning :)

 [2003-10-03 20:34 UTC] eru@php.net
./configure     \
        --enable-bcmath         \
        --enable-calendar       \
        --enable-debug          \
        --enable-exif           \
        --enable-ftp            \
        --enable-mbstring       \
        --enable-memory-limit   \
        --enable-pcntl          \
        --enable-shmop          \
        --enable-sigchild       \
        --enable-ucd-snmp-hack  \
        --enable-sockets        \
        --enable-sysvmsg        \
        --enable-sysvsem        \
        --enable-sysvshm        \
        --with-apxs=/usr/local/apache/bin/apxs  \
        --with-bz2              \
        --with-gd               \
        --with-freetype-dir     \
        --with-gettext          \
        --with-ldap             \
        --with-mysql=/usr                       \
        --with-mysql-sock=/var/lib/mysql/       \
        --with-ncurses          \
        --with-snmp             \
        --with-xml              \
        --with-zlib
 [2003-10-03 20:53 UTC] sniper@php.net
Just remove the --enable-sigchild option. (you really don't need it when you don't use oracle..)

Won't fix in PHP 4, maybe fix in PHP 5. (the sigchild issue)

 [2004-03-09 19:16 UTC] iliaa@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Dupe of bug #22999 
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sat Jul 11 02:01:24 2020 UTC