Im getting some odd error messages on a site of mine. The strange thing is I have a local copy which works fine and this one which isnt: you can see the error at the top of the homepage (and only the homepage) at http://sourceymonkey.com/
warning: preg_replace(): Unknown modifier 'j' in modules/delicious/delicious.module on line 831.
warning: preg_replace(): Unknown modifier 'w' in modules/delicious/delicious.module on line 834.
warning: preg_replace(): Unknown modifier 'j' in modules/delicious/delicious.module on line 831.
and that line number is..
830 if (!preg_match('/<.+>/',$text)) {
831 $text = preg_replace('/(\b'.$tag.'\b)/i','$1'.$deliciousLink,$text);
832 }
833 else {
834 $text = preg_replace('/(?<=>)([^<]+)?(\b'.$tag.'\b)/i','$1$2'.$deliciousLink,$text);
835 }
Comments
Comment #1
merlinofchaos commentedHmm. It looks to me like there are \ characters in your tags? In fact, there's a few bits of punctuation that could cause problems like this, now that I look at the code. Could you give me a var_export of the $tags variable in that function?
Comment #2
willwade commented\n";
}
else {
$text = preg_replace('/(?<=>)([^<]+)?(\b'.$tag.'\b)/i','$1$2'.$deliciousLink,$text);
print "
preg_replace('/(?<=>)([^<]+)?(\b'.$tag.'\b)/i','$1$2'.$deliciousLink,$text)\n";}
see http://sourceymonkey.com for the output
Comment #3
willwade commentedjust edited the printing a bit.
in short its having problems with slashes and tags with "-"
e.g.
<code>warning: preg_replace(): Unknown modifier 'w' in /home/helpmonk/public_html/modules/delicious/delicious.module on line 831.tag: phone-s/w deliciousLink:
, text:
tag: java/jsp deliciousLink:
, text:
warning: preg_replace(): Unknown modifier 'w' in /home/helpmonk/public_html/modules/delicious/delicious.module on line 837.[else]tag: phone-s/w deliciousLink:etc..
cheers
Comment #4
merlinofchaos commentedTry this:
The only change is the addition of preg_quote()
Comment #5
willwade commentedIt sadly doesnt - and I havent got a clue why. Your quite right. It should..
Here's my current code:
still looking..
Comment #6
willwade commentedOk, the only way I can get the error messages suppressed is if I do the following:
Im not sure thats the best approach - it will do some strange things to a system where preg_quote actually works!
no idea why its not working sadly :(
Comment #7
merlinofchaos commentedOh! I'm a dork!
Use:
preg_quote doesn't get the / by default, you have to add it. I need to read the documentation more closely.
Comment #8
willwade commentedcool
another one bites the dust.. :)
Comment #9
merlinofchaos commentedCommitted to HEAD.
Comment #10
merlinofchaos commentedI'm re-opening this. There's another side-effect of having '/' in tags -- you can't link to them. Since it's two very different symptoms of the same basic problem, I'm keeping it in this bug.
Comment #11
merlinofchaos commentedNew bug opened for the remaining problem after all.
Comment #12
(not verified) commented