[TASK] Check lightweight cases before class_exists if possible 27/22627/3
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 27 Jul 2013 20:22:23 +0000 (22:22 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 28 Jul 2013 12:04:56 +0000 (14:04 +0200)
If other checks like "in_array" can be done first that are more
lightweight than calling class_exists and potentially causing
(multiple) autoloaders (without success) to search for files.

Resolves: #50494
Releases 6.2

Change-Id: I9b2010c09591fd02eefdc57f869edd80d4106e14
Reviewed-on: https://review.typo3.org/22627
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php
typo3/sysext/extbase/Classes/Mvc/Controller/ActionController.php

index 5097e03..88d010a 100644 (file)
@@ -115,7 +115,7 @@ class DriverRegistry implements \TYPO3\CMS\Core\SingletonInterface {
         * @return string The class name
         */
        public function getDriverClass($shortName) {
-               if (class_exists($shortName) && in_array($shortName, $this->drivers)) {
+               if (in_array($shortName, $this->drivers) && class_exists($shortName)) {
                        return $shortName;
                }
                if (!array_key_exists($shortName, $this->drivers)) {
index fc8b8a8..75cc0b6 100644 (file)
@@ -424,7 +424,7 @@ class ActionController extends \TYPO3\CMS\Extbase\Mvc\Controller\AbstractControl
                if (class_exists($viewObjectName) === FALSE) {
                        $viewObjectName = str_replace('@format', '', $possibleViewName);
                }
-               if (class_exists($viewObjectName) === FALSE && isset($this->viewFormatToObjectNameMap[$format])) {
+               if (isset($this->viewFormatToObjectNameMap[$format]) && class_exists($viewObjectName) === FALSE) {
                        $viewObjectName = $this->viewFormatToObjectNameMap[$format];
                }
                return class_exists($viewObjectName) ? $viewObjectName : FALSE;