Posted: October 27, 2023 at 9:43 am
Constantly getting these type of warnings, “PHP message: PHP Warning: foreach() argument must be of type array|object, null given in /www/xxx_329/public/wp-admin/includes/plugin.php on line 1784” while reading response header from upstream, client: xx.xx.xx.xx, server: xxx.org, request: “POST /wp-admin/admin-ajax.php HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.0-fpm-xxx.sock:”, host: “xxx.org:40739”, referrer: “https://xxx.org/wp-admin/admin.php?page=espresso_registrations&action=default&event_id=3789&default_nonce=2ac6a288ed. What can I do to stop them from appearing in the server log? |
|
Hi there, The above error isn’t from Event Espresso, it’s likely from the wp heartbeat request sent within the WP admin and that’s running whist viewing registrations. From looking at the code where that error is from it looks like something is calling to remove menu items but none at set on the request but that could be from pretty much any plugin. Is that the full error shown? |
|
Yes, that’s the full error from the server log. Guess this is going to more difficult to troubleshot that I hoped for. Thanks Tony. |
|
Hmmm, do you get that error when viewing any other pages or is the referrer always showing the above address? (Note the error is from an ajax request, so the referrer is just the page that triggered the ajax request, but EE doesn’t trigger ajax requests on the registration page which is why I suspect the Heartbeat requests) |
|
Yes, do get other similar errors but they all reference Event Espresso. Here are a couple of more PHP message: PHP Warning: foreach() argument must be of type array|object, null given in /www/xxx_329/public/wp-admin/includes/plugin.php on line 1784″ while reading response header from upstream, client: xx.xx.xx.xx, server: xxx.org, request: “POST /wp-admin/admin-ajax.php HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.0-fpm-xxx.sock:”, host: “xxx.org:40739”, referrer: “https://xxx.org/wp-admin/admin.php?page=espresso_general_settings PHP message: PHP Warning: foreach() argument must be of type array|object, null given in /www/xxx_329/public/wp-admin/includes/plugin.php on line 1784” while reading response header from upstream, client: xx.xx.xx.xx, server: xxx.org, request: “POST /wp-admin/admin-ajax.php HTTP/2.0”, upstream: “fastcgi://unix:/var/run/php8.0-fpm-xxx.sock:”, host: “xxx.org:40739”, referrer: https://xxx.org/wp-admin/admin.php?page=espresso_events&action=edit&post=8258&edit_nonce=4c24aefb7f&return=editpost Is there a current list of known plugins that conflict with Event Espresso? Is there a way exclude the Heartbeat requests for Event Espresso? |
|
Yes, but I’m not aware of the the issue you’ve posted. Known conflicts here:
That’s not the solution to this it just masks the problem. Do you have a staging/dev copy of the site? I can tell you what I would do to debug this and see what is calling the above function, you’ll need to add some code within Are you comfortable with FTP/File Manager and PHP? |
|
Yes, have a staging site and are comfortable with FTP and PHP. FYI, am running Advanced Custom Fields Pro though it is for separate page not related to EE. |
|
Ok, so within wp-config.php I use this: https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug To set the log to use Then I use this little function:
You can add that anywhere that always loads, I use a custom functions plugin: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ — Now, you’ll need to temporarily hack up WordPress core (remember to remove this code when finished).
Lines 1781 – 1792:
The warning is from
Add that just below Now do whatever you do to trigger the above again and see if anything juicy is saved within Post it up here if needed and help troubleshoot if I can. |
|
Tony, You suggestion was very helpful. Have track the cause to this custom function. function remove_menu_pages_for_all_except_admin() { global $user_ID; if ( !current_user_can(‘administrator’) ) { Using the above code to keep editors from breaking their site. Any idea as to why this would trigger the errors only on the EE related pages? |
|
When is Why does that function declare the
As it’s only happening on the Ajax requests, and you don’t need to remove those menus on ajax requests, at the top of that function you could just use something like:
|
|
The support post ‘PHP Warnings’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.