From a6272a48ec91b6307847f6882e7e7a3df7ce24f1 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sun, 31 Jul 2016 17:58:02 -0700 Subject: [PATCH] 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. --- CRM/Core/Error.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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')); + } } /** -- 2.25.1