Skip to content

Commit

Permalink
fix foreach on boolean in BaseComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheron committed Dec 23, 2022
1 parent 8fc168b commit 7179789
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Ajax/common/components/BaseComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,15 @@ protected function setParamCtrl($key, $value, $typeCtrl) {
}

public function setParams($params) {
foreach ( $params as $k => $v ) {
$method="set".ucfirst($k);
if (method_exists($this, $method))
$this->$method($v);
else {
$this->setParam($k, $v);
trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE);
if(\is_array($params)) {
foreach ($params as $k => $v) {
$method = "set" . ucfirst($k);
if (method_exists($this, $method))
$this->$method($v);
else {
$this->setParam($k, $v);
trigger_error("`{$k}` doesn't exists!", E_USER_NOTICE);
}
}
}

Expand Down

0 comments on commit 7179789

Please sign in to comment.