Update __isset function to comply with the same checks as __get (#4514)

Credit to @RickAcb.
This commit is contained in:
RickAcb 2019-08-04 13:56:15 +02:00 committed by Ben Thomson
parent 8219f19e8d
commit 0383af6282
1 changed files with 12 additions and 4 deletions

View File

@ -149,12 +149,20 @@ class CodeBase extends Extendable implements ArrayAccess
}
/**
* This will check if a property isset on the CMS Page object.
* @param string $name
* @return void
* This will check if a property is set on the CMS Page object.
* @param string $name
* @return bool
*/
public function __isset($name)
{
return isset($this->page->{$name});
if (isset($this->page->components[$name]) || isset($this->layout->components[$name])) {
return true;
}
if (isset($this->page->{$name})) {
return true;
}
return array_key_exists($name, $this->controller->vars);
}
}