Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Serialization Default Parser: Use PCRE v6.x-compatible subpattern syntax #13369

Merged
merged 1 commit into from
Jan 21, 2019

Conversation

aduth
Copy link
Member

@aduth aduth commented Jan 18, 2019

Closes #13310

This pull request seeks to use a PCRE 6.x-compatible subpattern syntax in the block serialization parser. See #13310 for more information for the rationale of this change.

Testing instructions:

The affected PHP code here does not override the behavior of the WP_Block_Parser_Block class defined in WordPress 5.x . Therefore, you must test either by using an older version of WordPress, or by manually commenting the following line in your WordPress installation (see also #11015):

https://github.com/WordPress/WordPress/blob/b7897c576141adee3686056aff147ea09566c918/wp-settings.php#L258

...and applying a patch update to your local Gutenberg plugin to force the load of the bundled parser class definition:

diff --git a/gutenberg.php b/gutenberg.php
index 2df698bd4..f62a78bab 100644
--- a/gutenberg.php
+++ b/gutenberg.php
@@ -567,3 +567,5 @@ function gutenberg_add_responsive_body_class( $classes ) {
 }
 
 add_filter( 'body_class', 'gutenberg_add_responsive_body_class' );
+
+require_once dirname( __FILE__ ) . '/packages/block-serialization-default-parser/parser.php';

Then, confirm there are no regressions in the behavior of the parser. For example, a dynamic block such as the Latest Posts block should display in a front-end preview.

Ensure parser tests pass:

npm run test-unit-php

@aduth aduth added the [Feature] Parsing Related to efforts to improving the parsing of a string of data and converting it into a different f label Jan 18, 2019
@aduth aduth requested review from mcsf, pento and dmsnell January 18, 2019 20:29
@aduth aduth changed the title Block Serialization Default Parser: Use PCRE v6.x subpattern syntax Block Serialization Default Parser: Use PCRE v6.x-compatible subpattern syntax Jan 18, 2019
Copy link
Member

@pento pento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@youknowriad youknowriad added this to the 5.0 (Gutenberg) milestone Jan 21, 2019
@youknowriad youknowriad merged commit 44409fb into master Jan 21, 2019
@youknowriad youknowriad deleted the fix/13310-pcre-6-subpatterns branch January 21, 2019 09:35
@WordPress WordPress deleted a comment from MpcOS77 Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Parsing Related to efforts to improving the parsing of a string of data and converting it into a different f
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants