Make WordPress Core

#56746 closed defect (bug) (invalid)

Unused function parameters in the class-wp-customize-background-image-setting.php files.

Reported by: upadalavipul's profile upadalavipul Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: coding-standards Cc:

Description

As per the PHPCS coding standards suggestion, removing the unused parameter "$value" is needed. file location: wp-includes/customize/class-wp-customize-background-image-setting.php.

Attachments (1)

56746.patch (523 bytes) - added by upadalavipul 22 months ago.

Download all attachments as: .zip

Change History (4)

#1 @jrf
22 months ago

  • Keywords close added

@upadalavipul There is a reason why that sniff is not applied to WP Core / in the WordPress-Core ruleset.

WordPress is a highly extended package and overloaded (extended) versions of this class could be relying on this parameter.

If it would be removed, it should also be removed from all method calls passing it and that would be considered a BC-break.

#2 @SergeyBiryukov
22 months ago

Hi there, thanks for the ticket!

I believe the proposed patch would cause a warning on PHP 7.x and a fatal error on PHP 8.x due to the number of parameters in the child class method not matching the number of parameters in the parent class.

Running this script in the root directory with the patch applied:

require 'wp-load.php';
require 'wp-includes/class-wp-customize-setting.php';

$setting = new WP_Customize_Background_Image_Setting( null, '' );
$setting->update();

I get: Fatal error: Declaration of WP_Customize_Background_Image_Setting::update() must be compatible with WP_Customize_Setting::update($value) in wp-includes/customize/class-wp-customize-background-image-setting.php on line 32

#3 @desrosj
22 months ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version trunk deleted

I'm going to close this one out. This seems to be as intended.

@upadalavipul if you have any further details why this is incorrect, feel free to reopen with more information.

Note: See TracTickets for help on using tickets.