From 7bb893bef005a9ac2c015f4ac91e003f908b78a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 22 Mar 2011 21:18:38 +0000 Subject: [PATCH] Set application instance first (to prevent a NPE in BaseRegistry) and no 'this' in static environments --- application/hub/class_ApplicationHelper.php | 9 +++------ .../work_units/class_CruncherTestUnitProducer.php | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index b89ec49cb..324128131 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -149,6 +149,9 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica * @return void */ public final function entryPoint () { + // Set this application in registry + Registry::getRegistry()->addInstance('app', $this); + // Create a new request object $requestInstance = ObjectFactory::createObjectByName('ConsoleRequest'); @@ -198,12 +201,6 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // Get a controller instance as well $this->setControllerInstance($resolverInstance->resolveController()); - // Get the registry - $registryInstance = Registry::getRegistry(); - - // Set this application - $registryInstance->addInstance('app', $this); - // Launch the hub main routine here $this->getControllerInstance()->handleRequest($requestInstance, $responseInstance); diff --git a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php index cfb288e3c..65ecef42f 100644 --- a/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php +++ b/application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php @@ -42,7 +42,7 @@ class CruncherTestUnitProducer extends BaseProducer implements UnitProducer, Reg $producerInstance = new CruncherTestUnitProducer(); // Initialize this producer - $this->initProducer(); + $producerInstance->initProducer(); // Return the prepared instance return $producerInstance; -- 2.39.5