ob_flash() and ob_clean() destroy output handler
| Bug #24951 | ob_flash() and ob_clean() destroy output handler | ||||
|---|---|---|---|---|---|
| Submitted: | 2003-08-05 08:31 UTC | Modified: | 2003-08-11 00:52 UTC | ||
| From: | d dot stogov at turck dot spb dot ru | Assigned: | iliaa (profile) | ||
| Status: | Closed | Package: | Output Control | ||
| PHP Version: | 4.3.3RC2 | OS: | Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2003-08-05 08:31 UTC] d dot stogov at turck dot spb dot ru
Description:
------------
The C function "php_end_ob_buffer" from "main/output.c" destroys output_handler on first call so the second call to output_handler is not possible. "php_end_ob_buffer" is called by "ob_flush()" and "ob_clean()" those must not destroy output handler.
Look into line 250:
zval_ptr_dtor(&OG(active_ob_buffer).output_handler);
The same error is in PHP-4.3.3RC2 too.
Reproduce code:
---------------
<?php
function test($s,$mode) {
return (($mode & PHP_OUTPUT_HANDLER_START)?"[":"").
$s.
(($mode & PHP_OUTPUT_HANDLER_END)?"]\n":"");
}
function t1() {
ob_start("test");
echo "Hello from t1 1 ";
echo "Hello from t1 2 ";
ob_end_flush();
}
function t2() {
ob_start("test");
echo "Hello from t2 1 ";
ob_flush();
echo "Hello from t2 2 ";
ob_end_flush();
}
function t3() {
ob_start("test");
echo "Hello from t3 1 ";
ob_clean();
echo "Hello from t3 2 ";
ob_end_flush();
}
t1(); echo "\n";
t2(); echo "\n";
t3(); echo "\n";
?>
Expected result:
----------------
[Hello from t1 1 Hello from t1 2 ]
[Hello from t2 1 Hello from t2 2]
[Hello from t3 2]
Actual result:
--------------
[Hello from t1 1 Hello from t1 2 ]
[Hello from t2 1 Hello from t2 2
Hello from t3 2
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2003-08-05 11:05 UTC] sniper@php.net
[2003-08-08 01:09 UTC] d dot stogov at turck dot spb dot ru
[2003-08-08 18:44 UTC] iliaa@php.net
[2003-08-11 00:52 UTC] d dot stogov at turck dot spb dot ru