]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
baculum: Fix error calling method_exists() with non-objects on PHP 8
authorMarcin Haba <marcin.haba@bacula.pl>
Mon, 28 Mar 2022 05:42:35 +0000 (07:42 +0200)
committerMarcin Haba <marcin.haba@bacula.pl>
Mon, 28 Mar 2022 05:42:35 +0000 (07:42 +0200)
gui/baculum/protected/Web/Portlets/DirectiveControlTemplate.php

index 1e7eb7218514a0608d897448d57d5958958bf2ad..389101b13a9b39ce5a4eda3325ab73e75eaab6b5 100644 (file)
@@ -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) {