Opened 2 years ago
Last modified 2 years ago
#60328 reviewing defect (bug)
Deprecated parameter default value of unregister_setting() is not correct type
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | General | Keywords: | has-patch changes-requested |
| Focuses: | docs | Cc: |
Description
The parameter callable
$deprecatedcannot default to an empty string. It must either default tonullor the type has to be changed tocallable|string.
-- Reported by gerardreches via User Contributed Notes.
Change History (8)
This ticket was mentioned in PR #5936 on WordPress/wordpress-develop by @crstauf.
2 years ago
#1
- Keywords has-patch added
#3
follow-up:
↓ 4
@
2 years ago
- Keywords changes-requested needs-unit-tests added
Hi there, thanks for the patch.
@crstauf @gerardreches the pull request triggers some PHPUnit issues.
I think the condition if ( '' !== $deprecated ) needs to be updated to check for null. The related PHPUnit tests should probably be updated, too.
#4
in reply to:
↑ 3
@
2 years ago
Replying to audrasjb:
Hi there, thanks for the patch.
@crstauf @gerardreches the pull request triggers some PHPUnit issues.
I think the conditionif ( '' !== $deprecated )needs to be updated to check fornull. The related PHPUnit tests should probably be updated, too.
I think that for backward compatibility we should keep that condition, and then add an additional one for null:
if ( !== $deprecated && null !== $deprecated ) {
on line 2836 in option.php
#5
follow-up:
↓ 7
@
2 years ago
- Keywords needs-unit-tests removed
Makes sense to me, just maybe replace && with || ;)
Removing needs-unit-tests since it wouldn't need any unit test update in that case.
This ticket was mentioned in PR #5959 on WordPress/wordpress-develop by @Dargus.
2 years ago
#6
…not correct type
Trac ticket: https://core.trac.wordpress.org/ticket/60328
#7
in reply to:
↑ 5
@
2 years ago
Replying to audrasjb:
Makes sense to me, just maybe replace
&&with||;)
Removing
needs-unit-testssince it wouldn't need any unit test update in that case.
Maybe I'm a bit confused, but why || instead of &&? Aren't we trying to run what's inside the conditional if $deprecated has been set to something that is not the default value?
-- Reported by gerardreches via User Contributed Notes.
Trac ticket: https://core.trac.wordpress.org/ticket/60328