Meni se isto to dešavalo, ali samo na Win platformi. Kombinacija je MySQL/PHP. Dešava se samo kada se regexp primjenjuje na dugačak tekst.
Koristim sljedeće:
Code:
function make_URL($matches) {
global $filename;
if ($_GET['more']==1)
$tmp="<a href=\"$filename?word=".urlencode($matches[1])."&more={$_GET['more']}\">{$matches[1]}</a>";
else
$tmp="<a href=\"$filename?word=".urlencode($matches[1])."\">{$matches[1]}</a>";
return $tmp;
}
function BBdecode($text) {
$text=str_replace("\n","<br>\n", $text);
$text=preg_replace('/\[list=(a|1)\]((.|\n)*)\[\/list\]/U',"<ol type=\"\\1\">\\2</ol>",$text);
/* ne dozvoljava ugniježdene liste */
$text=str_replace("[*]","<li>",$text);
$text=str_replace("[b]","<span style=\"font-weight: bold\">",$text);
$text=str_replace("[/b]","</span>",$text);
$text=str_replace("[i]","<span style=\"font-style: italic\">",$text);
$text=str_replace("[/i]","</span>",$text);
$text=str_replace("[u]","<span style=\"text-decoration: underline\">",$text);
$text=str_replace("[/u]","</span>",$text);
$text=preg_replace('/\[color=(\#[0-9a-fA-F]{1,6})\]/',"<span style=\"color: \\1\">",$text);
$text=str_replace('[/color]','</span>',$text);
$text=preg_replace_callback("/\[see\](.*)\[\/see\]/U", "make_URL", $text);
return $text;
}
Nisam siguran da je do
preg_replace_callback funkcije (dobijam samo
Segmentation fault).
Iste funkcije na istom tekstu, na Linuxu ne prave ovu grešku. Na Win je PHP 4.3.2, a na Linuxu je PHP 4.3.6