strip_tags function in XML RPC needs replacing with regex
|Reported by:||majick777||Owned by:|
I've been working on a plugin that works with pingbacks, and I have come across a problem with a line in class-wp-xmlrpc-server.php which uses strip_tags.
(line 3422 in WP 3.1):
$linea = strip_tags( $linea, '<a>' ); just keep the tag we need
For some reason this function is not working properly at all on some templates (or that is the way it seems) and instead of returning all the <a> tags is cutting a lot of them out, making it seem to the server like there is no target link in the source URI, and thus returning a pingback fault 17 unnecessarily. And this means a large percentage of genuine pingbacks are failing without the user even knowing about it!
I have included a workaround in my new plugin:
Basically it does a regex match for links in your content, then echoes them in a hidden div in the footer, making it much easier for the strip_tags function to actually find them. It works pretty well so I'm not fussed myself, but I thought it worth writing about..
This line really needs to be replaced with the regex match in the actual server code for future WordPress users too. I don't know regex myself, but I used sample code I found here (http://regexadvice.com/forums/thread/48395.aspx) for this regex expression, which seems to work really well.
In any case, strip_tags is not doing a reliable job at this and needs replacing. Hopefully this finds its way to the right person able to fix this. Thanks!