Re: post 5.3.0 development

From: Date: Sat, 27 Jun 2009 00:40:48 +0000
Subject: Re: post 5.3.0 development
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-44507@lists.php.net to get a copy of this message
After some conversations with Rasmus on IRC i've come up with the following patch: http://ilia.ws/patch/curl.txt This basically forces flush() on the header & output streams right after curl_exec(), this ensures that the data retrieved by curl is synched to disk. The patch is also self contained to curl so no external elements are affected by the patch. Ilia Alshanetsky On 26-Jun-09, at 8:24 PM, Rasmus Lerdorf wrote:
Just to keep the list in synch with the irc discussion. I pointed out that this is only half of the fix. The refcount still prevents fclose from flushing the data, so if you do: $url = 'http://slowgeek.com/test.xml'; $cfile = 'out.xml'; $ch = curl_init($url); curl_setopt($ch, CURLOPT_FILE, $fp = fopen($cfile,'w')); $status = curl_exec($ch); fclose($fp); $data = file_get_contents($cfile); var_dump($data); // 0 bytes here curl_close($ch); $data = file_get_contents($cfile); var_dump($data); // full contents here I still think we need to look at doing a flush on an fclose which doesn't reach the stream destructor due to refcount issues. Can anybody think of any side-effects of a flush on a stream close? -Rasmus


« previous php.internals (#44507) next »