• Resolved therealgilles

    (@chamois_blanc)


    Here is the stack trace:

    [ERROR] lvl:1 | msg:Uncaught TypeError: PublishPress\Future\Modules\Expirator\Controllers\ClassicEditorController::isGutenbergAvailableForThePost(): Argument #1 ($post) must be of type WP_Post, Automattic\WooCommerce\Admin\Overrides\Order given, called in .../public_html/wp-content/plugins/post-expirator/src/Modules/Expirator/Controllers/ClassicEditorController.php on line 91 and defined in .../public_html/wp-content/plugins/post-expirator/src/Modules/Expirator/Controllers/ClassicEditorController.php:65
    Stack trace:
    #0 .../public_html/wp-content/plugins/post-expirator/src/Modules/Expirator/Controllers/ClassicEditorController.php(91): PublishPress\Future\Modules\Expirator\Controllers\ClassicEditorController->isGutenbergAvailableForThePost(Object(Automattic\WooCommerce\Admin\Overrides\Order))
    #1 .../public_html/wp-includes/class-wp-hook.php(324): PublishPress\Future\Modules\Expirator\Controllers\ClassicEditorController->registerClassicEditorMetabox('...', Object(Automattic\WooCommerce\Admin\Overrides\Order))
    #2 .../public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
    #3 .../public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #4 .../public_html/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/Edit.php(159): do_action('...', '...', Object(Automattic\WooCommerce\Admin\Overrides\Order))
    #5 .../public_html/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php(350): Automattic\WooCommerce\Internal\Admin\Orders\Edit->setup(Object(Automattic\WooCommerce\Admin\Overrides\Order))
    #6 .../public_html/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php(366): Automattic\WooCommerce\Internal\Admin\Orders\PageController->prepare_order_edit_form()
    #7 .../public_html/wp-content/plugins/woocommerce/src/Internal/Admin/Orders/PageController.php(167): Automattic\WooCommerce\Internal\Admin\Orders\PageController->setup_action_edit_order()
    #8 [internal function]: Automattic\WooCommerce\Internal\Admin\Orders\PageController->handle_load_page_action('')
    #9 .../public_html/wp-content/plugins/woocommerce/src/Internal/Traits/AccessiblePrivateMethods.php(158): call_user_func_array(Array, Array)
    #10 .../public_html/wp-includes/class-wp-hook.php(324): Automattic\WooCommerce\Internal\Admin\Orders\PageController->__call('...', Array)
    #11 .../public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
    #12 .../public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #13 .../public_html/wp-admin/admin.php(237): do_action('...')
    #14 {main}
      thrown | file:.../public_html/wp-content/plugins/post-expirator/src/Modules/Expirator/Controllers/ClassicEditorController.php | ln:65
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter therealgilles

    (@chamois_blanc)

    I think the bug might be here:

        public function registerClassicEditorMetabox($postType, $post)
        {
            $factory = $this->currentUserModelFactory;
            $currentUserModel = $factory();
    
            if (! $currentUserModel->userCanExpirePosts()) {
                return;
            }
    
            // Only show the metabox if the block editor is not enabled for the post type
            // HERE: This next line does not check that $post is a WP_Post object.
            if ($this->isGutenbergAvailableForThePost($post)) {
                if (! $this->classicEditorIsActiveForCurrentSession() ) {
                    return;
                }
            }
    Thread Starter therealgilles

    (@chamois_blanc)

    Additionally this code uses both \WP_Post and WP_Post when it should one or the other:

        private function isGutenbergAvailableForThePost(WP_Post $post)
        ...
    
        private function classicEditorIsRememberedForThePost(\WP_Post $post)
    Plugin Support Riza Maulana Ardiyanto

    (@rizaardiyanto)

    Hi @chamois_blanc

    I have initiated a GitHub issue for this matter, enabling our developers to review and address it in an upcoming release.

    Thanks for your report.

    Plugin Author andergmartins

    (@andergmartins)

    Thanks guys.

    We are planning a release addressing this, for tomorrow.
    In the meantime, feel free to try the following beta package:

    https://github.com/publishpress/PublishPress-Future/releases/tag/3.1.7-beta.2

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Bug with custom post types’ is closed to new replies.