Skip to content

Fatal Error around strpos in BlockPatterns.php #57760

@raifd

Description

@raifd

Bug

Some sites might see a fatal error around class BlockPatterns.php, with the website not loading. This was due a bad response from Woo pattern repository. A fix was deployed to the repository but certain sites might still have a bad cache value.

Fix

Updating to 9.8.4 will fix the issue.

Workaround

Sites seeing this fatal can fix it by removing this transient ptk_patterns via WP CLI if that's still accessible to you or from the database directly.

 wp --skip-themes --skip-plugins transient delete ptk_patterns

or deleting _transient_ptk_patterns from the DB: (change the wp_ prefix to your db prefix)

DELETE FROM wp_options WHERE option_name = '_transient_ptk_patterns';

If you can't edit the database, modifying plugins/woocommerce/src/Blocks/BlockPatterns.php and adding this inside parse_categories will fix it:

	/**
	 * Parse prefixed categories from the PTK patterns into the actual WooCommerce categories.
	 *
	 * @param array $patterns The patterns to parse.
	 * @return array The parsed patterns.
	 */
	private function parse_categories( array $patterns ) {
		if ( ! isset( $patterns['categories'] ) || ! is_array( $patterns['categories'] ) ) {
			return array();
		}

The issue has been fixed from the cache source side but certain sites were left with a bad cache value, we will be releasing patch updates to fix that.

Describe the bug

We are seeing a fatal error that just popped up very recently we have at least 5 sites that have gone down in our queues.

To Reproduce

Steps to reproduce the behavior:

Write steps here

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem. (or upload as files via Asks)

Environment

Please fill out any of the below that applies

Operating System/Device

  • Windows
  • MacOS
  • Linux
  • iPhone
  • Samsung
  • Other (add in additional context field)

Version: Add the Desktop OS and/or Device version(s) here

Browser

  • Desktop Edge
  • Desktop Chrome/Chromium
  • Desktop Safari
  • Mobile Edge
  • Mobile Chrome/Chromium
  • Mobile Safari
  • Other (add in additional context field)

Version: Add the browser version(s) here.

WordPress Environment

System Status report

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Blocks/Patterns/TemplatesIssues related to Full Site EditingBugThe issue is a confirmed bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions