Make WordPress Core

Opened 17 years ago

Closed 17 years ago

#9116 closed defect (bug) (fixed)

remove_option_update_handler throws errors if new_whitelist_options is NULL

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

Description

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.

Thanks,

Pamela

Attachments (1)

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

Download all attachments as: .zip

Change History (3)

#1 @Denis-de-Bernardy
17 years ago

  • Keywords has-patch tested added
  • Milestone 2.7.22.8

#2 @ryan
17 years ago

  • Resolutionfixed
  • Status newclosed

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

Note: See TracTickets for help on using tickets.