[wp-trac] [WordPress Trac] #18310: Attachments inserted with NULL value for GUID
WordPress Trac
wp-trac at lists.automattic.com
Fri May 25 00:25:06 UTC 2012
#18310: Attachments inserted with NULL value for GUID
--------------------------+------------------------------
Reporter: docfish | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: 3.2.1
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Changes (by iandunn):
* cc: ian_dunn@… (added)
Comment:
Thanks for writing the patch Eric. I agree that a GUID should be generated
if one isn't passed to ''wp_insert_attachment()'', but that doesn't solve
the problem reported here by docfish
[http://android.forums.wordpress.org/topic/xml-error-when-uploading-new-
post?replies=19 and also on the Android app forums].
This line in ''attach_uploads()'' in ''wp-includes/class-wp-xmlrpc-
server.php'' will still generate a PHP warning when $file->guid is empty
because of the syntax error.
{{{
if ( strpos( $post_content, $file->guid ) !== false )
}}}
That warning causes some XMLRPC clients to freak out and display an error
to the user, even though the post content and upload are successfully
posted.
So, before calling ''strpos(),'' ''attach_uploads()'' also needs to check
for a valid GUID, and if necessary, generate one.
Maybe the code that generates the GUID should be refactored into its own
function so that it's DRY.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18310#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list