Bug #52820 [NEW]: curl doesn't write to php://temp or /memory

From: Date: Sun, 12 Sep 2010 00:05:24 +0000
Subject: Bug #52820 [NEW]: curl doesn't write to php://temp or /memory
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154261@lists.php.net to get a copy of this message
From:             
Operating system: Ubuntu
PHP version:      5.3.3
Package:          Sockets related
Bug Type:         Bug
Bug description:curl doesn't write to php://temp or /memory

Description:
------------
Setting CURLOPT_STDERR to fopen('php://output', 'w') will write curl debug
output.

One would await that setting it to fopen('php://memory', 'w') would store
it in the memory and it would be available after a rewind. That is not the
case, instead, a warning is raised:

Warning: curl_setopt(): supplied argument is not a valid File-Handle
resource in

is php://output a valid file handle resource?

This is very confusing and it should be possible to store the output in the
memory.

Test script:
---------------
$handle=curl_init('http://google.com');
curl_setopt($handle, CURLOPT_STDERR, fopen('php://output'));
curl_exec($handle);
curl_setopt($handle, CURLOPT_STDERR, $output=fopen('php://temp'));
curl_exec($handle);
rewind($output);
var_dump($output);


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



Thread (8 messages)

« previous php.bugs (#154261) next »