Schonhose

Home | PP Addons| Gallery | Photoblog

Upgrade to WordPress 2.8 didn’t go as expected

June 23, 2009
bug.gif

Much to my amazement the upgrade of WordPress 2.7 to WordPress 2.8 didn’t quite go as expected on my blog. Somehow after the upgrade all content of my posts, pages and comments on the output of my blog just disappeared into thin air.

The first thing I did was checking the database and I was relieved to see the content was actually still there. Then the debugging session began: deactivating all plugins and switching back to the default template showed no improvement. Hence, the conclusion it was not template or plugin related.

So there has to be something else happing with the core files. After some more debugging, with the help of the WordPress IRC channel, I found out which filter was responsible for the disappearance of my content, a WP filter called: convert_smilies. The obvious step to show the content again is to remove the filter in question by adding the following lines to your wp-config.php:
remove_filter('the_content', 'convert_smilies');
remove_filter('the_excerpt', 'convert_smilies');
remove_filter('comment_text', 'convert_smilies');

At least this will show the textual output again, but smilies are not translated to images. While I’m still debuging the issue I’ll continue to post my findings in this post.

Further analysis and subsequent var_dumps revealed the most likely source of the problem. Between WP 2.7.1 and WP 2.8.x the replacement of the smileys has been rewritten to use preg_replace_callback instead of preg_replace. The offending line, which isn’t working on my setup is the line where the actual replacement of textual smileys to graphics take place:
$content = preg_replace_callback($wp_smiliessearch, 'translate_smiley', $content);
The variable $content is NULL after that particular call.

So I turned on the WP_DEBUG variable by adding the following statement to the wp-config.php file:
define ('WP_DEBUG',true);
After reviewing the page again I was greeted with a warning regarding the offending code of the preg_replace_callback:

Warning: preg_replace_callback() [function.preg-replace-callback]: Unknown modifier ‘|’ in /wp-includes/formatting.php on line 1347

This warning, although I don’t have a solution yet, is most likely the cause of the empty content variable.

UPDATE: Problem solved
Some of the smileys in the $wpsmiliestrans array configured in the wp-config file did actually work while others were not. Thanks to some pointers from Jay and the help from some developers on IRC we managed to track the problem down.

It all has to do with escaping certain characters before entering them into a regular expression. WordPress uses the function preg_quote for this. As stated in the manual the special regular expression characters are: . \ + * ? [ ^ ] $ ( ) { } = ! < > | :. As you can see a very nice list, not including /, which in my case is a delimiter that does needs to be escaped.

So if we look at the code of preg_quote and tell the function to escape ‘/’ as well, all is fine. Anyway, the issue has been fixed in the nightly builds of WP.

Categories
Website
Tags
bug, Wordpress

« Back on track again Awesome marriage proposal »

One response

The best information i have found exactly here. Keep going

LnddMiles | July 21, 2009

The best information i have found exactly here. Keep going Thank you

Navigation

  • Miscellaneous
  • Photography
  • Programming
  • Website

Countdown:

    No dates present

Tagcloud

3g addon allergic rhinitis backup basketball battery replacement Bob Marley budweiser bug Defensio design ebay exposition googlemaps HDR King layout update Lightroom Miscellaneous music paypal personal photoblog Photography Photoshop PHP Pixelpost pollens preview quote rant Touch UNC update videoclip vote Website Wordpress youtube

Flickr: latest uploads

Broeltorens, KortrijkNarcissus50 point dart140!StadskanaalEuroStaete building by nightThe end of summerFishermen memorial at KatwijkBranch in the sandFir cones
 

Paypal Donations

Why donate? Any donation will be considered a motivation to continue providing support and writing more plugins.

Please remember: it is not the amount but the thought that counts!
Amount: $

Twitter:

No public Twitter messages.

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox