From: Tim Otten Date: Mon, 1 Aug 2016 00:58:02 +0000 (-0700) Subject: CRM-17789 - CRM_Core_Error - Adjust setDefaultCallback() sig X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=a6272a48ec91b6307847f6882e7e7a3df7ce24f1;p=civicrm-core.git CRM-17789 - CRM_Core_Error - Adjust setDefaultCallback() sig The definitions of PEAR_ErrorStack::setDefaultCallback() are slightly different in PEAR 1.9.0 and PEAR 1.10.0. The older one is *implicitly* static (which, in some deployments of PHP, produces a warning); while the newer one is *explicitly* static. This code should work with either signature without warnings. --- diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index 7d488ee907..f6f70b187f 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -124,8 +124,13 @@ class CRM_Core_Error extends PEAR_ErrorStack { $log = CRM_Core_Config::getLog(); $this->setLogger($log); - // set up error handling for Pear Error Stack - $this->setDefaultCallback(array($this, 'handlePES')); + // PEAR<=1.9.0 does not declare "static" properly. + if (!is_callable(array('PEAR', '__callStatic'))) { + $this->setDefaultCallback(array($this, 'handlePES')); + } + else { + PEAR_ErrorStack::setDefaultCallback(array($this, 'handlePES')); + } } /**