Skip to content

Instantly share code, notes, and snippets.

@htdat
Last active July 12, 2021 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save htdat/06d77ea326d53cb1ae1e6b68c96aa0c3 to your computer and use it in GitHub Desktop.
Save htdat/06d77ea326d53cb1ae1e6b68c96aa0c3 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: Replicate core issue 49089
Plugin URI: https://core.trac.wordpress.org/ticket/49089
Description: Steps to replicate: (1) Visit wp-admin/edit.php, (2) Try to edit a post with "Quick Edit" to trigger the ajax action, (3) Check PHP error log (debug.log)
Author: htdat
Version: 0.1-dev
*/
add_action(
'wp_ajax_inline-save',
function () {
new WP_List_Table(
array(
'plural' => 'plural',
'singular' => 'singular',
'ajax' => true,
/**
* The PHP error does not happen if `screen` value is different from NULL or ``
* Removing the comment below will prevent the error from happening
*/
// 'screen' => 'anything',
)
);
},
/**
* Core calls this action with priority = 1, and since it's an AJAX request,
* the whole process is terminated early before the added action here can be reached out
*
* @see https://github.com/WordPress/wordpress-develop/blob/132984c20f4a539dddeeaf7f9f65716854a89b55/src/wp-admin/admin-ajax.php#L163-L165
*/
-1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment