Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 5 months ago

#61465 closed defect (bug) (fixed)

New plugins list item breaks if WP version is incompatible

Reported by: wojtekn's profile wojtekn Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.6 Priority: normal
Severity: minor Version: 6.4
Component: Plugins Keywords: has-patch commit
Focuses: administration Cc:

Description

The plugin list layout becomes broken when there is a plugin found that is incompatible with a current WordPress version. For example:

  1. Install WordPress 6.4.3
  2. Navigate to Plugins -> Add New Plugin
  3. Search for Create Block Theme

It's caused by printf used instead of sprintf in the code that generates that block.

Attachments (1)

Plugin with incompatible message WP6.4.png (25.5 KB) - added by sabernhardt 6 months ago.
broken message for plugin that requires newer WordPress version (using 6.4.3 and plugin requires 6.5)

Download all attachments as: .zip

Change History (9)

This ticket was mentioned in PR #6858 on WordPress/wordpress-develop by @wojtekn.


6 months ago
#1

  • Keywords has-patch added

@sabernhardt
6 months ago

broken message for plugin that requires newer WordPress version (using 6.4.3 and plugin requires 6.5)

#2 @sabernhardt
6 months ago

  • Focuses administration added
  • Keywords commit added
  • Milestone changed from Awaiting Review to 6.6
  • Summary changed from Plugin block breaks if WP version is incompatible to New plugins list item breaks if WP version is incompatible
  • Version changed from trunk to 6.4

Hi and thanks for the ticket and patch!

[56571] missed updating that message fragment to sprintf. (I did not find any other = printf results when searching in wp-admin or wp-includes.) "86" in the error message apparently was the string length for the link.

To test the patch in trunk, you could replace is_wp_version_compatible (currently on line 553):
$compatible_wp = false;

#3 @wojtekn
6 months ago

"86" in the error message apparently was the string length for the link.

Nice TIL! I was wondering where this number comes from, but I didn't explore this part further. It seems that https://www.php.net/manual/en/function.printf.php in addition to outputting string, returns string length as int:

Returns the length of the outputted string.

#4 @rajinsharwar
6 months ago

I have tested the fix PR 6858
Before: https://prnt.sc/GbssKMU4jNyq
After: https://prnt.sc/3LA95_j6sFVj

The patch is working as expected. ✅

#5 @SergeyBiryukov
6 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#6 @SergeyBiryukov
6 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 58446:

Plugins: Correct plugin card layout when incompatible plugin message is displayed.

This replaces an erroneous printf() call with sprintf() that was missed when updating this fragment to use wp_admin_notice().

Follow-up to [56571].

Props wojtekn, sabernhardt, rajinsharwar.
Fixes #61465.

@SergeyBiryukov commented on PR #6858:


6 months ago
#7

Thanks for the PR! Merged in r58446.

#8 @ocean90
5 months ago

#61848 was marked as a duplicate.

Note: See TracTickets for help on using tickets.