Conversation
|
Some further changes were introduced: Compatibility with WP 5.6There are still users on WP 5.6+ using this plugin therefore we're ensuring this version keeps being supported for now. This required some changes:
JSX transform
To fix this, the babel-loader rule from A ProvidePlugin entry injects React from @wordpress/element into any module that references it, so JSX files don't need an explicit import. wp-element has been available since WP 5.0, making this safe across all Compatibility with PHP 7.4While manually testing this on WP 5.6 and PHP 7.4, I noticed a fatal error related to I performed an audit to check for any other PHP 8 only features being used but didn't find any. |
|
Hello @gabrielcld2,
This is actually by design in Your fix to use <!-- Re-enable PHP 8.0 function checks excluded by PHPCompatibilityWP.
Their WP polyfills only exist in WP 5.9+, but we support WP 5.6+. -->
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.str_containsFound">
<severity>5</severity>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.str_starts_withFound">
<severity>5</severity>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.str_ends_withFound">
<severity>5</severity>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.array_key_firstFound">
<severity>5</severity>
</rule>
<rule ref="PHPCompatibility.FunctionUse.NewFunctions.array_key_lastFound">
<severity>5</severity>
</rule> |
PatelUtkarsh
left a comment
There was a problem hiding this comment.
Looks good. Clean approach for backward compat across WP 5.6+. Left two nit-picks. @gabrielcld2
| Tested up to: 6.9.1 | ||
| Requires at least: 5.6 | ||
| Tested up to: 7.0 | ||
| Requires PHP: 7.4 |
There was a problem hiding this comment.
💡 thought: Should we say requires 5.6?
| tagDelimiter: | ||
| ( window.tagsSuggestL10n && window.tagsSuggestL10n.tagDelimiter ) || | ||
| ',', | ||
| tagDelimiter: wp.i18n._x( ',', 'tag delimiter' ) || ',', |
There was a problem hiding this comment.
💬 suggestion: terms-order.js now uses wp.i18n._x() but only declares jquery as a dependency. wp-i18n is available at runtime because wp_enqueue_media
loads media-views which pulls it in via set_translations(), but that's an implicit dependency. Should we add wp-i18n explicitly just to be safe?
Approach
Some notable exceptions of issues that couldn't be resolved:
Gallery settings page
The suggested replacement is still marked as experimental. It would be risky to use an experimental component that might change its API within our plugin (our linter advice against it too). Remaining on the deprecated (but still working) component seems safer.
Gallery block
The gallery block styling is enqueued via the
enqueue_block_editor_assetshook at the moment. Ideally we should migrate to using ablock.jsonfile combined witheditorStyleproperty... however the structural changes are quite large so we might need to have a separate refactor task to upgrade the gallery block to apiVersion 3 withblock.jsonsupport.apiVersion 3 means full iframe support within the editor. Unfortunately this doesn't work well with the current structure of this block, as it's currently loading the gallery widget for a live preview within the editor. This is sort of related to the above issue.
QA notes