[BUGFIX] Remove PHP warnings in request
authorIngo Pfennigstorf <i.pfennigstorf@gmail.com>
Fri, 21 Sep 2012 09:21:14 +0000 (11:21 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sat, 22 Sep 2012 10:39:30 +0000 (12:39 +0200)
Fixes PHP warnings if the controllerObjectName is not a valid class.

Change-Id: I0edc3cfb30593adac97740afe0443efc1a88faed
Fixes: #27862
Releases: 6.0
Reviewed-on: http://review.typo3.org/14811
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Christian Mueller
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extbase/Classes/Mvc/Request.php

index 35e4f5d..3008645 100644 (file)
@@ -356,10 +356,13 @@ class Request implements \TYPO3\CMS\Extbase\Mvc\RequestInterface {
                $controllerObjectName = $this->getControllerObjectName();
                if ($controllerObjectName !== '' && $this->controllerActionName === strtolower($this->controllerActionName)) {
                        $actionMethodName = $this->controllerActionName . 'Action';
-                       foreach (get_class_methods($controllerObjectName) as $existingMethodName) {
-                               if (strtolower($existingMethodName) === strtolower($actionMethodName)) {
-                                       $this->controllerActionName = substr($existingMethodName, 0, -6);
-                                       break;
+                       $classMethods = get_class_methods($controllerObjectName);
+                       if (is_array($classMethods)) {
+                               foreach ($classMethods as $existingMethodName) {
+                                       if (strtolower($existingMethodName) === strtolower($actionMethodName)) {
+                                               $this->controllerActionName = substr($existingMethodName, 0, -6);
+                                               break;
+                                       }
                                }
                        }
                }