[wp-testers] Attachment bug?

Doug Stewart dstewart at atl.lmco.com
Thu Feb 16 18:43:14 GMT 2006


Dougal Campbell wrote:
> 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.
> 

I've routinely seen this behavior but haven't bothered to look into it. 
It's a big annoyance but the posts seem to go through without a hitch, 
it's just the return to the admin interface that's h0rked.

-- 
----------
Doug Stewart
Systems Administrator/Web Applications Developer
Lockheed Martin Advanced Technology Labs
dstewart at atl.lmco.com


More information about the wp-testers mailing list