From c4fc4582d15c9c41c14045715b1e2a89a0ec745c Mon Sep 17 00:00:00 2001 From: Marco Enrico Date: Fri, 7 May 2021 15:49:25 +0800 Subject: [PATCH] Update function-options.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a default `array()` in so that the call to sizeof doesn’t fail. When `gwt_options` does not exist the call to `get_option` returns `null` and the call to `sizeof` causes a crash since it requires an iteratable. --- inc/function-options.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/function-options.php b/inc/function-options.php index 1841085..c83e995 100644 --- a/inc/function-options.php +++ b/inc/function-options.php @@ -53,7 +53,7 @@ class GOVPH public function __construct() { - $this->options = get_option('govph_options'); + $this->options = get_option('govph_options', array()); // to avoid warnings, reinstatiate all arrays that does not exist if(sizeof($this->options) > 0){ $this->options = array_merge($this->_default_options, $this->options); @@ -1056,4 +1056,4 @@ function govph_displayoptions( $options ){ echo $bg; break; } - } \ No newline at end of file + }