ID:               16341
 Updated by:       [EMAIL PROTECTED]
-Summary:          ob_clean and ob_gzhandler dont work together
-Reported By:      [EMAIL PROTECTED]
+Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Closed
 Bug Type:         Output Control
-Operating System: linux,apache1319
+Operating System: Linux (Debian)
-PHP Version:      4.1.2
+PHP Version:      4.1.1
 New Comment:

This bug is fixed in HEAD.
Fix is included in PHP 4.2.0.


Previous Comments:
------------------------------------------------------------------------

[2002-03-29 04:12:25] [EMAIL PROTECTED]

this bug-report really is for latest CVS-HEAD as of 2002-03-29.

using this script with latest cvs the output appears incorrect to me,
b/c "barbarbar" is not encoded.
if you remove ob_clean() everything is encoded just fine.

<?php

ob_start('ob_gzhandler');
echo "foo";
ob_clean();
echo "barbarbar";

?>

upon request this is logged to error_log:

PHP Warning:  String is not zero-terminated (~) (source:
/src/cvs/php4-head/Zend/zend_execute_API.c:274) in
/public_html/test/ob/test3.php on line 5 

/public_html/test/ob/test3.php(5) : Warning - String is not
zero-terminated (~) (source:
/src/cvs/php4-head/Zend/zend_execute_API.c:274)

using ob_gzhandler i quite expect a binary non zero-terminated string
and this warning is not a surprise. but i am surprised about it being
issued on ob_clean(); which, simplified, is just a reset doing 
text_length=0 on the active output buffers. it doesn't really have to
touch and use the buffers to do that, does it?

the above script sends the following response including
content-encoding: gzip, but without actually encoding
it:

X-Powered-By: PHP/4.3.0-dev
Content-Encoding: gzip
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html

d4 
<br />
<b>Warning</b>:  String is not zero-terminated (~) (source:
    /src/cvs/php4-head/Zend/zend_execute_API.c:274) in
<b>/public_html/test/ob/test3.php</b> on line <b>5</b><br />
barbarbar
0


for now i'm working around this by using a logic like this, proving
that ob_clean works, but not with ob_gzhandler.

<?php
ob_start();  
echo "foo";
ob_clean();
echo "barbarbar";

$b = ob_get_contents();
ob_end_clean();

ob_start('ob_gzhandler');
print $b;
?>


regards,
  -lukas
~




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


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

Reply via email to