Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Cast variable
The method just return cast `$this->options` as array but actually `$this->options` assign before still a string in some case.

Bugs will be show when I try empty cmb setting in `wp_options` table.
  • Loading branch information
anhskohbo authored Jul 5, 2017
commit 95c4ccaa20e975e4eb73d41baab98250e539c1fe
6 changes: 3 additions & 3 deletions includes/CMB2_Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,14 @@ public function get_options( $default = null ) {
$test_get = apply_filters( "cmb2_override_option_get_{$this->key}", 'cmb2_no_override_option_get', $default, $this );

if ( 'cmb2_no_override_option_get' !== $test_get ) {
$this->options = $test_get;
$this->options = (array) $test_get;
} else {
// If no override, get the option
$this->options = get_option( $this->key, $default );
$this->options = (array) get_option( $this->key, $default );
}
}

return (array) $this->options;
return $this->options;
}

}