[wp-trac] [WordPress Trac] #45644: Warning: preg_match(): Compilation failed in class-wp-block-parser.php line 382

WordPress Trac noreply at wordpress.org
Sat Dec 15 13:35:02 UTC 2018


#45644: Warning: preg_match(): Compilation failed in class-wp-block-parser.php line
382
--------------------------+------------------------------
 Reporter:  ledavdotnet   |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  5.0.1
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by ledavdotnet):

 Hi,

 Thanks for the welcome and your fast reaction :)

 Replying to [comment:1 ayeshrajans]:

 > PHP 7.3 comes with PCRE version upgrade that might throw similar errors
 (https://ayesh.me/Upgrade-PHP-7.3#pcre2), but the regex compiles just fine
 across all versions from what I can see (https://3v4l.org/35aU0).
 >
 > From the patch, it looks like you changed the regex named subpattern
 syntax. I don't know if Wordpress has a code styling guideline for this,
 but in all PHP versions >=5.3, `/(?<name>pattern)/` should be identical to
 `/(?P<name>pattern)/` (https://regex101.com/r/xmdEiL/1/,
 https://regex101.com/r/VSaJUI/1).

 I don't know either... It "should" indeed :)

 What I can tell however is that I searched for other regexps like this in
 all the sources and this is the only one who is using that naming
 convention. All the others follows the same syntax as the changes I made
 (so the "(?P<" style).

 In fact, IIRC this is the method recommended on the php site for better
 portability...

 Regards,
 David.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/45644#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list