Edit report at https://bugs.php.net/bug.php?id=48725&edit=1

 ID:                 48725
 Comment by:         dtrebbien at gmail dot com
 Reported by:        slusarz at curecanti dot org
 Summary:            Support for flushing in zlib stream
 Status:             Open
 Type:               Bug
 Package:            Streams related
 Operating System:   Linux
 PHP Version:        5.2.10
 Block user comment: N
 Private report:     N

 New Comment:

See also: 
http://stackoverflow.com/questions/7508762/using-zlib-filter-with-a-socket-pair/


Previous Comments:
------------------------------------------------------------------------
[2009-10-23 12:25:10] [email protected]

It's related, not same. :)

------------------------------------------------------------------------
[2009-10-22 21:40:37] slusarz at curecanti dot org

I don't think this is related to bug #49816.  Turning off zlib output 
compression (by adding "ini_set('zlib.output_compression', 'Off');" to the top 
of the test script)doesn't alter the results from the test script previously 
reported.

------------------------------------------------------------------------
[2009-10-19 15:15:51] [email protected]

See also bug #49816

------------------------------------------------------------------------
[2009-07-14 03:10:46] slusarz at curecanti dot org

<?php

// 16,000 bytes
$text = str_repeat('0123456789abcdef', 1000);

$temp = fopen('php://temp', 'r+');
stream_filter_append($temp, 'zlib.deflate', STREAM_FILTER_WRITE);
fwrite($temp, $text);

rewind($temp);
fpassthru($temp);

print "Location: " . ftell($temp) . "\n";

fclose($temp);

// Expected: compressed data; Location = some non-zero integer
// Actual: No data output; Location = 0

------------------------------------------------------------------------
[2009-06-29 20:03:00] slusarz at curecanti dot org

Description:
------------
There does not seem to be any support for flushing data in a zlib compression 
stream.  Not sure if this is an omission, something obvious that I am missing 
(and may not be in the documentation), or the fact that the zlib stream filter 
does not support socket operation.

Reproduce code:
---------------
$stream = stream_socket_client([...]);

// Login to remote server & enable compression remotely (e.g. implementation of 
IMAP COMPRESS extension - RFC 4978)

stream_filter_append($stream, 'zlib.deflate', STREAM_FILTER_WRITE);
stream_set_write_buffer($stream, 0);
fwrite($stream, 'Testing');
fflush($stream);

// tcpdump confirms that nothing is sent from the PHP server to the remote 
server.  Can confirm that upon socket timeout, the pending data is sent.

// Similarly, compressed data from incoming stream is not available either.
stream_filter_append($stream, 'zlib.inflate', STREAM_FILTER_READ);
$in = fread($stream, 8192);

// fread() on $stream will timeout.



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



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

Reply via email to