Ticket #4962 (new defect)

Opened 1 year ago

Orphan attachment's "parent_post" seems to be undefined or overflowed

Reported by: ulfben Assigned to: anonymous
Priority: normal Milestone: 2.9
Component: General Version: 2.2.3
Severity: normal Keywords: upload, attachment, parent_post, wp_posts, wp_upload_tab_upload_action
Cc:

Description

Orphan attachment's "parent_post" seems to be undefined or overflowed

In wp_posts (the db table), parent_post defaults to NULL. An ordinary post has no parent, and it's parent_post is set to 0 appropriately. Thus an orphaned uploaded file (not attached to any post) should also be set to 0, right?

What I find is that they are all set to a value like -1189551062, -1189547712, -1189551992 and so on, wich looks suspiciously like an overflow of some kind.

Looking at wp_upload_tab_upload_action() I notice that $post_id is never checked before constructing the attachment array. I don't know enough PHP/MySQL/WP to know if this might be the cause or not, but I need to know:

Are these (huge) negative post_parent id's a desired behaviour?