[wp-testers] Attachment bug?

Dougal Campbell dougal at gunters.org
Thu Feb 16 18:26:31 GMT 2006


I've been trying to track down a problem on my site[1]. At first, I was 
convinced that the root issue must be in my server environment. But 
after some digging, I think it might be in the WP core code. In 
particular, something to do with post attachments.

Could someone help me test this? Here's what to do:

Start a new post. Upload an image. Set the image options to "Using 
Thumbnail" and "Link to Page", then "Send to Editor". In the content of 
the post, add some text using a single-quote (like in the word "didn't" 
or "I'm"). Save it as a draft. If that succeeds, save as a draft a 
couple more times. See if you get a SQL error due to the single-quote.

If you do get the error, try modifying the image link to mangle the word 
attachment. Like:
   <a href="..." rel="aXttachment" ...>

Save as a draft. Should work.

Can some of you try this, and let me know whether or not you're getting 
the SQL errors?

I've been looking at the fix_attachment_links() function in 
wp-admin/admin-functions.php. When I turned logging on in MySQL and 
saved my draft, I saw the post updates happening twice: once properly, 
and the second time without proper escaping of the post content. The 
only time I can tell that a post is updated twice is when it has an 
attachment. But commenting out the call to wp_update_post() at the end 
of that function had no effect.

-- 
Dougal Campbell <dougal at gunters.org>
http://dougal.gunters.org/



More information about the wp-testers mailing list