|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-01-09 13:59 UTC] skrol29 at freesurf dot fr
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
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";}