Merged
Conversation
PHP 8.1 has deprecated passing null as the second parameter to `preg_match()`, generating the following Deprecated notice: `preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated`.
Member
|
The failing e2e test here is unrelated to this PR, and this is an essential fix for PHP8.x compatibility so I'll go ahead and merge this. |
Member
|
Thanks for catching that! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PHP 8.1 has deprecated passing null as the second parameter to
preg_match(), generating the following Deprecated notice:preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated.What?
Avoids a PHP Deprecated notice
Why?
PHP 8.1 has deprecated passing null values to preg_match(), which is the default condition here.
How?
Check the
$block_gapis a non-falsey value before processing it.This style is already used for this variable value further down the stack:
gutenberg/lib/block-supports/layout.php
Line 73 in 6de1698
The changes in this PR could also be written as:
both are logically the same here (although different around a 0 or false, which is not supported here due to the above mentioned code), as it's only checking to see if it contains invalid characters.
Testing Instructions
Unknown.
Have a block that does not contain the
blockGapkey:_wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) ).Screenshots or screencast