Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 10 years ago

#22039 closed defect (bug) (fixed)

Undefined index: hook_suffix notice on wp_ajax_get_comments

Reported by: c3mdigital's profile c3mdigital Owned by: ryan's profile ryan
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.5
Component: Comments Keywords: has-patch
Focuses: Cc:

Description

This is part 1 of a two part bug on displaying comments on post.php

The undifined index notice in the ajax response causes the error "an unidentified error has occurred" in the Comments post meta box.

( ! ) Notice: Undefined index: hook_suffix in /Users/chris/Sites/wp-trunk/wp-admin/includes/screen.php on line 401
Call Stack
#	Time	Memory	Function	Location
1	0.0004	254360	{main}( )	../admin-ajax.php:0
2	0.2893	18405672	do_action( )	../admin-ajax.php:69
3	0.2894	18407160	call_user_func_array ( )	../plugin.php:406
4	0.2894	18407192	wp_ajax_get_comments( )	../plugin.php:406
5	0.2895	18408880	_get_list_table( )	../ajax-actions.php:682
6	0.2920	18603376	WP_Comments_List_Table->__construct( )	../list-table.php:49
7	0.2921	18604688	WP_List_Table->__construct( )	../class-wp-comments-list-table.php:36
8	0.2921	18605480	convert_to_screen( )	../class-wp-list-table.php:88
9	0.2921	18605480	WP_Screen::get( )	../template.php:1873

Calling global $hook_suffix; in WP_Screen::get(); fixes the notice.

Related #21101

Attachments (1)

22039.patch (633 bytes) - added by c3mdigital 12 years ago.

Download all attachments as: .zip

Change History (8)

@c3mdigital
12 years ago

#1 @SergeyBiryukov
12 years ago

  • Milestone changed from Awaiting Review to 3.5

#2 @SergeyBiryukov
12 years ago

Confirmed.

#4 @ryan
12 years ago

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

In [22085]:

Handle screen arg in WP_Comments_List_Table constructor. Avoids warning when calling WP_Screen::get() later. fixes #22039

This ticket was mentioned in IRC in #wordpress-dev by tripflex. View the logs.


11 years ago

#6 @tripflex
11 years ago

As you can see from IRC log I was getting this warning when pulling list table via ajax. I used the original patch where it sets the var first (global $hook_suffix; $id = $hook_suffix;) and no longer get warning.

Was this left as using $GLOBALShook_suffix? to make sure this warning is output?

#7 @McGuive7
10 years ago

Totally unrelated to the actual bug (sorry), but I would love to know what you used to generate the stack trace output in the initial bug report? Is that a native PHP function? Thanks!

Note: See TracTickets for help on using tickets.