From: hack988 at gamil dot com
Operating system: CentOS release 5
PHP version: 5.2.6RC5
PHP Bug Type: Apache2 related
Bug description: more byte output in flush function
Description:
------------
flush function output for html body in some times.it disappear at begin
and end of html body.
exsample code:
<?php
define('XML_RPC', TRUE);
$XMLRPCVersion="1.0";
flush();
exit;
....more code
?>
it display:
0
<?php
define('XML_RPC', TRUE);
$XMLRPCVersion="1.0";
ob_flush();
exit;
....more code
?>
it display nothing
compare with to http headers i found that:
"Content-Length: 0"
exist when use ob_flush but not exist in flush
so i add this in my php codes like this
<?php
define('XML_RPC', TRUE);
$XMLRPCVersion="1.0";
header("Content-Length: 0");
flush();
exit;
....more code
?>
now all thing is work will!
i download php source code an compare flush with ob_flush.
in ob_flush:
if (send_buffer) {
if (just_flush) { /* if flush is called prior to proper end,
ensure
presence of NUL */
final_buffer[final_buffer_length] = '\0';
}
OG(php_body_write)(final_buffer, final_buffer_length TSRMLS_CC);
}
in flush:
if (sapi_module.flush) {
sapi_module.flush(SG(server_context));
return SUCCESS;
} else {
return FAILURE;
}
i can't understand well with this codes but i think maybe some buffer is
not zeromemory befor used.
--
Edit bug report at http://bugs.php.net/?id=44725&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=44725&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=44725&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=44725&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=44725&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=44725&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=44725&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=44725&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=44725&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=44725&r=support
Expected behavior: http://bugs.php.net/fix.php?id=44725&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=44725&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=44725&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=44725&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=44725&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=44725&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=44725&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=44725&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=44725&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=44725&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=44725&r=mysqlcfg