Re: Memory corruption bug

From: Date: Wed, 20 May 2015 13:30:42 +0000
Subject: Re: Memory corruption bug
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-324922@lists.php.net to get a copy of this message
plz consider also sharing with the wp team thx On Wed, May 20, 2015 at 10:58 AM, Tiago Marques <bugs@tmarques.com> wrote: > Hi there, > > I've been running a PHP server with Wordpress for a good while now, > when I stumbled upon a problem uploading some posts, where the script > would enter a loop and run till it crashed, running out of process > memory. > > I managed to create a test case based on Wordpress's code and my HTML > content, then narrowed down the loop and variables that are being > (apparently) corrupted in some way: > > The relevant variables are $i and $l, which at the time the code blows > up, store 68 and 71, as integers. These are summed as a parameter to > substr() in the loop, which gets a float instead of the value "139". > The rest of the code runs a $text var and a $newtext var, upon which > the force_balance_tags() function from formatting.php iterates. > These are the dumps at the time when the code does bad things: > > $i: int(68) > $l: int(71) > $i + $l: float(9.7837007760303E+18) > > Only the sum gives wrong results, the other operations like > subtraction and multiplication produce accurate results. This only > happens in this iteration of the loop. > > Previously, I managed to circumvent the bug by copying the $text > variable into another variable, just before the line with the two > substr() operations on $text, which was were the code was having > problems. After a while of successfully posting my edits without > knowing anything more about the problem, I noticed this might be a > more widespread problem when Wordpress started producing garbage HTML > on some strings, in other places, and went looking deeper. > > I tried to find a way to maybe debug this but have no idea of how to > look at process memory in php, or what to look for. I have a test case > to submit but am unsure if I should file a bug or if I'm posting in > the right mailing list at all. > > Any help is greatly appreciateed. > > Best regards, > Tiago Marques > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- <http://www.facebook.com/martin.kaspar.547> [image: gplus_Seiten_Signatur] <https://plus.google.com/u/0/104428351748591530426>

« previous php.general (#324922) next »