[wp-trac] [WordPress Trac] #21989: update_option() calls sanitize_option() twice when option does not exist
WordPress Trac
noreply at wordpress.org
Wed Apr 10 18:39:20 UTC 2019
#21989: update_option() calls sanitize_option() twice when option does not exist
-------------------------------------------------+-------------------------
Reporter: MikeSchinkel | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future
| Release
Component: Options, Meta APIs | Version:
Severity: normal | Resolution:
Keywords: dev-feedback has-patch needs- | Focuses:
testing needs-refresh |
-------------------------------------------------+-------------------------
Comment (by littler.chicken):
I'll add that I've run into this recently as well. I've got a settings
page with a group of repeatable fields. The last one of the group is
hidden so that it can be cloned, and during sanitization, the last (empty)
field is discarded. On the initial save, since the process is run twice,
the next to last field is erroneously discarded.
I'm avoiding the issue for the moment by preemptively adding the option to
the database if it does not already exist when the settings page is built,
but this is less than ideal.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/21989#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list