Ticket #2681 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Error on Inline Uploading after deleting page with attached file

Reported by: ryanscheuermann Assigned to: ryanscheuermann
Priority: normal Milestone: 2.0.6
Component: Administration Version: 2.1
Severity: normal Keywords: upload, attachment links, bg|has-patch, bg|dev-feedback
Cc:

Description

OK, here's how to replicate:

1) Create a page with test content 2) Publish the page 3) Edit the page 3) Upload an image in the inline iframe when on the edit screen for that page 4) Click Manage->Pages 5) Delete the page 6) Click Write->Write Page 7) In the inline uploading iframe, click Browse All 8) You should see this error:

Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in wp-includes\template-functions-links.php on line 53

Warning: date() [function.date]: Windows does not support dates prior to midnight (00:00:00), January 1, 1970 in wp-includes\template-functions-links.php on line 65

The get_attachment_link function is trying to use a parent post that doesn't exist. (template_function_links.php - around line 117)

SOLUTION: We should intentionally be orphaning attachments (update post_parent to 0) when deleting pages/posts. Otherwise, we just have bad data.

I'll submit a patch in a minute...

Attachments

orphan_attachments.patch (0.6 kB) - added by ryanscheuermann on 04/21/06 20:41:55.
orphan attachments after deleting post (update post_parent = 0)
orphan_attachments2.patch (0.7 kB) - added by ryanscheuermann on 05/10/06 20:54:06.
Patch update: when deleting posts, parent_post should inherit attachments

Change History

04/21/06 20:41:55 changed by ryanscheuermann

  • attachment orphan_attachments.patch added.

orphan attachments after deleting post (update post_parent = 0)

05/10/06 20:54:06 changed by ryanscheuermann

  • attachment orphan_attachments2.patch added.

Patch update: when deleting posts, parent_post should inherit attachments

05/10/06 20:54:41 changed by ryanscheuermann

  • keywords changed from upload, attachment links to upload, attachment links, bg|has-patch, bg|dev-feedback.
  • owner changed from anonymous to ryanscheuermann.
  • status changed from new to assigned.

12/03/06 09:34:37 changed by markjaquith

Confirmed still an issue.

This solution seems right to me. 2nd opinion?

12/04/06 14:25:22 changed by markjaquith

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [4601]) change post_parent on orphaned attachments. props ryanscheuermann. fixes #2681

12/04/06 14:31:11 changed by markjaquith

(In [4602]) change post_parent on orphaned attachments. props ryanscheuermann. fixes #2681

12/04/06 14:32:36 changed by markjaquith

  • milestone changed from 2.1 to 2.0.6.