Commit 67e8814d authored by Manfred Kutas's avatar Manfred Kutas

ZP-962 Only unregister ZPush::IncludeBackend if it was previously

registered.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 6cf69660
...@@ -575,6 +575,7 @@ class ZPush { ...@@ -575,6 +575,7 @@ class ZPush {
* @return object IBackend implementation * @return object IBackend implementation
*/ */
static public function GetBackend() { static public function GetBackend() {
$isIbar = false;
// if the backend is not yet loaded, load backend drivers and instantiate it // if the backend is not yet loaded, load backend drivers and instantiate it
if (!isset(ZPush::$backend)) { if (!isset(ZPush::$backend)) {
// Initialize our backend // Initialize our backend
...@@ -594,6 +595,8 @@ class ZPush { ...@@ -594,6 +595,8 @@ class ZPush {
} }
elseif (!class_exists($ourBackend)) { elseif (!class_exists($ourBackend)) {
spl_autoload_register('\ZPush::IncludeBackend'); spl_autoload_register('\ZPush::IncludeBackend');
$isIbar = true;
ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetBackend(): autoload register ZPush::IncludeBackend");
} }
if (class_exists($ourBackend)) if (class_exists($ourBackend))
...@@ -601,7 +604,10 @@ class ZPush { ...@@ -601,7 +604,10 @@ class ZPush {
else else
throw new FatalMisconfigurationException(sprintf("Backend provider '%s' can not be loaded. Check configuration!", $ourBackend)); throw new FatalMisconfigurationException(sprintf("Backend provider '%s' can not be loaded. Check configuration!", $ourBackend));
} }
if ($isIbar) {
spl_autoload_unregister('\ZPush::IncludeBackend'); spl_autoload_unregister('\ZPush::IncludeBackend');
ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetBackend(): autoload unregister ZPush::IncludeBackend");
}
return ZPush::$backend; return ZPush::$backend;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment