From:             [EMAIL PROTECTED]
Operating system: linux,apache1319
PHP version:      4.1.2
PHP Bug Type:     Output Control
Bug description:  ob_clean and ob_gzhandler dont work together

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 bug report at http://bugs.php.net/?id=16341&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16341&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16341&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16341&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16341&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16341&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16341&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16341&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16341&r=submittedtwice

Reply via email to