ID:               43700
 User updated by:  skrol29 at freesurf dot fr
 Reported By:      skrol29 at freesurf dot fr
-Status:           Open
+Status:           Closed
 Bug Type:         Output Control
 Operating System: any
 PHP Version:      5.2.5
 New Comment:

there is no bu in this process


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

[2007-12-29 01:02:34] skrol29 at freesurf dot fr

Description:
------------
I call two functions, the one after the other. The first one is doing
an output redirection using ob_start(). The second one is just modifying
a variable. It is like the second function is executed just after the
ob_start() without waiting for the end of the first function. The second
function is called on an arbitrary local variable, for which the
serialization becomes inconsistent.

This bug has been found on PHP 5.2.5, but also 5.2.4, on Linux, Windows
XP and Vista.

Reproduce code:
---------------
$Txt = '';
f_Action1($Txt);
f_Action2($Txt);
echo $Txt;

function f_Action1(&$Txt) {
  $z = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  echo "value before={".$z."} <br>\r\n";
  ob_start();
  echo "value after={".$z."} <br>\r\n"; // Bug here : it is like
Action2() has been applied to $z
  echo "serialize={".serialize($z)."} <br>\r\n"; // Bug here : the
serialization is inconsistent between size and value.
  $Txt = ob_get_contents();
  ob_end_clean();
}

function f_Action2(&$Txt) {
  $Txt = str_replace('ABCDEFGHIJKLMNOPQRSTUVWXYZ','abc',$Txt);
}


Expected result:
----------------
value before={ABCDEFGHIJKLMNOPQRSTUVWXYZ}
value after={ABCDEFGHIJKLMNOPQRSTUVWXYZ}
serialize={s:26:"ABCDEFGHIJKLMNOPQRSTUVWXYZ";} 

Actual result:
--------------
value before={ABCDEFGHIJKLMNOPQRSTUVWXYZ}
value after={abc}
serialize={s:26:"abc";} 


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


-- 
Edit this bug report at http://bugs.php.net/?id=43700&edit=1

Reply via email to