From 6ec67e9f59456334bae32b342591d618fdf3fe67 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Thu, 24 May 2018 14:06:14 -0500 Subject: [PATCH] Allow either array or config file as parameter to Email::initialize. Fixes #1042 --- system/Email/Email.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/system/Email/Email.php b/system/Email/Email.php index ac5ef13d87f7..1dd2d785b578 100644 --- a/system/Email/Email.php +++ b/system/Email/Email.php @@ -37,6 +37,7 @@ * @filesource */ +use CodeIgniter\Config\BaseConfig; use Config\Mimes; @@ -400,7 +401,7 @@ public function __construct($config = null) /** * Initialize preferences * - * @param array $config + * @param array|\Config\Email $config * * @return Email */ @@ -408,7 +409,12 @@ public function initialize($config) { $this->clear(); - foreach (get_class_vars(get_class($this)) as $key => $value) + if ($config instanceof \Config\Email) + { + $config = get_class_vars(get_class($this)); + } + + foreach ($config as $key => $value) { if (isset($this->$key) && isset($config->$key)) {