From:             info at netzkontrast dot com
Operating system: Ubuntu/Suse/Linux
PHP version:      5.3.1
PHP Bug Type:     Streams related
Bug description:  stream_set_blocking doesn't work with fopen

Description:
------------
I tried the following code with different PHP-versions (5.3.1 + 5.2.8) on
different Systems (one ubunto-box and a suse-box

i'm totaly stuck, is there anything i'm missing?

-- i have prepared some testscripts 
- streamContent.php (used for testoutput)
- streamfiletest.php -> not working
- streamSocketTest.php -> not working
- streamFsockTest.php -> working






Reproduce code:
---------------
<?php    // streamfiletest.php
$filename = "/home/tests/myfile.txt";
$handle = fopen($filename, "r");
stream_set_blocking($handle, 0);
$metadata = stream_get_meta_data($handle);
var_dump($metadata['blocked']) // should return 0     ?>

<?php // streamContent.php
for($i = 10;$i;--$i) {
    echo ". ";
    if (ob_get_contents())ob_flush();flush();usleep(1000000);  
}     ?>

<?php //streamSocketTest.php 
$handle = fopen("http://localhost/streamContent.php";, "r");
stream_set_blocking($handle, 0); 
while(!feof($handle)) {
    echo  fread($handle, 100);
       echo "-";usleep(80000); 
}   ?>

<?php // streamFsockTest.php 
$handle = fsockopen("localhost", 80);
stream_set_blocking($handle, 0);
fputs($handle, "GET /streamcontent.php HTTP/1.0\r\nHost:
mp.devel\r\nConnection: keep-alive\r\n\r\n");
while(!feof($handle)) {
    echo  fgets($handle, 10);
       echo "-";usleep(80000); 
}?>

Expected result:
----------------
streamfiletest.php: 0
streamSocketTest.php: . -----------. ------------. (etc..)
streamFsockTest.php: . -----------. ------------. (etc..)

Actual result:
--------------
streamfiletest.php: 1
streamSocketTest.php: . -. -. -
streamFsockTest.php: . -----------. ------------.  

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

Reply via email to