Skip to content

Commit 7179789

Browse files
committed
fix foreach on boolean in BaseComponent
1 parent 8fc168b commit 7179789

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

Ajax/common/components/BaseComponent.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ protected function setParamCtrl($key, $value, $typeCtrl) {
6868
}
6969

7070
public function setParams($params) {
71-
foreach ( $params as $k => $v ) {
72-
$method="set".ucfirst($k);
73-
if (method_exists($this, $method))
74-
$this->$method($v);
75-
else {
76-
$this->setParam($k, $v);
77-
trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE);
71+
if(\is_array($params)) {
72+
foreach ($params as $k => $v) {
73+
$method = "set" . ucfirst($k);
74+
if (method_exists($this, $method))
75+
$this->$method($v);
76+
else {
77+
$this->setParam($k, $v);
78+
trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE);
79+
}
7880
}
7981
}
8082

0 commit comments

Comments
 (0)