-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add an admin notice about the upcoming change in PHP requirements #31557
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
Conversation
The minimum required PHP version will be 7.2 as of WooCommerce 6.5. This adds a dismissable admin notice to PHP 7.0 and 7.1 users.
|
@Konamiman it looks like this functionality already exists. Could we instead look at updating this notice and reset it for those who have already dismissed it, rather than create a new notice? |
|
Can we tweak the wording of this to make it explicit to the merchant/user that this change will impact them (vs it just being some informational thing to ignore)? Maybe change the "An upgrade to at least PHP 7.4 is recommended" part to something like "Your server is currently running an older version of PHP, so this change will impact your store. Upgrading to at least PHP 7.4 is recommended". |
|
@ObliviousHarmony I think these serve different purposes. The intent of the original notice was actually to inform about the recommended PHP version for WooCommerce, and that's why it was implemented long before we decided about the bump; but indeed the wording seems to suggest a hard requirement. Given that we don't do a PHP version requirement bump often, I think that a "disposable" notice with whatever wording and links we need in each case is the way to go. I think that what we can do too (after Woo 6.5) is to make the original notice more clear and use it to recommend an upgrade to 7.4. |
- Update the link to the announcement post - Extend the notice text with "Your server is currently running an older version of PHP, so this change will impact your store".
|
@beaulebens Text updated with your suggestion, see the updated screenshot. |
|
Related: #23975 |
peterfabian
left a comment
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, works fine, I just have one note regarding security of unrelated code.
| * @deprecated 4.6.0 | ||
| */ | ||
| public static function install_notice() { | ||
| // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
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.
The third parameter is the replacement. I think
- we shouldn't ignore the escaping if we're passing a translated string to it, but
- we shouldn't actually pass anything as that's not a replacement function, no?
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.
Indeed, this looks like an attempt to convey some extra information in a way that isn't really supported by the function (but no real harm done since this parameter is only used for printing error messages).
ObliviousHarmony
left a comment
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.
@Konamiman To be fair, given how strong the wording was, as well as the name of the notice (wp_php_min_requirements_notice), I do think that the original intention is not only lost but probably irrelevant. Personally, I'd still prefer we adjust the wording of the notice and reset the dismissal in a migration, but there's probably nothing wrong with a duplicate notice. I do have one performance concern with this implementation, so I've left a comment.
80bc066 to
0853bf4
Compare
peterfabian
left a comment
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.
Looks good, works fine as far as I can see. There are some question marks around which actions to use to make things efficient, but this will go away in 3 versions, so let's take the safer route.
|
Hi @peterfabian, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
All Submissions:
Changes proposed in this Pull Request:
The minimum required PHP version will be 7.2 as of WooCommerce 6.5. This pull request adds a dismissable admin notice visible when PHP 7.0 or 7.1 is used:
The notice is created (if needed) when the theme is switched or a new version of WooCommerce is installed.
TODO: Add the url of the announcement post in the link included in the notice.
How to test the changes in this Pull Request:
Switch to PHP 7.2 and load any admin page, e.g. orders. You shouldn't see any notice.
Switch to PHP 7.1, repeat step 1, and load the admin page again. You should see the notice.
Switch to PHP 7.2, reload the admin page (DON'T repeat step 1 this time), and you should see that the notice has disappeared.
Switch to PHP 7.1, repeat step 1, reload the admin page, and click the "Dismiss" button. The notice shouldn't appear anymore unless you repeat step 1.
1+2 simulates a user that was already on PHP 7.2+ at the time of upgrading to the WooCommerce release that includes this pull request, nothing will happen for these users; 3+4 simulates a user that upgrades his PHP without dismissing the notice; and 3+5 simulates a user that dismisses the notice without (or before) upgrading his PHP.
Other information:
Changelog entry
FOR PR REVIEWER ONLY: