-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Quick Edit in User Groups PHP Error #654
Comments
As mentioned in #666 (review), this is a bug in core WP |
Replicate this issue in the core
Error with track trace:
Root causeThe error happens around this line http://github.com/WordPress/WordPress/blob/9f91305af2bd18c914096cc5e5cc1d6882163200/wp-admin/includes/class-wp-screen.php#L223-L223 $id = $GLOBALS['hook_suffix']; admin-ajax.php requests do not load file wp-admin/admin.php, which is loaded when admins browse wp-admin pages. A side note here: I searched SolutionI think the ultimate solution here is to change the way we handle Index: wp-admin/includes/class-wp-screen.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/wp-admin/includes/class-wp-screen.php b/wp-admin/includes/class-wp-screen.php
--- a/wp-admin/includes/class-wp-screen.php (date 1623657694433)
+++ b/wp-admin/includes/class-wp-screen.php (date 1623657694433)
@@ -220,7 +220,10 @@
if ( $hook_name ) {
$id = $hook_name;
} else {
- $id = $GLOBALS['hook_suffix'];
+ // AJAX requests does not load wp-admin/admin.php, which sets value for global $hook_suffix
+ $id = wp_doing_ajax()
+ ? 'wp_ajax_' . esc_attr( $_REQUEST['action'] )
+ : $GLOBALS['hook_suffix'];
}
// For those pesky meta boxes. What do you think, @mikeyarce? If you have time, I would like to see your thought too, @nielslange. @mikeyarce pointed out a great point: This notice error will be converted into a warning in PHP8 and that might cause a bigger headache. Ref:
|
FYI. Submitted a PR for this core issue: |
Expected/Desired Behavior
No PHP Errors when using Quick Edit
Actual Behavior
PHP Error:
In the console:
Steps to Reproduce the Problem
(Optional) Additional notes
I think the problem is here: https://github.com/Automattic/Edit-Flow/blob/master/modules/user-groups/user-groups.php#L1097-L1103
The
__construct()
should havescreen
because the method WordPress uses to determine this doesn't run when an AJAX call is made.The text was updated successfully, but these errors were encountered: