PHP Warning – Expected parameter 2 to be an array
-
Recently received this PHP Log warning:
Warning: array_merge(): Expected parameter 2 to be an array, bool given in /home/onenameg/public_html/wp/wp-content/plugins/error-log-monitor/Elm/Settings.php on line 8
Could you please advise if this is anything to worry about?
Many thanks
Robert
-
Thank you for the report. That’s an unusual error, it sounds like maybe the plugin settings have been overwritten with invalid data. Please try this: click the “Configure” link in the widget header, then click “Save Changes” in the configuration screen (no need to change anything, just save the existing settings).
Thanks for your advice Janis. Have done as you suggested. Will let you know how that goes.
Many thanks
RobertHi Janis
I tried the fix you suggested and cleared the log. However, the same error appeared again the next day:
Warning: array_merge(): Expected parameter 2 to be an array, string given in /home/onenameg/public_html/wp/wp-content/plugins/error-log-monitor/Elm/Settings.php on line 8Should I try something else?
Many thanks
Robert-
This reply was modified 3 years, 3 months ago by
Robert.
This error looks slightly different: the first one said
bool given, while this error saysstring given. That suggests some data was loaded from the database, but now it’s in the wrong format (or invalid; impossible to say without seeing the data).The fact that the plugin is active all the time (presumably), but the error only happened again after a day or so, could mean that the error only happens during a cron job or another periodic event. Is there anything on your site that could affect how settings are loaded from the database during a cron job? Like a caching plugin or a filter that chooses which DB prefix (for Multisite) to use depending on the environment?
Thanks very much for getting back Janis. I confirm the plugin runs all the time. Let me discuss with others in our little Web Team and get back to you.
FYI we’re running WordPress 6.1.1 on Focus Pro Theme using Genesis 3.4.0 and Error Log Monitor 1.7.4
With much thanks
Robert
Have discussed with our Web Team [all volunteers] but no one can throw any more light on the issue. It may be connected to the upgrade to WP6 that produced a lot of PHP cron warning errors that we have never seen before – probably because the PHP upgrade made errors visible that previously weren’t reported. We generally now ignore these cron errors – without any noticeable impact on the website. Ignoring the error doesn’t always stop the error from appearing. In which case we add these errors to ignored regular expressions in the PHP Error Log.
However, I notice with this error:
Warning: array_merge(): Expected parameter 2 to be an array, string given in /home/onenameg/public_html/wp/wp-content/plugins/error-log-monitor/Elm/Settings.php on line 8that when I ignore it and go to Configure, it doesn’t appear in the list of Ignored errors. And when I click Cancel, the same error appears again in PHP Error Log. I tried this several times with the same result. If I Clear Log, the error remains. So I can’t delete it! Very odd behaviour. Hope you can help.
Cheers RobertThe ignored errors are stored in the same database entry as other plugin settings. Are you able to edit any other settings in the widget configuration? For example, if you change the “number of entries to show” field, does that change persist if you leave and reopen the configuration screen?
I’m asking that to check if there could be a bigger problem where the plugin can’t either load or save settings in some circumstances.
Also, is this happening on a regular site or in a Multisite network? There are certain database issues that are more common in Multisite, and it’s possible they could affect the plugin this way.
Thanks Janis for helping with this one. Currently we don’t have anything entered in the “number of entries to show” field. So added ’10’ and saved. But when I went back to the config screen, it hadn’t saved anything! We’re not using a multi site network. Just a regular WP installation. Hope this helps, Robert
On a regular site, the plugin settings would be saved in the
wp_optionstable, in an option namedws_error_log_monitor_settings. Does this option exist in your database? If so, please try deleting it and then changing a setting again. Does it save properly now?You could also try checking the
wp_optionstable for errors. Most database management tools should have a button or link that does that.Found the options table and deleted ws_error_log_monitor_settings. And yes, it’s now saving “PHP Warning: array_merge(): Expected parameter 1 to be an array …” in Ignored Messages. So the PHP Error Log in Dashboard is now showing no entries. Do I need to do anything further at this stage?
It sounds like it’s working now. But just to be sure, I would recommend this: wait a day or two, then un-ignore that warning, and see if any more warnings like that have been logged in the past 24 hours. If not, the problem has probably been fixed, and you can add the warning to the ignore list again.
Thanks heaps Janis. Will do the final test as you suggest. A lot of the cron errors that we previously set to Ignore will probably reappear now as we deleted the ELM settings. So will just set to ignore again. So not a problem. Will let you know if we have any further problems. But looking good so far. Cheers – Robert
Hi Janis
Did final test and unignored error. No new similar errors in past 24 hours. So ignored again and assume everything ok. Huge thanks for all your help.
All the bestRobert
-
This reply was modified 3 years, 3 months ago by
The topic ‘PHP Warning – Expected parameter 2 to be an array’ is closed to new replies.