Make WordPress Core

Opened 15 years ago

Closed 15 years ago

#9116 closed defect (bug) (fixed)

remove_option_update_handler throws errors if new_whitelist_options is NULL

Reported by: pamelatech's profile pamelatech Owned by:
Milestone: 2.8 Priority: normal
Severity: normal Version: 2.7.1
Component: Plugins Keywords: has-patch tested
Focuses: Cc:


In version 2.7.1 the remove_option_update_handler function in plugin.php does an array search on the global $new_whitelist_options without checking first that the variable is indeed an array. My experience is that the variable is set when I activate and call register_setting(), but appears to always be NULL afterwards, and when I deactivate and call unregister_setting(), I get errors for a bad 2nd parameter to array_search: one for every option I attempt to unregister.

This should be an easy fix: either $new_whitelist_options needs to be declared as at least an empty array, or the array_search should only be run after checking that $new_whitelist_options is of type array.



Attachments (1)

9116.diff (609 bytes) - added by Denis-de-Bernardy 15 years ago.

Download all attachments as: .zip

Change History (3)

#1 @Denis-de-Bernardy
15 years ago

  • Keywords has-patch tested added
  • Milestone changed from 2.7.2 to 2.8

#2 @ryan
15 years ago

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

(In [11021]) Cast to array to avoid warning. Props Denis-de-Bernardy, pamelatech. fixes #9116

Note: See TracTickets for help on using tickets.