ID: 24951 Updated by: [EMAIL PROTECTED] Reported By: d dot stogov at turck dot spb dot ru -Status: Open +Status: Analyzed Bug Type: Output Control Operating System: Linux PHP Version: 4.3.3RC2 -Assigned To: +Assigned To: iliaa New Comment:
The following patch appears to address the problem, please try it and let me know if it works for you as well. http://bb.prohost.org/bug24951.txt Previous Comments: ------------------------------------------------------------------------ [2003-08-08 01:09:54] d dot stogov at turck dot spb dot ru Seems to work with 4.3.3RC3 on Windows, but I think it is not fixed. See into code of "php_end_ob_buffer". You destroy "output_handler" on each flush. (main/output.c:250) The second call to "php_end_ob_buffer" will work only if memory which was used for "output_handler" was not changed. May be I am not right, but check it. ------------------------------------------------------------------------ [2003-08-05 11:05:28] [EMAIL PROTECTED] Take that back, with latest CVS I get this output: [Hello from t1 1 Hello from t1 2 ] [Hello from t2 1 Hello from t2 2 ] Hello from t3 2 ] AFAIK, this is the expected output too..the ------------------------------------------------------------------------ [2003-08-05 08:31:35] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24951&edit=1
