From a3bc7bf1b01ee8829a4d5f1c32b7a3944dd67710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Wed, 19 Mar 2014 10:54:21 +0100 Subject: [PATCH] fixed closure fail (use of $this) --- application/core/ManiaExchange/ManiaExchangeManager.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/core/ManiaExchange/ManiaExchangeManager.php b/application/core/ManiaExchange/ManiaExchangeManager.php index ae2ec9b0..dce366a3 100644 --- a/application/core/ManiaExchange/ManiaExchangeManager.php +++ b/application/core/ManiaExchange/ManiaExchangeManager.php @@ -218,15 +218,17 @@ class ManiaExchangeManager { // compile search URL $url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string; - $success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) { + $thisRef = $this; + $success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) { if ($error) { trigger_error($error . " " . $url); return null; } - if ($mapInfo == '') { + if (!$mapInfo) { return null; } + $mxMapList = json_decode($mapInfo); if ($mxMapList === null) { trigger_error('Cannot decode searched JSON data from ' . $url); @@ -243,7 +245,7 @@ class ManiaExchangeManager { } } - $this->updateMapObjectsWithManiaExchangeIds($maps); + $thisRef->updateMapObjectsWithManiaExchangeIds($maps); return true; }, "application/json");