Title: Fatal error BlockPatterns.php:251
Last modified: May 6, 2025

---

# Fatal error BlockPatterns.php:251

 *  Resolved [greencode](https://wordpress.org/support/users/greencode/)
 * (@greencode)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/)
 * Not sure why this would have happened but I’ve just disabled Legacy REST API 
   and then the site and backend got a fatal error
 *     ```wp-block-code
       [06-May-2025 12:52:26 UTC] PHP Fatal error:  Uncaught TypeError: strpos() expects parameter 1 to be string, null given in /home/mysite/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php:251Stack trace:#0 /home/mysite/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(251): strpos(NULL, '_woo_')#1 [internal function]: Automattic\WooCommerce\Blocks\BlockPatterns->Automattic\WooCommerce\Blocks\{closure}(Array)#2 /home/mysite/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(260): array_map(Object(Closure), Array)#3 [internal function]: Automattic\WooCommerce\Blocks\BlockPatterns->Automattic\WooCommerce\Blocks\{closure}(Array)#4 /home/mysite/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(247): array_map(Object(Closure), Array)#5 /home/mysite/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php(229): Automattic\WooCommerce\Blocks\BlockPatterns->parse_categories(Array)#6 /home/mysite/public_h in /home/mysite/public_html/wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php on line 251
       ```
   
 * The only way to get it back up and working again was to replace this in this 
   file wp-content/plugins/woocommerce/src/Blocks/BlockPatterns.php
 *     ```wp-block-code
       if ( strpos( $category['title'], $prefix ) !== false ) {
       ```
   
 * with this
 *     ```wp-block-code
       if ( isset( $category['title'] ) && is_string( $category['title'] ) && strpos( $category['title'], $prefix ) !== false ) {
       ```
   
 * I was originally running WooCommerce 9.8.2 and even after i’d got everything 
   back up and running and updated to 9.8.3 I got the same error and had to apply
   the same patch.
 * Any ideas?
    -  This topic was modified 1 year ago by [greencode](https://wordpress.org/support/users/greencode/).

Viewing 7 replies - 16 through 22 (of 22 total)

[←](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/?output_format=md)
[1](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/?output_format=md)
2

 *  Plugin Support [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18452951)
 * Hi [@davelo](https://wordpress.org/support/users/davelo/),
 * Thanks for clarifying that. I completely understand your concern, especially 
   given the issue’s unpredictability and the timing around a high-traffic sales
   weekend like Mother’s Day. It’s definitely unsettling when something breaks without
   any clear trigger, and I agree it makes planning and stability all the more critical.
 * Our development team is actively investigating the root cause and working on 
   a permanent fix. In the meantime, it’s great that the workaround has helped many
   users regain site access. If you haven’t already, you can keep track of updates
   and contribute to the discussion here: [https://github.com/woocommerce/woocommerce/issues/57760](https://github.com/woocommerce/woocommerce/issues/57760)
 * Please feel free to check back in with any new observations, and we’ll continue
   to do everything we can to support you through this.
 * Wishing you a smooth and successful weekend for your shop!
 *  Thread Starter [greencode](https://wordpress.org/support/users/greencode/)
 * (@greencode)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18452960)
 * Hi [@lovingbro](https://wordpress.org/support/users/lovingbro/) Thanks for this
   but it’s not just sites that disable the Legacy REST API plugin as other users
   are reporting i.e. some users are reporting the issue after making no updates
   or deactivating any plugins! I’ll keep an eye on the github you linked to.
 *  Plugin Support [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18452988)
 * Hi [@greencode](https://wordpress.org/support/users/greencode/),
 * Thank you for following up and for clarifying, and you’re absolutely right. My
   earlier response was intended for another user and was mistakenly addressed to
   you, so I appreciate your patience with that.
 * Yes, we’ve seen several reports from users who encountered this fatal error without
   making any plugin changes or updates, so it’s clear the issue isn’t limited to
   disabling the Legacy REST API. It seems to stem from a broader handling issue
   in the block pattern logic, which our development team is now actively investigating.
 * A more permanent fix is in the works, and updates will be shared directly in 
   the GitHub thread here: [https://github.com/woocommerce/woocommerce/issues/57760](https://github.com/woocommerce/woocommerce/issues/57760)
 * Thanks again for staying on top of this and helping others with your workaround
   in the meantime!
 *  [Alje Ybanez](https://wordpress.org/support/users/adminalje/)
 * (@adminalje)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18453246)
 * 9.8.4 has been released with a fix
   [https://developer.woocommerce.com/2025/05/06/woocommerce-9-8-4-dot-release/](https://developer.woocommerce.com/2025/05/06/woocommerce-9-8-4-dot-release/)
 *  [Alje Ybanez](https://wordpress.org/support/users/adminalje/)
 * (@adminalje)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18453248)
 * There is a new release and it fixed my issue:
   [https://developer.woocommerce.com/2025/05/06/woocommerce-9-8-4-dot-release/](https://developer.woocommerce.com/2025/05/06/woocommerce-9-8-4-dot-release/)
 *  [Alje Ybanez](https://wordpress.org/support/users/adminalje/)
 * (@adminalje)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18453263)
 * [@greencode](https://wordpress.org/support/users/greencode/)
 * 9.8.4 has been released with a fix
   [https://developer.woocommerce.com/2025/05/06/woocommerce-9-8-4-dot-release/](https://developer.woocommerce.com/2025/05/06/woocommerce-9-8-4-dot-release/)
 *  Plugin Support [Nami](https://wordpress.org/support/users/woonami/)
 * (@woonami)
 * [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18453405)
 * Hello there,
 * This issue should be fixed now with the dot release of 9.8.4. If there is any
   issue with the dot release, could you please report them in our GitHub issue?:
   [https://github.com/woocommerce/woocommerce/issues/57760](https://github.com/woocommerce/woocommerce/issues/57760)
 * Thank you again for your patience and understanding with this issue.

Viewing 7 replies - 16 through 22 (of 22 total)

[←](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/?output_format=md)
[1](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/?output_format=md)
2

The topic ‘Fatal error BlockPatterns.php:251’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

 * 23 replies
 * 16 participants
 * Last reply from: [Nami](https://wordpress.org/support/users/woonami/)
 * Last activity: [1 year ago](https://wordpress.org/support/topic/fatal-error-blockpatterns-php251/page/2/#post-18453405)
 * Status: resolved