SearchSearch   

preg_replace_callback() is segfaulting in 4.4.4, length re..

 
   Webmaster Forums (Home) -> PHP RSS
Next:  Debugging "Specified Module Not Found" ..  
Author Message
Stephen Kay

External


Since: Mar 31, 2006
Posts: 49



(Msg. 1) Posted: Tue Jan 02, 2007 5:07 am
Post subject: preg_replace_callback() is segfaulting in 4.4.4, length related?
Archived from groups: comp>lang>php (more info?)

I'm having a problem where I changed hosts, went from php 4.1.2 to php
4.4.4, and now preg_replace_callback() is segfaulting when I pass it html
that is longer than 2732 bytes. This code has worked for a long time on a
different server.

Basically, I am reading an html page template into a variable with fread().

I then am doing this, which is code taken from a user example on the eval()
php manual page, which I have used successfully for quite awhile:

What it does is evaluate mixed html and php code, and output to browser. You
call it like:

eval_mixed($string);

function eval_mixed_helper($arr){
return ("echo stripslashes(\"".addslashes($arr[1])."\");");
}

function eval_mixed($string){

$string = "<? ?>".$string."<? ?>";
$string = preg_replace("/<\?=\s+(.*?)\s+\?>/", "<? echo $1; ?>",
$string);
$string = str_replace('?>', '', str_replace( array('<?php', '<?'),
'', preg_replace_callback( "/\?>((.|\n)*?)<\?(php)?/", "eval_mixed_helper",
$string) ) );

return eval($string);
}

If the template that I read into $string is 2732 or less bytes, it works
like it always did. If it is 2733 or greater bytes, it segment faults.

I found this report in the bug database, but it's really old. It sounds like
the same thing, though:

http://bugs.php.net/bug.php?id=25754
Bug #25754 preg_replace() and preg_replace_callback() crash with long
matches

Anybody know anything about this?

Again, it worked fine on the older php on a different server.
I don't really know what to do to proceed with this, it's a bit out of my
league.

Any advice would be greatly appreciated!

--
Stephen Kay
Karma-Lab sk DeleteThis @karma-lab.NOSPAM.com
^^^^^^^
Back to top
Display posts from previous:   
       Webmaster Forums (Home) -> PHP
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum