[Solar-talk] Narrowing down the apache crash bug
Andrew Shell
andrew at andrewshell.org
Tue Sep 19 14:44:47 PDT 2006
So I ran it under the command line and the CLI crashes. I upped the
memory limit to 64MB and it still crashed.
This is what's weird...
I changed the code so instead of just using str_repeat at the top to
make a for loop so I could have each test would be numbered.
What happens is that the code completes. The preg_replace is done and
echoed at the end and then it crashes.
Here is the updated code...
<?php
$text = '';
for ($i = 0; $i < 500; $i++) {
$text .= "<p>test{$i}\n</p>\r\n"; // Crash
}
$result = preg_replace("{
( # save in $1
^ # start of line (with /m)
<(p) # start tag = $2
\\b # word break
(.*\\n)*? # any number of lines, minimally matching
</\\2> # the matching end tag
[ \\t]* # trailing spaces/tabs
(?=\\n+|\\Z) # followed by a newline or end of
document
)
}xm",
'x',
$text
);
echo $result;
?>
Paul M Jones wrote:
> On Sep 19, 2006, at 3:53 PM, Andrew Shell wrote:
>
>
>> I've tried to write a stand alone script with as little code as
>> possible
>> to replicate the error.
>> Here's what I got.
>> It doesn't seem to be a problem with preg_replace_callback or what we
>> are returning. It seems to be a combo of
>> whitespace chars and number of lines
>>
>
> Dude, good detective work. This almost looks like a memory error,
> caused by recursion in the PCRE parser, but obviously I'm not sure.
> This will sounds dumb, but: can you run the tests from the command
> line (not through the web server) and see what happens? Secondarily,
> can you up the memory limit in PHP and see if that helps?
>
> Let me know what you find out.
>
>
>
> --
>
> Paul M. Jones <http://paul-m-jones.com>
>
> Solar: Simple Object Library and Application Repository
> for PHP5. <http://solarphp.com>
>
> Savant: The simple, elegant, and powerful solution for
> templates in PHP. <http://phpsavant.com>
>
>
> _______________________________________________
> solar-talk mailing list
> solar-talk at lists.solarphp.com
> http://mail.killersoft.com/mailman/listinfo/solar-talk
>
More information about the solar-talk
mailing list