From:             brandon dot landry at dvusd dot org
Operating system: suse
PHP version:      5.3.15
Package:          Filesystem function related
Bug Type:         Bug
Bug description:stream_get_line hangs

Description:
------------
In php 5.3.11 there was some change made to stream_get_line which causes
this test 
script to hang (it still hangs on the latest version from 5.3 and 5.4
branches).  
In  the changelog for that version it says stream_get_line was changed to
be more 
in line with fgets ... Now if you replace stream_get_line with fgets the
script 
does run seemingly correctly ... The only reason I am reporting this is, if
the 
function was changed to be more in line with fgets, and fgets works but 
stream_get_line does not, ... is this a bug or something I am missing.


Test script:
---------------
<?php

$descSpec = array(
    array('pipe','r'),  // stdin
    array('pipe','w'),  // stdout
    array('pipe','w')   // stderr
);
$proc = proc_open('bash', $descSpec, $pipes,'/tmp',array());
if(!is_resource($proc)){
    throw new Exception("Could not open bash process");
}
$stdin  = &$pipes[0];
$stdout = &$pipes[1];
$stderr = &$pipes[2];

stream_set_blocking($stdout,0);
stream_set_blocking($stderr,0);

fwrite($stdin, "pwd\n");
fflush($stdin);

$write = null;
$except = null;
$stdoutArr  = array($stdout);
$rv = stream_select($stdoutArr,$write,$except,1);
$strIn = stream_get_line($stdout,4096);
var_export(array('streamSelect_returnVal'=>$rv,'stdout_strRead'=>$strIn));


-- 
Edit bug report at https://bugs.php.net/bug.php?id=62697&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62697&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62697&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62697&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62697&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62697&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62697&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62697&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62697&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62697&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62697&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62697&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62697&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62697&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62697&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62697&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62697&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62697&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62697&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62697&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62697&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62697&r=mysqlcfg

Reply via email to