Repository navigation
Cast the parsed hue to a float in WP_Duotone_Gutenberg::colord_parse_hsla_string() - #68405
Conversation
|
This also needs to be changed in https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/class-wp-duotone.php#L499 |
5a08e56 to
265654d
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fix is being brought to core in WordPress/wordpress-develop#14862, along with the related PHPStan fixes from three other Gutenberg PRs, which share this entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
$match[1] to float in WP_DuotoneGutenberg::colord_parse_hsla_string()WP_Duotone_Gutenberg::colord_parse_hsla_string()
|
🤖 Comment by Claude Opus 5.5
|
🤖 PR meta 🤖🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the |
Applied in WordPress/wordpress-develop#14862 |
These fixes were made in Gutenberg while resolving the PHPStan errors in the plugin, ahead of adding PHPStan to its CI, and are brought to core to keep the two codebases in sync. They were developed in: * WordPress/gutenberg#68398 * WordPress/gutenberg#68404 * WordPress/gutenberg#68405 * WordPress/gutenberg#68407 The first one fixes a bug in core. Since r56046 the `array_key_exists()` checks in `wp_register_shadow_support()` have lacked their negation, so a block type with shadow support but no `style` or `shadow` attribute never had them registered, while one that already defined them had its definitions replaced, dropping any `default`. Gutenberg already had the negation. Tests are added for the attribute registration. The others make implicit type conversions explicit in the layout and duotone code, and narrow the types used by `WP_Theme_JSON::get_feature_declarations_for_node()` so that it reports no errors even at PHPStan rule level 10. Since the node comes from `theme.json` data, that method now also checks that a feature is an array before reading its subfeatures. This fixes a fatal error ("Cannot unset string offsets") when a feature's value is a string, such as a `shadow`, and the block's selectors for that feature are a list rather than keyed by subfeature name, since each numeric key then reads a character of the string instead of a subfeature. The baseline entries for the resolved errors are removed. Developed in #14862. Follow-up to r56046, r56058, r56101, r62478, r63426. Props justlevine, westonruter, poena, ramonopoly. See #65817. git-svn-id: https://develop.svn.wordpress.org/trunk@64727 602fd350-edb4-49c9-b593-d223f7449a82
These fixes were made in Gutenberg while resolving the PHPStan errors in the plugin, ahead of adding PHPStan to its CI, and are brought to core to keep the two codebases in sync. They were developed in: * WordPress/gutenberg#68398 * WordPress/gutenberg#68404 * WordPress/gutenberg#68405 * WordPress/gutenberg#68407 The first one fixes a bug in core. Since r56046 the `array_key_exists()` checks in `wp_register_shadow_support()` have lacked their negation, so a block type with shadow support but no `style` or `shadow` attribute never had them registered, while one that already defined them had its definitions replaced, dropping any `default`. Gutenberg already had the negation. Tests are added for the attribute registration. The others make implicit type conversions explicit in the layout and duotone code, and narrow the types used by `WP_Theme_JSON::get_feature_declarations_for_node()` so that it reports no errors even at PHPStan rule level 10. Since the node comes from `theme.json` data, that method now also checks that a feature is an array before reading its subfeatures. This fixes a fatal error ("Cannot unset string offsets") when a feature's value is a string, such as a `shadow`, and the block's selectors for that feature are a list rather than keyed by subfeature name, since each numeric key then reads a character of the string instead of a subfeature. The baseline entries for the resolved errors are removed. Developed in WordPress/wordpress-develop#14862. Follow-up to r56046, r56058, r56101, r62478, r63426. Props justlevine, westonruter, poena, ramonopoly. See #65817. Built from https://develop.svn.wordpress.org/trunk@64727 git-svn-id: http://core.svn.wordpress.org/trunk@63877 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What?
This PR fixes an issue in
WP_Duotone_Gutenberg::colord_parse_hsla_string()where thestringresults ofpreg_match()are passed to::colord_parse_hue()which expects afloatfor its first parameter.Why?
While this issue was surfaced by PHPStan (via #66693) it can be remediated independently as part of #66598
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast