|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-08-03 15:49 UTC] vonubrog at gmail dot com
[2019-03-26 16:29 UTC] mike@php.net
[2019-03-26 17:28 UTC] mike@php.net
-Status: Open
+Status: Verified
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 02:00:01 2025 UTC |
Description: ------------ When using CURLOPT_FILE, file position indicator stays in the end when the handle is a temporary stream. However the indicator is rewinded to 0 when the handle is a regular file (which seems to be a wrong behaviour). Tested in PHP 7.0.5 and 5.6.20. Test script: --------------- <?php function test($filename) { echo $filename, PHP_EOL; $fh = fopen($filename, 'w'); $curl = curl_init('http://php.net/'); curl_setopt($curl, CURLOPT_FILE, $fh); curl_exec($curl); echo ' fstat size: ', fstat($fh)['size'], PHP_EOL; echo ' ftell: ', ftell($fh), PHP_EOL; } test('regular-file.tmp'); test('php://temp'); Expected result: ---------------- regular-file.tmp fstat size: 19371 ftell: 19371 php://temp fstat size: 19371 ftell: 19371 Actual result: -------------- regular-file.tmp fstat size: 19371 ftell: 0 php://temp fstat size: 19371 ftell: 19371