Make WordPress Core

Opened 7 months ago

Closed 7 months ago

Last modified 4 months ago

#59921 closed defect (bug) (fixed)

Update submit_button() default values for consistency

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.5 Priority: normal
Severity: normal Version: 4.2
Component: Administration Keywords: good-first-bug has-patch add-to-field-guide
Focuses: Cc:

Description

Background: #31308.

In [31446], default values for $text and $other_attributes parameters in get_submit_button() were changed from null to an empty string.

For consistency, the same change should be done in submit_button() too. Since it is just a wrapper for get_submit_button(), which does not do any strict type checking on these parameters, backward compatibility should not be a concern here.

Change History (5)

#1 @SergeyBiryukov
7 months ago

  • Keywords needs-patch good-first-bug added; has-patch removed

This ticket was mentioned in PR #5687 on WordPress/wordpress-develop by andbalashov.


7 months ago
#2

  • Keywords has-patch added; needs-patch removed

In alignment with ticket #59921 and following the precedent set in changeset [31446], this commit updates the submit_button() function in the Administration component to standardize the default values of $text and $other_attributes parameters. Previously set to null, these defaults have now been changed to an empty string (''). This modification ensures consistency with the get_submit_button() function, which submit_button() wraps.

The change maintains backward compatibility, as get_submit_button() does not perform strict type-checking on these parameters. This update aligns with the ongoing effort to standardize function parameters across the WordPress codebase, improving the readability and predictability of the core functions.

Trac ticket: https://core.trac.wordpress.org/ticket/59921

#3 @SergeyBiryukov
7 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 57128:

Administration: Standardize default values in submit_button().

This commit updates the submit_button() function to standardize the default values of $text and $other_attributes parameters. Previously set to null, these defaults have now been changed to an empty string (''), bringing consistency with the get_submit_button() function, which submit_button() wraps.

The change maintains backward compatibility, as get_submit_button() does not perform strict type-checking on these parameters. This update aligns with the ongoing effort to standardize function parameters across the WordPress codebase, improving the readability and predictability of the core functions.

Follow-up to [31446].

Props andbalashov.
Fixes #59921.

@SergeyBiryukov commented on PR #5687:


7 months ago
#4

Thanks for the PR! Merged in r57128.

#5 @stevenlinx
4 months ago

  • Keywords add-to-field-guide added
Note: See TracTickets for help on using tickets.