PHP Warning: array_merge
-
I am receiving an error “PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in …/wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 1014”. The plugin appears to be functioning correctly, but wanted to see what may be causing this error or if it should be a concern.
-
Hi @jpribble
What version of SSP are you running? Do you see this error live on the site or in the error_log?
The error was showing in the back end, but now its just showing in the error log. We are running version 2.13.0 of the SSP plugin, although I see a new version just came out yesterday. Does the new version provide a fix for this?
Hi @jpribble
Apologies for the delay, do you still see this error after upgrading? I’ve checked my own error logs while in 2.13 but so far I haven’t seen that error myself.
Thank you for following up on this. Yes, I am still receiving the error daily in the error logs – PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in /public_html/wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 1014
Hello @jpribble!
Could you please check if you use
ssp_tag_archive_post_typesfilter? It looks like your filter function returns a string instead of an array.Anyway, I’ll add additional checks for such cases. Also, it’s always a good practice to disable warnings on production sites – you can do it by disabling debug mode in wp-config.php:
define( 'WP_DEBUG', false );Best regards,
Sergiy@zahardoc I’m not sure where to look for ssp_tag_archive_post_types and cannot find any other information about it. Can you provide any other information about this?
Also WP_DEBUG is set to false, but the errors are showing in the php_errorlog.@jpribble
Yesterday we released a new version that should fix the problem. So no actions from your side are needed. Please update the plugin and check if the errors show up.Yes we are still getting the error after updating the plugin, although now it appears to be recording it more frequently, about every 10-20 seconds all day. Here is an example:
[30-Aug-2022 13:52:12 UTC] PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in /wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 704
[30-Aug-2022 13:52:26 UTC] PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in /wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 704
[30-Aug-2022 13:52:36 UTC] PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in /wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 704However, the other site that we use the plugin on is not getting the error now. Please let me know if you need any other information from me to help figure out the issue. Thank you.
Any fix yet for this? We’re still getting the same error recorded every couple seconds in the error log, but now on a different line after the recent 2.16.2 update:
[07-Sep-2022 15:24:39 UTC] PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in /wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 722I see a similar issue reported here: https://ww.wp.xz.cn/support/topic/php-warning-array_merge-6/ which was marked resolved but it is still occurring even with the last couple updates. We have not made any customizations to the plugin code as you asked in the other post. I viewed the file class-frontend-controller.php and the line referenced in the error shows $query->set( ‘post_type’, array_merge( $post_types, (array) $tag_archive_post_types ) );
Please let me know if you need any other info from me to help resolve this issue. Thanks
Checking in again on this as it still has not been resolved. We are still getting multiple warnings in our php_errorlog file [07-Dec-2022 15:09:36 UTC] PHP Warning: array_merge(): Expected parameter 1 to be an array, string given in /public_html/wp-content/plugins/seriously-simple-podcasting/php/classes/controllers/class-frontend-controller.php on line 728
Does anyone have any idea why this is still occurring and what we can do to fix it?Thank you for reporting it!
Could you try to change $post_types to (array) $post_types on the line 728?
This:
$query->set( 'post_type', array_merge( $post_types, (array) $tag_archive_post_types ) );To this:
$query->set( 'post_type', array_merge( ( array ) $post_types, (array) $tag_archive_post_types ) );Does it fix the problem?
Yes the errors are no longer showing, thank you. Will this change be included in the next plugin update?
@jpribble
Yes, I’ll include this change in the next plugin release.
Thank you for helping make our plugin better!
The topic ‘PHP Warning: array_merge’ is closed to new replies.