Zum Inhalt springen

Probleme mit redirect in Typo3 Extension

Erstellt am 12. September 2013 · 2 Antworten · letzte Antwort am 27. September 2013

Tags: FlexForms, TYPO3 6.x, Frage

hmadla ·

Ich möchte gerne in der initializeAction meines Controllers eine Abfrage durchführen, ob die LDAP-Extension von PHP geladen ist. Falls nein, soll ein redirect auf die failureAction gemacht werden.

	/**
	 * Initializes the current action
	 *
	 * @return void
	 */
	public function initializeAction() {
		// Check whether PHP LDAP Module is loaded
		if (!extension_loaded('ldap')) {
			$failureMsg = array();
			$failureMsg[text] = Tx_Extbase_Utility_Localization::translate("failureMsg.phpLdap", "dla_ldappwdchanger");
			$this->redirect('failure', NULL, NULL, $failureMsg);
	}

Meine failureAction sieht wie folgt aus:

	/**
	 * Failure action for this controller.
	 *
	 * @param array $failureMsg
	 * @return string The rendered view
	 */
	public function failureAction(array $failureMsg) {
		$this->view->assign('failureMsg', $failureMsg[text]);
	}

Meine ext_localconf.php:

<?php
	
	if(!defined('TYPO3_MODE')) die ('Access denied.');
	
	Tx_Extbase_Utility_Extension::configurePlugin(
        $_EXTKEY,
        'Pi1',
        array(
                'Entry' => 'index','main','failure','success',
        ),
        array(
                'Entry' => 'index','main','failure','success',
        )
	);
	
?>

Im Netz werden hauptsächlich die switchableControllerActions in einer FlexForm oder die doppelte Einbindung des Plug-Ins dafür verantwortlich gemacht. Beides trifft auf meine Extension nicht zu.

Hier die Fehlermeldung im Detail:

Uncaught TYPO3 Exception
#1313855175: The action "failure" (controller "Entry") is not allowed by this plugin. Please check TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin() in your ext_localconf.php. (More information)

TYPO3\CMS\Extbase\Mvc\Exception\InvalidActionNameException thrown in file
/Applications/MAMP/htdocs/DLA2/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php in line 257.

25 TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::resolveActionName("Entry", array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php:
00171:   }
00172:   $controllerName = $this->resolveControllerName($parameters);
00173:   $actionName = $this->resolveActionName($controllerName, $parameters);
00174:   /** @var $request \TYPO3\CMS\Extbase\Mvc\Web\Request */
00175:   $request = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Request');

24 TYPO3\CMS\Extbase\Mvc\Web\RequestBuilder::build()

/Applications/MAMP/htdocs/DLA2/typo3/sysext/extbase/Classes/Mvc/Web/FrontendRequestHandler.php:
00065:   */
00066:  public function handleRequest() {
00067:   $request = $this->requestBuilder->build();
00068:   /** @var $requestHashService \TYPO3\CMS\Extbase\Security\Channel\RequestHashService */
00069:   $requestHashService = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Security\\Channel\\RequestHashService');

23 TYPO3\CMS\Extbase\Mvc\Web\FrontendRequestHandler::handleRequest()

/Applications/MAMP/htdocs/DLA2/typo3/sysext/extbase/Classes/Core/Bootstrap.php:
00206:   $requestHandler = $requestHandlerResolver->resolveRequestHandler();
00207: 
00208:   $response = $requestHandler->handleRequest();
00209:   // If response is NULL after handling the request we need to stop
00210:   // This happens for instance, when a USER object was converted to a USER_INT

22 TYPO3\CMS\Extbase\Core\Bootstrap::handleRequest()

/Applications/MAMP/htdocs/DLA2/typo3/sysext/extbase/Classes/Core/Bootstrap.php:
00195:  public function run($content, $configuration) {
00196:   $this->initialize($configuration);
00197:   return $this->handleRequest();
00198:  }
00199: 

21 TYPO3\CMS\Extbase\Core\Bootstrap::run("", array)
20 call_user_func_array(array, array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
06436:       $content,
06437:       $conf
06438:      ));
06439:     } else {
06440:      $GLOBALS['TT']->setTSlogMessage('Method "' . $parts[1] . '" did not exist in class "' . $parts[0] . '"', 3);

19 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::callUserFunction("TYPO3\CMS\Extbase\Core\Bootstrap->run", array, "")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php:
00053:   }
00054:   $this->cObj->includeLibs($conf);
00055:   $tempContent = $this->cObj->callUserFunction($conf['userFunc'], $conf, '');
00056:   if ($this->cObj->doConvertToUserIntObject) {
00057:    $this->cObj->doConvertToUserIntObject = FALSE;

18 TYPO3\CMS\Frontend\ContentObject\UserContentObject::render(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00737:      $contentObject = $this->getContentObject($name);
00738:      if ($contentObject) {
00739:       $content .= $contentObject->render($conf);
00740:      } else {
00741:       // Call hook functions for extra processing

17 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("USER", array, "dlaldappwdchanger_pi1")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/CaseContentObject.php:
00051:    $key = strlen($conf[$key]) ? $key : 'default';
00052:    $name = $conf[$key];
00053:    $theValue = $this->cObj->cObjGetSingle($name, $conf[$key . '.'], $key);
00054:    if (isset($conf['stdWrap.'])) {
00055:     $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);

16 TYPO3\CMS\Frontend\ContentObject\CaseContentObject::render(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00737:      $contentObject = $this->getContentObject($name);
00738:      if ($contentObject) {
00739:       $content .= $contentObject->render($conf);
00740:      } else {
00741:       // Call hook functions for extra processing

15 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("CASE", array, "20")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00685:     if (intval($theKey) && !strstr($theKey, '.')) {
00686:      $conf = $setup[$theKey . '.'];
00687:      $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
00688:     }
00689:    }

14 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGet(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectArrayContentObject.php:
00047:    if ($this->cObj->checkIf($conf['if.'])) {
00048:     $this->cObj->includeLibs($conf);
00049:     $content = $this->cObj->cObjGet($conf);
00050:     $wrap = isset($conf['wrap.']) ? $this->cObj->stdWrap($conf['wrap'], $conf['wrap.']) : $conf['wrap'];
00051:     if ($wrap) {

13 TYPO3\CMS\Frontend\ContentObject\ContentObjectArrayContentObject::render(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00737:      $contentObject = $this->getContentObject($name);
00738:      if ($contentObject) {
00739:       $content .= $contentObject->render($conf);
00740:      } else {
00741:       // Call hook functions for extra processing

12 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("COA", array, "list")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/CaseContentObject.php:
00051:    $key = strlen($conf[$key]) ? $key : 'default';
00052:    $name = $conf[$key];
00053:    $theValue = $this->cObj->cObjGetSingle($name, $conf[$key . '.'], $key);
00054:    if (isset($conf['stdWrap.'])) {
00055:     $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);

11 TYPO3\CMS\Frontend\ContentObject\CaseContentObject::render(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00737:      $contentObject = $this->getContentObject($name);
00738:      if ($contentObject) {
00739:       $content .= $contentObject->render($conf);
00740:      } else {
00741:       // Call hook functions for extra processing

10 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("CASE", array, "tt_content")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00723:     // Getting the cObject
00724:     $GLOBALS['TT']->incStackPointer();
00725:     $content .= $this->cObjGetSingle($name, $conf, $key);
00726:     $GLOBALS['TT']->decStackPointer();
00727:    } else {

9 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("<tt_content", NULL, "")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentContentObject.php:
00115:         $this->cObj->lastChanged($row['tstamp']);
00116:         $cObj->start($row, $conf['table']);
00117:         $tmpValue = $cObj->cObjGetSingle($renderObjName, $renderObjConf, $renderObjKey);
00118:         $cobjValue .= $tmpValue;
00119:        }

8 TYPO3\CMS\Frontend\ContentObject\ContentContentObject::render(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00737:      $contentObject = $this->getContentObject($name);
00738:      if ($contentObject) {
00739:       $content .= $contentObject->render($conf);
00740:      } else {
00741:       // Call hook functions for extra processing

7 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("CONTENT", array, "subparts.mainContent")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/TemplateContentObject.php:
00140:      $this->cObj->data[$this->cObj->currentValKey] = $GLOBALS['TSFE']->register['SUBPART_' . $theKey];
00141:      // Get subpart cObject and substitute it!
00142:      $subpartArray[$PRE . $theKey . $POST] = $this->cObj->cObjGetSingle($theValue['name'], $theValue['conf'], 'subparts.' . $theKey);
00143:     }
00144:     // Reset current to empty

6 TYPO3\CMS\Frontend\ContentObject\TemplateContentObject::render(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00737:      $contentObject = $this->getContentObject($name);
00738:      if ($contentObject) {
00739:       $content .= $contentObject->render($conf);
00740:      } else {
00741:       // Call hook functions for extra processing

5 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGetSingle("TEMPLATE", array, "10")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php:
00685:     if (intval($theKey) && !strstr($theKey, '.')) {
00686:      $conf = $setup[$theKey . '.'];
00687:      $content .= $this->cObjGetSingle($theValue, $conf, $addKey . $theKey);
00688:     }
00689:    }

4 TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::cObjGet(array)

/Applications/MAMP/htdocs/DLA2/typo3/sysext/frontend/Classes/Page/PageGenerator.php:
00229:   $GLOBALS['TT']->incStackPointer();
00230:   $GLOBALS['TT']->push($GLOBALS['TSFE']->sPre, 'PAGE');
00231:   $pageContent = $GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup);
00232:   if ($GLOBALS['TSFE']->pSetup['wrap']) {
00233:    $pageContent = $GLOBALS['TSFE']->cObj->wrap($pageContent, $GLOBALS['TSFE']->pSetup['wrap']);

3 TYPO3\CMS\Frontend\Page\PageGenerator::renderContent()

/Applications/MAMP/htdocs/DLA2/typo3/sysext/cms/tslib/pagegen.php:
00050: if (!$GLOBALS['TSFE']->isINTincScript()) {
00051:  $TT->push('pagegen.php, render');
00052:  \TYPO3\CMS\Frontend\Page\PageGenerator::renderContent();
00053:  $GLOBALS['TSFE']->setAbsRefPrefix();
00054:  $TT->pull();

2 include("/Applications/MAMP/htdocs/DLA2/typo3/sysext/cms/tslib/pagegen.php")

/Applications/MAMP/htdocs/DLA2/typo3/sysext/cms/tslib/index_ts.php:
00192:   include $temp_theScript;
00193:  } else {
00194:   include PATH_tslib . 'pagegen.php';
00195:  }
00196:  $TSFE->generatePage_postProcessing();

1 require("/Applications/MAMP/htdocs/DLA2/typo3/sysext/cms/tslib/index_ts.php")

/Applications/MAMP/htdocs/DLA2/index.php:
00039:  ->redirectToInstallToolIfLocalConfigurationFileDoesNotExist();
00040: 
00041: require(PATH_tslib . 'index_ts.php');
00042: ?>
Unbekannter Benutzer ·

Der Redirect selbst ist in Ordnung. Die ext_localconf.php ist auch in Ordnung, wird aber in diesem Fall ignoriert.
Um den Fehler beheben zu können, muss die Action mit in die Flexform eingetragen werden.

<numIndex index="0">
	<numIndex index="0">Start</numIndex>
	<numIndex index="1">Entry->initialize;Entry->failure</numIndex>
</numIndex>

Cache leeren nicht vergessen 😉

Du hattest erwähnt das dir die Flexform nicht wirklich geholfen hat, könntest du dann in diesem Fall ein Auszug deiner Flexform posten? 😉

Gruß,
Ruven

hmadla ·

Es gab ein kleines Problem in der ext_localconf.php, die korrekte Version ist diese:

<?php

if (!defined('TYPO3_MODE')) {
	die ('Access denied.');
}

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
	$_EXTKEY,
	'Pi1',
	array(
		'Entry' => 'index, failure, success, main',
	), array(
		'Entry' => 'index, failure, success, main',
	)
);

?>

Durch Verwendung von forward anstelle von redirect konnte das Problem dann gelöst werden.