# Lando - Function WP_Block_Patterns_Registry::register called incorrectly

**URL:** https://discourse.roots.io/t/lando-function-wp-block-patterns-registry-register-called-incorrectly/29134
**Category:** bedrock
**Tags:** woocommerce, lando, sage10
**Created:** 2025-01-22T06:25:00Z
**Posts:** 3

## Post 1 by @jasperfrumau — 2025-01-22T06:25:01Z

Set up Lando following [Bedrock with Lando | Bedrock Docs | Roots](https://roots.io/bedrock/docs/bedrock-with-lando/)

```
# .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/](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.

---

## Post 2 by @jasperfrumau — 2025-01-22T06:31:30Z

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.

---

## Post 3 by @aitor — 2025-05-08T08:29:31Z

maybe related

> <https://github.com/woocommerce/woocommerce/issues/53345>
>
> ### Prerequisites
> 
> - [x] I have carried out troubleshooting steps and I believe …I have found a bug.
> - [x] I have searched for similar bugs in both open and closed issues and cannot find a duplicate.
> 
> ### Describe the bug
> 
> After updating WooCommerce to **9.5.0 Beta** in MailPoet automated tests we started getting many PHP Notices `User Notice: Function WP_Block_Patterns_Registry::register was called incorrectly. Pattern content must be a string`
> 
> The source of the problem is that the newly added cache for block patterns (https://github.com/woocommerce/woocommerce/pull/51802) stores absolute paths to the pattern source files (e.g. `/var/www/html/wp-content/plugins/woocommerce/patterns/banner.php`).
> 
> In our test environment, we have two containers with WordPress (test suite container and test site container). They share the same DB but WordPress is installed in different paths. When we run a WP CLI command in the suite container, it caches the Woo patterns data, and then we get the notices when we access the test site on the site container.
> 
> This issue is likely an edge case, which won't happen on standard WordPress installs. We are able to work around the issue. As there is a straightforward way to prevent it, I chose to submit this issue so we can consider addressing it. It can potentially affect sites that, for some reason, have WordPress installed in multiple places or change the WordPress installation path.
> 
> The issue could be prevented by [caching only path relative to `$this->patterns_path`](https://github.com/woocommerce/woocommerce/blob/f666a3f549c567520a56d80466050b344d4c9b30/plugins/woocommerce/src/Blocks/BlockPatterns.php#L150-L161) and adding the `$this->patterns_path` when reading from the cache.
> 
> ### Expected behavior
> 
> Block patterns cache is dependent on the WordPress installation path.
> 
> ### Actual behavior
> 
> Block patterns cache is not dependent on the WordPress installation path.
> 
> ### Steps to reproduce
> 
> 1) Install WordPress in two locations with shared DB
> 2) Run a WP CLI command from the first location
> 3) Access the site set up on the second location
> 
> ### WordPress Environment
> 
> <details><summary>System Status Report</summary>
> 
> ```
> ### WordPress Environment ###
> 
> WordPress address (URL): [Redacted]
> Site address (URL): [Redacted]
> WC Version: 9.5.0-beta.2
> Legacy REST API Package Version: The Legacy REST API plugin is not installed on this site.
> Action Scheduler Version: ✔ 3.8.2
> Log Directory Writable: ✔
> WP Version: 6.7.1
> WP Multisite: –
> WP Memory Limit: 256 MB
> WP Debug Mode: ✔
> WP Cron: –
> Language: en_US
> External object cache: –
> 
> ### Server Environment ###
> 
> Server Info: Apache/2.4.62 (Debian)
> PHP Version: 8.3.14
> PHP Post Max Size: 8 MB
> PHP Time Limit: 30
> PHP Max Input Vars: 1000
> cURL Version: 7.88.1
> OpenSSL/3.0.15
> 
> SUHOSIN Installed: –
> MySQL Version: 5.7.38
> Max Upload Size: 2 MB
> Default Timezone is UTC: ✔
> fsockopen/cURL: ✔
> SoapClient: ❌ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
> DOMDocument: ✔
> GZip: ✔
> Multibyte String: ✔
> Remote Post: ✔
> Remote Get: ✔
> 
> ### Database ###
> 
> [REDACTED]
> 
> ### Post Type Counts ###
> 
> attachment: 1
> mailpoet_page: 2
> page: 13
> post: 4
> wp_navigation: 1
> 
> ### Security ###
> 
> Secure connection (HTTPS): ❌
> Your store is not using HTTPS. Learn more about HTTPS and SSL Certificates.
> Hide errors from visitors: ✔
> 
> ### Active Plugins (2) ###
> 
> MailPoet: by MailPoet – 5.4.1
> WooCommerce: by Automattic – 9.5.0-beta.2
> 
> ### Inactive Plugins (6) ###
> 
> Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3.5
> AutomateWoo: by WooCommerce – 6.1.2
> Hello Dolly: by Matt Mullenweg – 1.7.2
> MailPoet Premium: by MailPoet – 5.4.0
> WooCommerce Memberships: by SkyVerge – 1.26.5 (update to version 1.26.9 is available)
> WooCommerce Subscriptions: by WooCommerce – 6.9.1
> 
> ### Settings ###
> 
> Legacy API Enabled: –
> Force SSL: –
> Currency: EUR (€)
> Currency Position: right
> Thousand Separator: 
> Decimal Separator: ,
> Number of Decimals: 2
> Taxonomies: Product Types: external (external)
> grouped (grouped)
> simple (simple)
> subscription (subscription)
> variable (variable)
> variable subscription (variable-subscription)
> 
> Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
> exclude-from-search (exclude-from-search)
> featured (featured)
> outofstock (outofstock)
> rated-1 (rated-1)
> rated-2 (rated-2)
> rated-3 (rated-3)
> rated-4 (rated-4)
> rated-5 (rated-5)
> 
> Connected to WooCommerce.com: –
> Enforce Approved Product Download Directories: ✔
> HPOS feature enabled: ✔
> Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
> HPOS data sync enabled: –
> 
> ### Logging ###
> 
> Enabled: ✔
> Handler: Automattic\WooCommerce\Internal\Admin\Logging\LogHandlerFileV2
> Retention period: 30 days
> Level threshold: –
> Log directory size: 4 KB
> 
> ### WC Pages ###
> 
> Shop base: #16 - /shop-2/
> Cart: #17 - /shortcode-cart/ - Contains the [woocommerce_cart] shortcode
> Checkout: #18 - /shortcode-checkout/ - Contains the [woocommerce_checkout] shortcode
> My account: #19 - /shortcode-my-account/
> Terms and conditions: ❌ Page not set
> 
> ### Theme ###
> 
> Name: Twenty Twenty-One
> Version: 2.4
> Author URL: https://wordpress.org/
> Child Theme: ❌ – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
> Theme type: Classic theme
> WooCommerce Support: ✔
> 
> ### Templates ###
> 
> Overrides: –
> 
> ### MailPoet ###
> 
> Sending Method: PHPMail
> Send all site's emails with: Default WordPress sending method
> Task Scheduler method: Action Scheduler
> Cron ping URL: http://test.local?mailpoet_router&endpoint=cron_daemon&action=ping
> 
> ### Admin ###
> 
> Enabled Features: activity-panels
> analytics
> product-block-editor
> coupons
> core-profiler
> customize-store
> customer-effort-score-tracks
> import-products-task
> experimental-fashion-sample-products
> shipping-smart-defaults
> shipping-setting-tour
> homescreen
> marketing
> mobile-app-banner
> onboarding
> onboarding-tasks
> pattern-toolkit-full-composability
> product-custom-fields
> remote-inbox-notifications
> remote-free-extensions
> payment-gateway-suggestions
> printful
> shipping-label-banner
> subscriptions
> store-alerts
> transient-notices
> woo-mobile-welcome
> wc-pay-promotion
> wc-pay-welcome-page
> launch-your-store
> 
> Disabled Features: product-data-views
> experimental-blocks
> coming-soon-newsletter-template
> minified-js
> product-pre-publish-modal
> settings
> async-product-editor-category-field
> product-editor-template-system
> blueprint
> reactify-classic-payments-settings
> use-wp-horizon
> add-to-cart-with-options-stepper-layout
> 
> Daily Cron: ✔ Next scheduled: 2024-12-02 09:35:30 +00:00
> Options: ✔
> Notes: 1
> Onboarding: completed
> 
> ### Action Scheduler ###
> 
> Complete: 24
> Oldest: 2024-12-02 09:35:32 +0000
> Newest: -0001-11-30 00:00:00 +0000
> 
> Pending: 3
> Oldest: 2024-12-02 09:35:52 +0000
> Newest: 2024-12-02 09:36:48 +0000
> 
> 
> ### Status report information ###
> 
> Generated at: 2024-12-02 09:36:04 +00:00
> ```
> </details>
> 
> ### Isolating the problem
> 
> - [x] I have deactivated other plugins and confirmed this bug occurs when only WooCommerce plugin is active.
> - [x] This bug happens with a default WordPress theme active, or [Storefront](https://woocommerce.com/products/storefront/).
> - [] I can reproduce this bug consistently using the steps above.
