WordPress.org

Make WordPress Core

Opened 17 months ago

Closed 17 months ago

Last modified 17 months ago

#45969 closed defect (bug) (duplicate)

preg_match(): Compilation failed class-wp-block-parser.php line 418

Reported by: AndrewNZ Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.0.3
Component: Editor Keywords:
Focuses: Cc:

Description

After updating from WP 4.9.9 to 5.0.3 I received an error on the front page of my site.

Warning: preg_match() [function.preg-match]: Compilation failed: unrecognized character after (?< at offset 10 in htdocs/wp-includes/class-wp-block-parser.php on line 418

I have seen a similar error to this error before and found this: ā€‹https://wordpress.org/support/topic/preg_match-compilation-failed-at-wp-db-php-on-line-1657/page/3/

And in the comments I found a link to: ā€‹https://github.com/WordPress/WordPress/commit/fc42c062f1bcaea742fde26068a4cf5fde6d9390

So following the changes in github I changed Line 413 from this:

'/<!--\s+(?<closer>\/)?wp:(?<namespace>[a-z][a-z0-9_-]*\/)?(?<name>[a-z][a-z0-9_-]*)\s+(?<attrs>{(?:(?:[}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?<void>\/)?-->/s',

To this:

'/<!--\s+(?P<closer>\/)?wp:(?P<namespace>[a-z][a-z0-9_-]*\/)?(?P<name>[a-z][a-z0-9_-]*)\s+(?P<attrs>{(?:(?:[}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?P<void>\/)?-->/s',

When I uploaded class-wp-block-parser.php the error message disappeared.

I am a newby at PHP, and so I am not sure what adding the cap "P" to the code does but it works.

Change History (6)

#1 @desrosj
17 months ago

  • Keywords reporter-feedback added

Hey @AndrewNZ, thanks for the ticket! And welcome to Trac!

Can you post more information about your environment? What version of PHP are you running?

I think this is a duplicate of #45644, but want to confirm.

#2 @AndrewNZ
17 months ago

Hi Jonathan

My server is running PHP version 5.2 (yes I know out of date, I am working with my hosting service to upgrade).

Server is running MySQL version 5.5.44-0ubuntu0.14.04.1-log (ditto about out of date).

Child Theme of Divi Version: 3.19.4 when I switch to Divi instead of the Child theme error still shows. I was unwilling to switch themes away from Divi as the site would display lots of Divi Builder shortcodes.

I Disabled all the Plugins, the error still shows

Anything else you need to know?

Andrew

#3 @desrosj
17 months ago

  • Component changed from General to Editor
  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #45644.

Thanks @AndrewNZ! This is definitely a report of the same issue. Iā€™m going to close it out as a duplicate. If you could just comment on that ticket and include the server info above so all the reports are in one place, that would be super helpful. Can you also include your PCRE version as well when you do that?

#4 @AndrewNZ
17 months ago

where do I find my PCRE version

#5 @desrosj
17 months ago

The PCRE version can be found in the phpinfo(); output.

#6 @AndrewNZ
17 months ago

PCRE Library Version 8.31 2012-07-06

Note: See TracTickets for help on using tickets.