From: compconsultant at yahoo dot com
Operating system: Centos 5.3
PHP version: 5.2.11
PHP Bug Type: Streams related
Bug description: proc_open, stream_select function hangs on return
Description:
------------
Using proc_open to open a pipe to a command, and, putting stream_select
into a function, hangs upon return from that function.
Reproduce code:
---------------
<?php
function SelectStream($StreamsArray) {
$Null = array();
$timeout = NULL;
stream_select($StreamsArray, $Null, $Null, $timeout);
echo "After select\n";
return FALSE;
}
$ProcDescriptor = array(1 => array("pipe", "w"));
$Resource = proc_open("tail -F /var/log/mail.log", $ProcDescriptor,
$Pipes, NULL, NULL, array("binary_pipes" => TRUE));
if ($Resource === FALSE) die("proc_open failed\n");
$ProgResource = $Pipes[1];
/*
$ProgResource = popen("tail -F /var/log/mail.log", "r");
if ($ProgResource === FALSE) die("Could not open the PIPE\n");
*/
$Streams[] = $ProgResource;
$Resource = SelectStream($Streams);
echo "ok\n";
?>
Expected result:
----------------
I expect ok to be displayed. If you replace proc_open with popen
(uncomment the lines), the same function returns fine (ok displayed). If
you remove the stream_select, it also returns fine.
Actual result:
--------------
The string ok is not displayed, the statement is never reached. After
select is displayed. So, it is hanging on the return statement.
--
Edit bug report at http://bugs.php.net/?id=49694&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49694&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49694&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49694&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49694&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49694&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49694&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49694&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49694&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49694&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49694&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49694&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49694&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49694&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49694&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49694&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49694&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49694&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49694&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49694&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49694&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49694&r=mysqlcfg