WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 8 years ago

#15240 closed defect (bug) (fixed)

PHP Notice in edit.php

Reported by: sbressler Owned by:
Milestone: 3.1 Priority: normal
Severity: minor Version: 3.1
Component: Warnings/Notices Keywords: has-patch
Focuses: Cc:

Description

I'm currently getting the following PHP Notice on edit.php with WP_DEBUG on: Notice: Illegal member variable name in wp\wp-admin\includes\post.php on line 853

Attachments (2)

15240.patch (565 bytes) - added by mrmist 8 years ago.
patch for template.php
15240-1.patch (371 bytes) - added by mrmist 8 years ago.
edit.php

Download all attachments as: .zip

Change History (15)

#1 @markmcwilliams
9 years ago

Related: #13818

The offending piece of code on http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/post.php#L853 would be $query['posts_per_archive_page'] = -1; so (might) be related to the Custom Post Type Archives?

#2 follow-up: @nacin
9 years ago

  • Milestone changed from Awaiting Review to 3.1

Unrelated, it seems.

#3 in reply to: ↑ 2 @markmcwilliams
9 years ago

Replying to nacin:

Unrelated, it seems.

Oh, me trying to be (half-)helpful, I was just guessing from where the offending bit of code was, in and around some Post Type code, Archive Page, easy mistake to make! ;)

#4 @wpdavis
9 years ago

I'm getting Notice: Undefined index: name in /home/wpdavis/webapps/trunk/wp-includes/capabilities.php on line 116

#5 @edward mindreantre
9 years ago

Can't reproduce.

Latest trunk with WP_DEBUG set only complains about "Assigning the return value of new by reference is deprecated in wpdev/wp-settings.php on line 211".

No complaints about neither post.php (853 - which incidentally is in a comment) nor capabilities.php.

#6 @designsimply
8 years ago

  • Cc sheri@… added

Unable to reproduce this error from the edit.php page: "Notice: Illegal member variable name in wp\wp-admin\includes\post.php on line 853"

I see different notices when trying to restore or permanently delete a trashed post:

To reproduce:

  1. Go to Posts and trash any post
  2. Click on Trash
  3. Click Restore or Delete Permanently

---> wp-admin/edit.php?post_status=trash&post_type=post&untrashed=1 (Restore)
---> wp-admin/edit.php?post_status=trash&post_type=post&deleted=1 (Delete Permanently)
---> Results in these notices: "PHP Notice: Trying to get property of non-object in wp-admin/includes/template.php on line 581
PHP Notice: Trying to get property of non-object in wp-admin/includes/template.php on line 590"

Tested with Chrome 9-dev, PHP version 5.3.3 and WordPress r16544.

#7 follow-up: @mrmist
8 years ago

  • Keywords has-patch added
  • Version set to 3.1

Attached patch just returns from touch_time if $post is not present (as otherwise the function is fairly useless anyway). Seems to have the required result on the post list when you delete the last post in a section (e.g. trash) it now returns "no posts found" instead of the notice. (Against trunk)

@mrmist
8 years ago

patch for template.php

#8 in reply to: ↑ 7 @westi
8 years ago

  • Keywords needs-patch added; has-patch removed

Replying to mrmist:

Attached patch just returns from touch_time if $post is not present (as otherwise the function is fairly useless anyway). Seems to have the required result on the post list when you delete the last post in a section (e.g. trash) it now returns "no posts found" instead of the notice. (Against trunk)

Currently this bails even if not $for_post ideally we should not be calling this code - comes from the quick edit code if there isn't a post to quick edit - we should fix that not this.

#9 @mrmist
8 years ago

I'll see what I can figure out

#10 @mrmist
8 years ago

Tracing this back a bit further, the call seems to come from edit.php. I can check for $post there, and the lack of the call does not seem to affect the quick edit view (unlike my previous patch, which broke it a bit.)

Hopefully this is more suitable.

@mrmist
8 years ago

edit.php

#11 @mrmist
8 years ago

  • Keywords has-patch added; needs-patch removed

#12 @westi
8 years ago

Thanks for following through with this - I decided to go down a slightly different route in the end.

#13 @westi
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [16685]) If we have not items don't try and output the inline_edit form. Fixes #15240 props mrmist for tracking the bug down.

Note: See TracTickets for help on using tickets.