WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#4695 closed defect (bug) (fixed)

pre_option_{option_name} filter does not work if returned value evaluates as false

Reported by: markjaquith Owned by:
Milestone: 2.3 Priority: normal
Severity: normal Version: 2.2.1
Component: General Keywords: filter pre_option_
Focuses: Cc:

Description

<?php
require_once('wp-config.php');
update_option('blog_public', '1');

function return_zero($option_val) {
	return 0;
}

add_filter('pre_option_blog_public', 'return_zero');

var_dump(get_option('blog_public'));
?>

Expected result is:

string(1) "0"

Actual result is:

string(0) "1"

Patch is on the way.

Change History (1)

comment:1 markjaquith7 years ago

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

(In [5842]) Allow pre_option_ filters to return values that evaluate as false. fixes #4695

Note: See TracTickets for help on using tickets.