Skip to content

Commit

Permalink
Merge pull request #8 from ibelar/fix/Server-error-500-php-256-stack-…
Browse files Browse the repository at this point in the history
…deep-level

Fix Server error 500 on ajax call.
  • Loading branch information
ibelar authored Jan 20, 2018
2 parents d52634e + b69ad86 commit d3fa9a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/AtkWp.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ public function wpAjaxExecute()
}

$this->ajaxMode = true;
$this->wpComponent = $this->componentCtrl->searchComponentByKey($_REQUEST['atkwp']);
if ($request = @$_REQUEST['atkwp']) {
$this->wpComponent = $this->componentCtrl->searchComponentByKey($request);
}

$name = $this->pluginName;

Expand Down
2 changes: 1 addition & 1 deletion src/controllers/ComponentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function searchComponentByKey($search, $components = [])
if ($key === $search) {
return $subComponents;
}
if (in_array($key, $this->componentType)) {
if (in_array($key, $this->componentType) && !empty($subComponents)) {
if ($component = $this->searchComponentByKey($search, $subComponents)) {
return $component;
}
Expand Down

0 comments on commit d3fa9a1

Please sign in to comment.