php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16341 mysql and header() problem prevent saving session vars(?)
Submitted: 2002-03-29 04:12 UTC Modified: 2002-03-29 06:09 UTC
From: lukas at edeal dot de Assigned:
Status: Closed Package: Output Control
PHP Version: 4.1.1 OS: Linux (Debian)
Private report: No CVE-ID: None
 [2002-03-29 04:12 UTC] lukas at edeal dot de
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
~



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-29 06:09 UTC] yohgaki@php.net
This bug is fixed in HEAD.
Fix is included in PHP 4.2.0.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 16:01:29 2024 UTC