'Unable to call custom replacement function' error when viewing content as admin
adrinux - January 14, 2009 - 10:35
| Project: | Typogrify |
| Version: | 5.x-1.0-beta1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | mikl |
| Status: | closed |
Jump to:
Description
Full error message:
preg_replace_callback() [<a href='function.preg-replace-callback'>function.preg-replace-callback</a>]: Unable to call custom replacement function in /var/www/multi5/sites/all/modules/typogrify/typogrify.class.php on line 101.The error appears multiple times when it does appear, but is sporadic, it doesn't always appear when content is viewed (possibly because a cached version is viewed second time around?).

#1
A workaround is disabling Typogrify's 'Wrap caps' feature, since the bug appears to be located in that function. Disabling wrap caps removes the error message.
#2
Same in version 6.x-1.0-beta1
#3
Hmm, what PHP version is this?
I can't reproduce this, but I have an idea:
In typogrify.class.php, try changing "protected" to "public" on lines 38 and 111 and see if that doesn't resolve it…
#4
Ok. This fixed the error message for my 6.x-1.0-beta1.
Thanks for the fast reply.
Did you want a patch for this small change? :-)
#5
Ok, thank you for testing – I've just committed the fix to CVS.
I think I'll wait a couple of days to see if more issues crop up and then roll a beta2 release Friday or so :)
#6
Ok... maybe we see us at the DrupalCamp in Cologne... :)
#7
Yeah, I'll be holding a couple of sessions, so feel free to stop by and say hi :)
#8
PHP is Debian etch's current version: 5.2.0-8+etch13, 5.2 basically.
And no, changing lines 38 and 111 doesn't help I'm afraid. Even after clearing the cache.
I do notice that the errors only appear on the first view (of a page where an input format using typogrify has been used to create content), after a refresh they disappear. I'm wondering if TomMynd spoke a little too soon...
#9
Ooops. Setting it back to active.
#10
I made the suggested changes in typogrify.class.php and after some cache clearing the error message is no longer displayed. I will do some more testing and maybe it pops up again.
I run Drupal 6 and thererfore the version 6.x-1.0-beta1 of the module but this error is IMO not directly related to Drupal.
The PHP-Version is 5.2.0-8+etch13 - so this is the same version as on your site.
#11
Yeah, it seems like some sort of PHP issue. I wish I knew more, but to my knowledge, static method calls are supported way back to PHP4.
#12
OK. To summarise:
- This error possibly only occurs with Debian etch's PHP 5.2 release.
- It appears to be fixed for Typogrify Drupal-6.x HEAD (this will make it into beta 2).
- It doesn't appear to be fixed for Drupal-5.x.
Best advice for Drupal-5.x users like me that don't have time to chase this bug down is probably:
1) Disable Typogrify's 'Wrap caps' feature
2) Upgrade to Drupal-6 :)
[There is some discussion on the mediawiki wiki about a similar sounding issue, see 'preg-replace-callback error (resolved)': http://www.mediawiki.org/wiki/Extension_talk:Simple_Security#preg-replac...
which refers to this ancient bug in PHP http://bugs.php.net/bug.php?id=39257
I'm wondering if I need to tweak my php ini to get more in depth error messages?]
#13
Hi,
so... I tested a little bit more and the error is popping up sporadic. :-( It's currently very hard for me to tell the exact steps to reproduce this. I will try and get a closer look to it in the afternoon, cause now I have to work a little bit on other things. :-)
#14
Hi,
so... I also disabled the "Wrap caps"-feature at the end of testing. When I clear the cache this preg_replace_callback error pops up sometimes - not on all pages! All other functionality is ok.
There is the same call with preg_replace_callback in "initial_quotes" and this works fine, so I don't believe that this is php's fault. But the error message has nothing more to say.
#15
Well this is really annoying. I have the same error and I am on 5.x-1.0-beta2. I dit switch off the Wrap Caps feature but it didnt help. It does seem to appear on random pages. Now it appears on top my the page where I take in donations. Sometimes it appears in several instances.I am on PHP 5
#16
Okay, thanks to some nice guys on IRC, i found out that the callback syntax has actually been changed in PHP 5.2.3, so that might be the cause of this issue not appearing on my end: http://dk2.php.net/callback
I've tried changing the callbacks to the old style. A new dev snapshot should appear soon (I've committed it to CVS), so if you have the time to try it out and see if that fixed the issue, it'd be great :)
#17
Hi, I checked out the version from CVS and voila - everything is working as espected. No more errors from preg_replace_callback on screen and the formatting is done.
This is version 6.x-1.x-dev of the module.
Great work and thank you for your patience... :-)
#18
#17: We aim to please ;)
I think this issue is fixed now, but I'm going to wait a few more days before calling it a beta :)
#19
I installed the dev version of jan 21 2009 and that seems to have solved the problem.
Thanks
#20
Okay, since no reports to the contrary have cropped up, I'm considering this fixed and releasing beta3 on both branches.
Thanks for your help everyone.
#21
Automatically closed -- issue fixed for 2 weeks with no activity.