Hi @ov3rfly,
we’re sorry to hear you’re experiencing this problem.
Unfortunately we’re not able to reproduce it on a fresh install, but we wouldn’t expect such problem since before the get_option()
call there is an add_option()
that should set that option to []
so a false
return value is not expected unless the option is set to false
or the add_option()
has failed for some reason.
Your report highlights anyway that some defensive coding is definitely advisable there. We’ll try to include it in a future version.
Thanks for your suggestion!
Here is the full debug entry with stack trace, maybe it helps:
[09-Feb-2023 18:51:22 UTC] PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in [..]/wp-content/plugins/duplicate-post/admin-functions.php:149
Stack trace:
#0 [..]/wp-content/plugins/duplicate-post/admin-functions.php(149): in_array()
#1 [..]/wp-content/plugins/duplicate-post/admin-functions.php(40): duplicate_post_plugin_upgrade()
#2 [..]/wp-includes/class-wp-hook.php(308): duplicate_post_admin_init()
#3 [..]/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#4 [..]/wp-includes/plugin.php(517): WP_Hook->do_action()
#5 [..]/wp-admin/admin.php(175): do_action()
#6 [..]/wp-admin/edit.php(10): require_once('...')
#7 {main}
thrown in [..]/wp-content/plugins/duplicate-post/admin-functions.php on line 149
Initial install seems to set the option to []
which ends up as a:0:{}
in database.
If after initial install WordPress > Settings > Duplicate Post
is opened and saved without changes, the option is not set to []
but ends up completely empty in database.
The add_option()
won’t set the option to []
if there is an existing value.
We can not quickly reproduce the above error at the moment, due to not enough time for that, but we can say that
a) the fatal error has been observed in WP backend and error log and
b) this option variable type seem to be used in an inconsistent way.
Maybe you can track it down further, we set this to “not resolved” for the time being.