Opened 2 years ago
Last modified 5 months ago
#48393 accepted defect (bug)
Fix from #38903 prevents options autoload parameter update
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | major | Version: | |
Component: | Options, Meta APIs | Keywords: | 2nd-opinion needs-patch |
Focuses: | administration | Cc: |
Description
This is a follow-up to #38903.
3 years ago fix for not * If the new and old values are the same, no need to update. * But this condition does not check if method call intention was to update autoload field of the option.
Currently the issue can be resolved by force update options when update_option method is called with autoload != null and check * If the new and old values are the same, no need to update. * should be skipped.
Change History (6)
#2
follow-up:
↓ 4
@
9 months ago
I'd disagree with the wontfix
.
While it's there in the documentation it's most definitely counter-intuitive and, perhaps more importantly, there's no alternate direct function to change an options' autoload
property.
This currently means that in order to change the autoload
property of an option developers are forced to resort to direct $wpdb
calls which shouldn't be necessary for something so simple.
I think changing update_option
so that autoload
is updated even if the value is unchanged would be by far the most intuitive and elegant way of doing things. Of course if neither the value nor the autoload
property have been changed then nothing should happen.
#3
@
9 months ago
We just ran into this because @herregroen was fixing some of my code in which I was (wrongly) assuming that update_option
would work to change an option's autoload value... So I disagree with the wontfix
and would suggest making it so this is doable.
#4
in reply to:
↑ 2
@
9 months ago
- Keywords needs-patch added; close removed
- Milestone changed from Awaiting Review to 5.8
- Owner set to SergeyBiryukov
- Status changed from new to accepted
Replying to herregroen:
I think changing
update_option
so thatautoload
is updated even if the value is unchanged would be by far the most intuitive and elegant way of doing things. Of course if neither the value nor theautoload
property have been changed then nothing should happen.
I tend to agree.
This ticket was mentioned in Slack in #core by chaion07. View the logs.
5 months ago
#6
@
5 months ago
- Milestone changed from 5.8 to 5.9
This one needs more time for a proper patch and amount of testing. If it moves forwards, we should also communicate it clearly and early to developers.
I wouldn't be surprised if there are some strange edge cases where developers include the autoload
in their code and it continues working only because that argument had no affect previously.
Thanks for this ticket, @aboltro. And welcome to Trac!
This looks to be an intentional decision. #26394, and more specifically 26394#comment:13/[31640] shed more light. This behavior is also explicitly documented in the inline documentation.
I am going to recommend this be closed as a
wontfix
. But also marking for a second opinion.