Sfoglia il codice sorgente

#1299 Portal : "Oops, could not load data" when creating request in Full ITIL instance when running PHP7. Cause was that PHP7 isn't able to understand the factory method invocation synthax, had to make it more simple with intermediate steps.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4336 a333f486-631f-4898-b8df-5754b55c2be0
glajarige 8 anni fa
parent
commit
98ad683f09

+ 5 - 3
datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php

@@ -280,18 +280,20 @@ class ObjectController extends AbstractController
 		// Retrieving target object (We check if the method is a simple function or if it's part of a class in which case only static function are supported)
 		if (!strpos($sMethodName, '::'))
 		{
-			$sTargetObject = $sMethodName($oOriginObject);
+			$oTargetObject = $sMethodName($oOriginObject);
 		}
 		else
 		{
 			$aMethodNameParts = explode('::', $sMethodName);
-			$sTargetObject = $aMethodNameParts[0]::$aMethodNameParts[1]($oOriginObject);
+			$sMethodClass = $aMethodNameParts[0];
+			$sMethodName = $aMethodNameParts[1];
+			$oTargetObject = $sMethodClass::$sMethodName($oOriginObject);
 		}
 
 		// Preparing redirection
 		// - Route
 		$aRouteParams = array(
-			'sObjectClass' => get_class($sTargetObject)
+			'sObjectClass' => get_class($oTargetObject)
 		);
 		$sRedirectRoute = $oApp['url_generator']->generate('p_object_create', $aRouteParams);
 		// - Request