-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add check to avoid PHP warnings #30127
Conversation
Size Change: 0 B Total Size: 1.41 MB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Ari 💯
@@ -649,7 +649,7 @@ private static function compute_style_properties( $declarations, $styles ) { | |||
foreach ( $properties as $prop ) { | |||
$value = self::get_property_value( $styles, $prop['value'] ); | |||
if ( ! empty( $value ) ) { | |||
$declarations[] = array( | |||
$declarations[] = array( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious how these end up merged. Don't we have a job for this in CI? @ockham
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with two different FSE themes where the warning was showing, this PR solves the problem.
👋 I'm late to this. I wanted to share the same comment as in #30144 (comment) I'd like to understand why this happens: if the theme doesn't provide a preset the algorithm uses the core's defaults https://github.com/WordPress/gutenberg/blob/trunk/lib/experimental-default-theme.json#L4 I wonder if there's a bigger issue, something we landed that have broken this. |
When a fix is pushed for #29828 (comment) I'll push a PR to revert this 👍 |
I have a potential fix ready in #30171. |
Description
Adds an additional check before running some PHP loops that are currently throwing PHP warnings (
PHP Warning: foreach() argument must be of type array|object, null given
)How has this been tested?
Tested with an FSE theme which does not have gradients defined in the JSON. It was throwing errors before, doesn't have errors after the PR.
Checklist: