diff --git a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php index 6308c37ec..121b912b2 100644 --- a/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php +++ b/includes/Checker/Checks/Plugin_Repo/Plugin_Readme_Check.php @@ -149,14 +149,17 @@ private function check_name( Check_Result $result, string $readme_file, Parser $ } else { $plugin_data = get_plugin_data( $result->plugin()->main_file() ); - if ( html_entity_decode( $parser->name, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) !== $plugin_data['Name'] ) { + $plugin_readme_name = html_entity_decode( $parser->name, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ); + $plugin_header_name = html_entity_decode( $plugin_data['Name'], ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ); + + if ( $plugin_readme_name !== $plugin_header_name ) { $this->add_result_warning_for_file( $result, sprintf( /* translators: 1: Plugin name, 2: Name in plugin header */ __( 'Plugin name "%1$s" is different from the name declared in plugin header "%2$s".', 'plugin-check' ), - $parser->name, - $plugin_data['Name'] + $plugin_readme_name, + $plugin_header_name ), 'mismatched_plugin_name', $readme_file, diff --git a/tests/behat/features/plugin-check.feature b/tests/behat/features/plugin-check.feature index 430c30cb0..be05e4699 100644 --- a/tests/behat/features/plugin-check.feature +++ b/tests/behat/features/plugin-check.feature @@ -116,19 +116,19 @@ Feature: Test that the WP-CLI command works. WordPress.Security.EscapeOutput.OutputNotEscaped """ - Scenario: Check plugin with apostrophe in plugin name + Scenario: Check plugin with special chars in plugin name Given a WP install with the Plugin Check plugin And a wp-content/plugins/johns-post-counter/johns-post-counter.php file: """