• Tony G

    (@starbuck)


    In /extended-post-status/admin/class-extended-post-status-admin.php the value of $term_meta may be Boolean and not an Array. This causes the following critical error (site stops). This might have been a warning in prior PHP, but now it’s fatal.

    The solution is to add if(is_array($term_meta) && ... before all of the checks for values in the array. It’s a simple change. I have not looked to see why that value is a Boolean in the first place.

    I just installed and started to test this great plugin but I’m afraid I need to uninstall. I can’t take a chance that there are more gotchas that haven’t been tested yet. But I will install in another test environment later and try to help with this.

    Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, bool given in /wp-content/plugins/extended-post-status/admin/class-extended-post-status-admin.php:197

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Felix W.

    (@welly2103)

    Hi @starbuck,

    Thank you very much for your feedback!

    How does the error occur? If I take a blank installation on PHP version 8.2 and only install my plugin, then the error does not occur.

    Line 192 in admin/class-extended-post-status-admin.php is only executed if a custom status has been created and the variable is filled with an array when it is created. Do you use another plugin to create other statuses?

    I will implement your solution to rule out that other statuses are causing the problem here and then get back to you.

    Greetings Felix

    Thread Starter Tony G

    (@starbuck)

    I’ll make you a deal. If you can commit to publishing a fix within the next week, I’ll help to diagnose this in the new site where this occurred. I completely understand time constraints, real life, etc, so don’t bind yourself it this doesn’t fit with real life. For all we know now, some other plugin might be responsible for this and you won’t need to do anything other than that array check. If you cannot commit to addressing this, I’ll uninstall and pick up on this in a test site to give us both time to poke at it.

    Thanks!

    Thread Starter Tony G

    (@starbuck)

    More info: With $term_meta=get_option(x) and get_option returning false when the option doesn’t exist, I’m guessing for now that the option "taxonomy_term_$term->term_id" doesn’t exist, so anything after that falls over. While the value not existing might seem to be impossible, it’s probably wise to check for a false value on $term_meta, report that condition delicately to the user, and report it with normal logging to the admin as an error.

    See /admin/class-extended-post-status-admin.php : status_meta_box_content() and elsewhere.

    HTH

    • This reply was modified 1 year ago by Tony G. Reason: added detail
    Plugin Author Felix W.

    (@welly2103)

    Hi @starbuck

    I have now published the plugin in parallel on github so that pull requests can be created here.

    I have already pushed the small adjustment there, does it work for you now? If so, I can add it to the WordPress repository as a small release for everybody.

    https://github.com/welly2103/extended-post-status/commit/7cf1a43ac9a3318c155333e16f3524816d075bac

    I think the problem is related to the fact that there are statuses that are not managed by the plugin and therefore have no meta data. These statuses are now simply ignored.

    Greeting Felix

    Thread Starter Tony G

    (@starbuck)

    Will hit this within the next couple days. Thanks!!!

    Thread Starter Tony G

    (@starbuck)

    Hey bud, I flaked out on ya – have been focused on getting a site up and couldn’t take a chance with a plugin that affects post status.

    I have the patch and am looking forward to doing some testing ASAP.

    Thanks!

    Had a similar error and the update fixes parts.

    Now, I’m left with the following error after clicking to display ONLY a single custom post status:

    "() expects parameter 2 to be array, bool given in?/home/customer/www/WEBSITE.com/public_html/wp-content/plugins/extended-post-status/admin/class-extended-post-status-admin.php?on line?121"

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Fatal Error with PHP 8.x’ is closed to new replies.