[wp-trac] [WordPress Trac] #18310: Attachments inserted with NULL value for GUID (was: xml-rpc posting returns Empty delimiter error)
WordPress Trac
wp-trac at lists.automattic.com
Fri Sep 30 16:57:28 UTC 2011
#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 ericmann):
* keywords: reporter-feedback => has-patch
* component: XML-RPC => Database
* severity: major => normal
Comment:
True, `guid` is not a required key/value for that `$attachment` array in
that function. And that is where the problem is, ''not'' in XML-RPC.
By default, the GUID is set to '' if nothing is passed in the
`$attachment` array. Unfortunately, that's one of the only fields not
sanitized/reset by WordPress before actually inserting the attachment.
In my opinion, this is a defect. `$file->guid` shouldn't be empty. If no
guid is passed to `wp_insert_attachment()`, then a guid should be created
along the same lines as for `wp_insert_post()`.
I'm attaching a patch that updates the attachment to set the GUID if it
wasn't originally sent in the `$attachment` array.
This should fix the real problem of a null GUID for attachments, which
will also fix the observed issue with XML-RPC.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18310#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list