quercus php and RegexpException: Delimiter A in regexp 'Array' must not be backslash or alphanumeric

116 views Asked by At

I'm new here, I know the error in title has been already discussed here but I didn't find any answer to my problem. I'm trying to make phpbb3 work on my server with tomcat6 using quercus for php. Everything is ok except bbcode.php module that give me an error (in title) on line 112 that is:

$message = preg_replace($preg['search'], $preg['replace'], $message);

I asked for help in phpbb3 forum but they told me the issue is from quercus.

Still never find an answer in quercus mailing list.

I'dd like to know how can I change that line with another that do the same job.

Thanks in advance.

edit:

Maybe I found where the problem starts:

'preg' => array(
                        '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#ise' => "\$this->bbcode_second_pass_quote('\$1', '\$2')"

the point is that this code works perfectly in most cases maybe is Quercus that need a different sintax.

You can find the full bbcode.php here: http://ftp.phpbb-fr.com/public/cdd/phpbb3/3.0.10/nav.html?includes/bbcode.php.source.html

1

There are 1 answers

4
Jason McCreary On

A regular expression must be delimited. Generally the delimiter is the slash. PHP also allows an alphanumeric delimiter as well.

$preg["search"] is not delimited and likely just regex. It needs to be: /regex/, #regex#, or |regex|, etc.

The following code throws the error:

echo preg_replace(array('1', '2'), array('one', 'two'), '1 2');

Should be:

echo preg_replace(array('/1/', '/2/'), array('one', 'two'), '1 2');

Welcome to StackOverflow.