Intro
Some versions of libxml2 didn’t work properly with PHP, resulting in brackets being stripped from XML. This showed up most often in XML-RPC requests being mangled. This was ultimately resolved with the release of PHP 5.2.9 and libxml2 2.7.3. As of today (16 March 2009) there are still hosts that are running versions of libxml2 and PHP that are known to be broken. To help the ease the pain of WordPress users stuck in this unfortunate situation I wrote a plugin that includes a common hack to work around this problem for XML-RPC requests.
Kudos to Peter Westwood on suggesting a technique to make this work as a plugin instead of hard coding it into WordPress.
History
WordPress ticket #7771
My blog posts on the subject:
- Problems With libxml2 For WordPress XML-RPC Users
- Update On libxml2 Issues
- Conclusion of libxml2 Issues – Use PHP 5.2.9 & libxml2 2.7.3
- WordPress & libxml2 Episode IV: A New Plugin
Plugin
The plugin is available for download at http://wordpress.org/extend/plugins/libxml2-fix/.
Change Log
0.1 – 17 March 2009
- Initial release
0.2 – 15 April 2009
- Enable the fix even if the libxml2 version is 2.7.3 if the PHP is also less than 5.2.9
0.2.2 – 15 April 2009
- Fix typo in version 0.2 (noticed by Rein)
0.2.3 – 29 December 2009
- Add 2.6.27 to the list of libxml versions that trigger the fix
Brilliant.
Good to see the patch converted to a plugin so easily!
Thanks for pointing out how this could work as a plugin, happy to not have to worry about this code in core WordPress.
Fantastic release Joseph :)
Pingback: WordPress Plugin Releases for 03/18 | Weblog Tools Collection
Pingback: wordpress2.7のxml-prc経由での記事投稿の障害と解決策 « もろもろ
Pingback: WordPress Plugin Releases for 03/18 | boomtchik.com
Pingback: WordPress stripping tags PHP issue opgelost! « Nettooor
Pingback: Wordpress and Live Writer Fix @ de Wolff Online!
If I have tried the plugin and it still doesn’t work, is my only option to lean on the shared host provider to try and get iPhone posting to work?
I’d be curious to know why it doesn’t work. Can you look at the output of phpinfo(); and tell me what version of PHP and libxml2 your system is using?
In my case the plugin didn’t work because the combination php 5.2.8 libxml 2.7.3 in my hosted server still removes brackets. As a quick and dirty fix I just added:
|| LIBXML_DOTTED_VERSION == ’2.7.3′
to the condition in the plugin.
It works until I get php updated to 5.2.9
Yes, I believe that is what’s happening for people who say the plugin isn’t working right. I’m going to update it check for libxml2 2.7.3 and PHP versions lower than 5.2.9.
Pingback: Wordpress HTML Tags Stripped Problem Fix – Download Plugin | TECH YARD
Scott thanks a lot your plugin worked, fixed the problem that I’ve been facing this problem since few months.
Pingback: WordPress插件解决HTML标签问题 | 极客520
Thanks, at last my problem was fixed…
I found typo which causes 500 internal server error in new version(0.2) of plugin.
I think, 21th line should be version_compare should be not ‘version_comapare’.
Yikes! I’ve committed a
0.2.10.2.2 version that fixes that. Should be up soon.Thanks.
Pingback: Cobreros.tk » Primer post: Como crear un blog.
Hi Joseph (& all),
I’m a non-techie and appreciate the plug-in, but where do I place the libmxl2 php file???
…in the “plug-ins” folder for WordPress – I have WP running off the server where I host my site.
Please let me know. Thanks in advance!
Jason
Yes, it goes in the wp-content/plugins directory. More info on installing plugins is at http://codex.wordpress.org/Managing_Plugins#Plugin_Installation
Hi Joseph!
I have searched the internet for the solution of their problems with Windows Live Writer (I have to load a list of more than 100 titles – showing an error “Invalid response document returned from XmlRpc server” and headers are not loaded. Advised to put your plugin. I found it on WP 2.7. 1. Now, with the publication of WLW text is published as: “blockquote p align =” justify “Microsoft has launched a search engine a href =” http://www.bing.com/?cc=ru “rel =” nofollow “Bing / a” but it should show as “Microsoft has launched a search engine Bing”. I made a plugin inactive, but still published with errors. now have to publish the records of the visual editor of WP and I’m not entirely comfortable. You will be able to help me in this problem? Thanks in advance!
p.s. hosting is now version libxml2 2.7.2
Ultimately the best solution is to use versions of PHP & libxml2 that fix the problem: http://josephscott.org/archives/2009/03/conclusion-of-libxml2-issues-use-php-529-libxml2-273/
Joseph,
This is great. Thanks so much.
In my particular case, it isn’t that my ISP isn’t updating – but the yum packages are out of date and I’d like to keep from building from source if at all possible on my servers.
Really appreciate it.
Pingback: Windows Live Writer LIBXML2 Problem Solved « Pixsoul
Just wanted to give you a quick thanks for this great solution to a problem that has been bugging me for quite some time. One of the reasons I wanted to work with WordPress is because I could post from anywhere anytime. This issue was seriously cramping my style and locking me into the wordpress dashboard.
Thanks so much for a great and easy fix.
Hi
I been trying to work out why I was having the angle bracket stripping scenario … and have ended up here.
i’ve just checked the PHP & LIBXML versions on my server & they’re:
PHP: 5.2.6
LIBXML: 2.6.26
which, from reading the above would suggest that it’s not a version that causes the problems. However, just in case, I edited the plugin to change one of the 2.7.x lines to 2.6.26 … to no avail.
Other than persuading the Uni to upgrade (…) what other suggestions do people have?
Probably worth making sure there’s not something else that is stripping brackets. Watch the HTTP traffic for the XML-RPC requests and make sure that the raw XML is getting to your server intact. Then narrow down where exactly the problem is happening.
If it turns out that the number of versions of PHP+libxml that have problems is wider than we thought then we’ll need to find a way to deal with that.
Hi Joseph
Thanks for getting back to me; as a bit of numpty question – how to do I check the raw HTML is getting to the server OK? (I’ve had Scribefire/Flock etc., working fine in the past & they’re also affected by the same problem)
Try logging the raw data on the server side before WordPress processes it.
I’m afraid that’s a bit of a challenge to me … I suspect, though, that as Scribefire, Flock & Live Writer are all doing it & I used to be able to post fine from Flock, that the php versions are the problem (I know they have recently updated this server)
Sounds like the PHP+libxml combination are likely to blame then. Have you talked with the admin responsible for the server? If they do an update and then things start breaking then they should look at fixing it or consider undoing the update.
Thanks! You made my day. It is because of people like you that, the Earth is still spinning today =D.
Anyway, I managed to add my code into your code so your plugin is compatible with my host’s libxml. You could have a little gui to select libxml version. That will be handy. Just a suggestion ;)
LIBXML_DOTTED_VERSION == ’2.6.32′
You are seeing the bracketing stripping problem with libxml version 2.6.32? From what I’d see the change had been introduced in 2.7. If we can confirm that problem exists in earlier versions then I’ll updated the plugin to cover those as well.
I’ll get onto our Web team; however, for the time being, it could be useful for you to know that we’ve got libxml 2.6.26 & php 5.2.6
Emma
Pingback: Blogging IT and EDucation » Blog Archive » Blogging offline
thanks Joseph, now I can take my deep breath and focus to increase my traffic and no tag dissapear anymore :)
Best solution is still to upgrade PHP & libxml to more recent versions that have fixed this.
Thanks for your plugin worked first time.
Appreciate it
Joseph, thanks for the plugin. It definitely fixed the issue. However, I noticed something today I believe is a side-effect of this problem and plugin. If I try to embed videos from youtube using Windows Live Writer, these never show up on the web page. Have you seen or heard of this before?
Ultimately the best solution is always to use versions of PHP + libxml that don’t have this problem.
As for Youtube videos not showing up afterwards I haven’t seen any reports of that. Do the embeds get completely stripped out, or are they mangled?
Now I can’t reproduce the issue. :(
I had deactivated and reactivated the plugin for testing and it appears to be working now.
If I can get a repro again, I will let you know.
Thanks!
also, my ISP won’t update PHP. They told me they are using the currently supported version pf PHP by cPanel. Until cPanel says they can upgrade, they won’t. :(
Bummer, sounds like cPanel developers should be encouraged to update then.