Bug #53006 [Opn->Fbk]: stream_get_contents offset max is 1165

From: Date: Fri, 08 Oct 2010 00:29:37 +0000
Subject: Bug #53006 [Opn->Fbk]: stream_get_contents offset max is 1165
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155009@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53006&edit=1

 ID:                 53006
 Updated by:         cataphract@php.net
 Reported by:        poulpillusion at free dot fr
 Summary:            stream_get_contents offset max is 1165
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Streams related
 Operating System:   Linux Aptosid
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Your script works here. Outputs:

«9
320
32»

As to the wireshark log, what I need is not the data of the
conversation, it's the packets that came and their size. Only that can
shed light on this problem.


Previous Comments:
------------------------------------------------------------------------
[2010-10-08 00:31:33] poulpillusion at free dot fr

Here is a sample code you can paste into a PHP file :

<?php
// this does not work : 1166 seems to big... try with 1165 and it will
work !
$url = 'http://www.nocturne-jdr.fr/toto.txt';
$handle = fopen($url, 'rb');
echo stream_get_contents($handle, 8, 1166);
?>

I dumped the conversation with wireshark but I don't know which parts
are the "relevant" ones... Here it is :
http://www.nocturne-jdr.fr/capture.log

------------------------------------------------------------------------
[2010-10-07 14:05:01] cataphract@php.net

You need to give more details:

* The actual url you're using.
* If it's a remote file, a wireshark dump of the conversation would also
be useful (please trim it to only the relevant parts!).

------------------------------------------------------------------------
[2010-10-07 01:09:19] poulpillusion at free dot fr

Description:
------------
In the stream_get_contents function, the offset parameter's max value is
1165. Any upper value will block the script.

Test script:
---------------
// This will work...
$handle = fopen($url, 'rb');
echo stream_get_contents($handle, 8192, 1165);

// This will not work... the script will wait forever.
$handle = fopen($url, 'rb');
echo stream_get_contents($handle, 8192, 1166);


Expected result:
----------------
I expect this function not to wait if $offset + 8192 < $filesize



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53006&edit=1


Thread (12 messages)

« previous php.bugs (#155009) next »