From:             christian dot lefebvre at atosorigin dot com
Operating system: linux
PHP version:      5.2.8
PHP Bug Type:     cURL related
Bug description:  stream_get_meta_data don't fills header list

Description:
------------
With php 5.2.8 and curlwrapper option, after calling fopen() on a remote
url, a call to stream_get_meta_data() returns an empty header list.
If a call to fread() is inserted between fopen() and
stream_get_meta_data(), the headers are presents.

The problem appears during a migration from 5.0 without curl, to 5.2 with
curl, so it seems curl related.

Calling the test script via strace shows that the socket is opened, but
there's no call to read() syscall before the stream_get_meta_data is
called.

The problem is not systematically reproduced (certainly due to response
latencies), but appears very often.

Reproduce code:
---------------
this version fails :

$src = fopen("http://www.perdu.com";, 'r');
$meta = stream_get_meta_data($src);
var_dump($meta);
var_dump($http_response_header);
$data= fread($src, 500);
echo $data."\n\n";

this one works (just call fread before get_meta) :

$src = fopen("http://www.perdu.com";, 'r');
$data= fread($src, 500);
$meta = stream_get_meta_data($src);
var_dump($meta);
var_dump($http_response_header);
echo $data."\n\n";


Expected result:
----------------
array(10) {
  ["wrapper_data"]=>
  array(2) {
    ["headers"]=>
    array(8) {
      [0]=>
      string(15) "HTTP/1.1 200 OK"
      [1]=>
      string(35) "Date: Thu, 18 Dec 2008 10:15:19 GMT"
      [2]=>
      string(14) "Server: Apache"
      [3]=> ....

Actual result:
--------------
array(10) {
  ["wrapper_data"]=>
  array(2) {
    ["headers"]=>
    array(0) {
    }
...

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

Reply via email to