WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 21 months ago

#33582 closed defect (bug) (duplicate)

update_option call sanitize_option twice for new options

Reported by: Mbertu Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Options, Meta APIs Keywords:
Focuses: Cc:
PR Number:

Description

I've found this, for me is a bug in the add/update option procedure.

If the option doesn't already exist in the db, is called anyway the update_option function in /wp-includes/option.php.

This funciton, at the line 256 execute the function sanitize_option this function goes to execute the callback pased to the register_setting function. But if the option doesn't already exist in the db, is executed further the function add_option that again call the sanitize_option, and again execute the register_setting callback but this time with the result of the first callback execution as input.

The problem, for me, is that the first execution manipulate the submited post data and generate a different output, so the second execution of the callback fails.

There is a problem with the input image too, but I don't now exactly why (only on the first submit for the option).

Is that a bug, or I've miss something?

Change History (3)

#1 @obenland
4 years ago

  • Version trunk deleted

#2 @thomaswm
4 years ago

I think this is a duplicate of #21989.

#3 @ocean90
21 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #21989.

Note: See TracTickets for help on using tickets.