Commit c8a22a2c 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 67e8814d
...@@ -575,9 +575,10 @@ class ZPush { ...@@ -575,9 +575,10 @@ 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)) {
$isIbar = false;
// Initialize our backend // Initialize our backend
$ourBackend = @constant('BACKEND_PROVIDER'); $ourBackend = @constant('BACKEND_PROVIDER');
...@@ -603,10 +604,11 @@ class ZPush { ...@@ -603,10 +604,11 @@ class ZPush {
ZPush::$backend = new $ourBackend(); ZPush::$backend = new $ourBackend();
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) { if ($isIbar) {
spl_autoload_unregister('\ZPush::IncludeBackend'); spl_autoload_unregister('\ZPush::IncludeBackend');
ZLog::Write(LOGLEVEL_DEBUG, "ZPush::GetBackend(): 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