-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
Backwards CompatibilityIssues or PRs that impact backwards compatabilityIssues or PRs that impact backwards compatability[Feature] ParsingRelated to efforts to improving the parsing of a string of data and converting it into a different fRelated to efforts to improving the parsing of a string of data and converting it into a different f[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended
Description
Describe the bug
The regular expression that the PHP parser uses the (?<name>pattern)
syntax to create named subpatterns. This syntax was introduced in PHP 5.2.2.
gutenberg/packages/block-serialization-default-parser/parser.php
Lines 376 to 382 in ddac4f3
$has_match = preg_match( | |
'/<!--\s+(?<closer>\/)?wp:(?<namespace>[a-z][a-z0-9_-]*\/)?(?<name>[a-z][a-z0-9_-]*)\s+(?<attrs>{(?:(?:[^}]+|}+(?=})|(?!}\s+\/?-->).)*+)?}\s+)?(?<void>\/)?-->/s', | |
$this->document, | |
$matches, | |
PREG_OFFSET_CAPTURE, | |
$this->offset | |
); |
Strictly speaking, however, the syntax was introduced in PCRE 7.0, which is the default version of PCRE built into PHP 5.2.2, but some Linux distros (Centos 5 is a known example) use an older PCRE. In the case of Centos 5, they use PCRE 6.6.
In core (as well as in other places in Gutenberg), we've avoided this problem by using the older (?P<name>pattern)
syntax.
I'd like to get this fixed in WordPress 5.1.
swissspidy, mustafauysal and david-binda
Metadata
Metadata
Assignees
Labels
Backwards CompatibilityIssues or PRs that impact backwards compatabilityIssues or PRs that impact backwards compatability[Feature] ParsingRelated to efforts to improving the parsing of a string of data and converting it into a different fRelated to efforts to improving the parsing of a string of data and converting it into a different f[Type] BugAn existing feature does not function as intendedAn existing feature does not function as intended