Merged in bugfix/PMC-1415 (pull request #7151)

PMC-1415 Warning in class.controller.php

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly
2019-11-28 15:09:29 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -77,12 +77,13 @@ class Controller
*/ */
public function __get($name) public function __get($name)
{ {
$message = 'Undefined property via __get(): ' . $name . ' in ';
if (array_key_exists($name, $this->__data__)) { if (array_key_exists($name, $this->__data__)) {
return $this->__data__[$name]; return $this->__data__[$name];
} }
$trace = debug_backtrace(); $trace = debug_backtrace();
trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); trigger_error($message . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE);
return null; return null;
} }
@@ -177,8 +178,8 @@ class Controller
$this->__request__ = new stdclass(); $this->__request__ = new stdclass();
} }
if (is_array($data)) { if (is_array($data)) {
while ($var = each($data)) { foreach ($data as $key => $value) {
$this->__request__->{$var['key']} = $var['value']; $this->__request__->{$key} = $value;
} }
} else { } else {
$this->__request__ = $data; $this->__request__ = $data;