Lando - Function WP_Block_Patterns_Registry::register called incorrectly

Set up Lando following Bedrock with Lando | Bedrock Docs | Roots

# .lando.yml
name: project
recipe: wordpress
config:
  webroot: web
services:
  appserver:
    type: php:8.2 # Bedrock requires PHP >= 8.0

with Sage 10 locally to migrate to it from own container setup.

Then I tried to import the database but hit this error on any of my lando wp commands:


Function WP_Block_Patterns_Registry::register was called <strong>incorrectly</strong>. Pattern content must be a string. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 5.5.0.)
ErrorException
Show exception properties

in /app/web/wp/wp-includes/functions.php (line 6114)

        if ( E_USER_ERROR === $error_level ) {
            throw new WP_Exception( $message );
        }
        trigger_error( $message, $error_level );
    }
    /**
     * Determines whether the server is running an earlier than 1.5.0 version of lighttpd.
     *

in /app/web/app/themes/nynaeve/vendor/roots/acorn/src/Roots/Acorn/Bootstrap/HandleExceptions.php -> handleError (line 49) 

As this is related to blocks in WooCommerce

...
WP_Block_Patterns_Registry->register('woocommerce-blocks/banner', array('title' => 'Banner', 'slug' => 'woocommerce-blocks/banner', 'description' => '', 'categories' => array('woo-commerce', 'featured-selling'), 'featureFlag' => '', 'templateTypes' => '', 'source' => '/srv/www/web/app/plugins/woocommerce/patterns/banner.php')) in /app/web/wp/wp-includes/class-wp-block-patterns-registry.php (line 292) 
...

Someone did open a ticket with them https://wordpress.org/support/topic/wp_block_patterns_registryregister-was-called-incorrectly/ but they were told that they do not officially support Bedrock. Did not see any tickets on it here.

When I disable WooCommerce matters start loading again. Oddly enough I did not have this issue earlier. Perhaps because I stared using the WooCommerce blocks beta mode. But post activation last week all was fine.

It is just after migration from own container setup to Lando that I get this issue. And if there is no solution for it yet I will need to see how I can turn off blocks mode… Also issue does not occur with default WordPress theme it seems.

Never mind. Solved it. Turned off Woo by renaming. Then ran lando wp transient delete --all --network reading the other WordPress thread one more time. Then Reactivated WooCommerce by renaming Woo directory to default name. And now all seems to load well again.

2 Likes