From: Marcin Haba Date: Mon, 28 Mar 2022 05:42:35 +0000 (+0200) Subject: baculum: Fix error calling method_exists() with non-objects on PHP 8 X-Git-Tag: Release-13.0.0~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b706fe1929ae5655eb0899392101f93713e4dffc;p=thirdparty%2Fbacula.git baculum: Fix error calling method_exists() with non-objects on PHP 8 --- diff --git a/gui/baculum/protected/Web/Portlets/DirectiveControlTemplate.php b/gui/baculum/protected/Web/Portlets/DirectiveControlTemplate.php index 1e7eb7218..389101b13 100644 --- a/gui/baculum/protected/Web/Portlets/DirectiveControlTemplate.php +++ b/gui/baculum/protected/Web/Portlets/DirectiveControlTemplate.php @@ -34,14 +34,16 @@ abstract class DirectiveControlTemplate extends TTemplateControl { public function getCmdParam() { $command_param = null; if ($this->getPage()->IsCallBack) { - if (method_exists($this->getPage()->CallBackEventTarget, 'getCommandParameter')) { - $command_param = $this->getPage()->CallBackEventTarget->getCommandParameter(); + $cbet = $this->getPage()->CallBackEventTarget; + if (is_object($cbet) && method_exists($cbet, 'getCommandParameter')) { + $command_param = $cbet->getCommandParameter(); } else { $command_param = $this->getPage()->getCallbackEventParameter(); } } elseif ($this->getPage()->IsPostBack) { - if (method_exists($this->getPage()->PostBackEventTarget, 'getCommandParameter')) { - $command_param = $this->getPage()->PostBackEventTarget->getCommandParameter(); + $pbet = $this->getPage()->PostBackEventTarget; + if (is_object($pbet) && method_exists($pbet, 'getCommandParameter')) { + $command_param = $pbet->getCommandParameter(); } } if (is_array($command_param) && count($command_param) > 0) {