Automattic / Automattic/aggregator

PHP notice due to Aggregator_Jobs_List_Table being called on AJAX request

Open
#56 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
21
Forks
6
PR merge metrics
No merged PRs in 30d

Description

`Aggregator->admin_init()` is getting called on AJAX actions which is causing an error in the `Aggregator_Jobs_List_Table` where screen isn't being set (since it shouldn't be loaded in AJAX and has no screen on a heartbeat call for example) which is throwing a PHP notice.

**Notice and Trace**

```
[05-Oct-2016 21:16:51 UTC] PHP Notice: Undefined index: hook_suffix in /srv/www/site/wp-admin/includes/class-wp-screen.php on line 229
[05-Oct-2016 21:16:51 UTC] PHP Stack trace:
[05-Oct-2016 21:16:51 UTC] PHP 1. {main}() /srv/www/site/wp-admin/admin-ajax.php:0
[05-Oct-2016 21:16:51 UTC] PHP 2. do_action($tag = 'admin_init', $arg = *uninitialized*) /srv/www/site/wp-admin/admin-ajax.php:44
[05-Oct-2016 21:16:51 UTC] PHP 3. Aggregator->admin_init('') /srv/www/site/wp-includes/plugin.php:524
[05-Oct-2016 21:16:51 UTC] PHP 4. Aggregator_Jobs_List_Table->__construct() /srv/www/site/wp-content/plugins/aggregator-fork/class-aggregator.php:77
[05-Oct-2016 21:16:51 UTC] PHP 5. WP_List_Table->__construct($args = array ('plural' => 'wp_list_aggregator_jobs', 'singular' => 'wp_list_aggregator_job', 'ajax' => FALSE, 'screen' => NULL)) /srv/www/site/wp-content/plugins/aggregator-fork/class-aggregator-jobs-list-table.php:20
[05-Oct-2016 21:16:51 UTC] PHP 6. convert_to_screen($hook_name = NULL) /srv/www/site/wp-admin/includes/class-wp-list-table.php:143
[05-Oct-2016 21:16:51 UTC] PHP 7. WP_Screen::get($hook_name = NULL) /srv/www/site/wp-admin/includes/template.php:2003
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in class-aggregator.php at Aggregator->admin_init(), then inspect the Aggregator_Jobs_List_Table constructor in class-aggregator-jobs-list-table.php and the related WP_List_Table call shown in the trace. Reproduce an AJAX heartbeat request and verify that the notice about the missing hook_suffix no longer occurs while normal admin list-table behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.