ID:               24951
 Updated by:       [EMAIL PROTECTED]
 Reported By:      d dot stogov at turck dot spb dot ru
-Status:           Assigned
+Status:           Closed
 Bug Type:         Output Control
 Operating System: Linux
 PHP Version:      4.3.3RC2
 Assigned To:      iliaa
 New Comment:

This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2003-08-08 11:49:39] [EMAIL PROTECTED]

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

------------------------------------------------------------------------

[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

Reply via email to