From 8df5534470947c29e2318e87b2c2cf4b7f931f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Monta=C3=B1ez?= Date: Wed, 6 Aug 2014 20:41:30 -0300 Subject: [PATCH] Check if classes exists. --- Mage/Command/Factory.php | 5 +++++ Mage/Task/Factory.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/Mage/Command/Factory.php b/Mage/Command/Factory.php index a006efa..1ba9b4d 100644 --- a/Mage/Command/Factory.php +++ b/Mage/Command/Factory.php @@ -38,6 +38,11 @@ class Factory $commandName = str_replace(' ', '_', ucwords(str_replace('/', ' ', $commandName))); $className = 'Mage\\Command\\BuiltIn\\' . $commandName . 'Command'; + + if (!class_exists($className)) { + throw new Exception('Command "' . $commandName . '" not found.'); + } + /** @var AbstractCommand $instance */ $instance = new $className; if (!is_a($instance, "Mage\Command\AbstractCommand")) { diff --git a/Mage/Task/Factory.php b/Mage/Task/Factory.php index d854c42..fce6050 100644 --- a/Mage/Task/Factory.php +++ b/Mage/Task/Factory.php @@ -54,6 +54,10 @@ class Factory $className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task'; } + if (!class_exists($className)) { + throw new Exception('Task "' . $taskName . '" not found.'); + } + $instance = new $className($taskConfig, $inRollback, $stage, $taskParameters); if (!is_a($instance, 'Mage\Task\AbstractTask')) {