FluidTYPO3 / flux

TYPO3 extension Flux: Dynamic Fluid FlexForms
https://fluidtypo3.org
146 stars 212 forks source link

[BUG][TYPO3-7.6.16] mailform dont work with flux 8.0.2 #1358

Closed lucasinteractive closed 7 years ago

lucasinteractive commented 7 years ago

Problem: The default TYPO3 Form element does not work while the extension flux (8.0.2) ist installed. The form is displayed on FE. But submitting the form results in an uncaught TYPO3 Exception:

Argument 1 passed to TYPO3\CMS\Fluid\View\StandaloneView::setLayoutRootPaths() must be of the type array, null given, called in /www/Packages/Libraries/typo3/cms/typo3/sysext/form/Classes/PostProcess/MailPostProcessor.php on line 510

Reproduce: I tried this with a fresh insalled TYPO 7.6.16. Then only installed extension flux. Added a verry small typoscript and a mailform content element with a submit button only. Tested with PHP 7.0.15

Hints: The exception will not thrown if:

a) The following lines in typo3conf/ext/flux/ext_localconf.php (line 84-87) are removed:

/** @var $extbaseObjectContainer \TYPO3\CMS\Extbase\Object\Container\Container */
$extbaseObjectContainer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\Container\Container::class);
$extbaseObjectContainer->registerImplementation(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::class, \FluidTYPO3\Flux\Configuration\ConfigurationManager::class);
unset($extbaseObjectContainer);

b) The following line 488 in typo3/sysext/form/Classes/PostProcess/MailPostProcessor.php is changed from:

$typoScript = $configurationManager
    ->getConfiguration(
        \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK
    );

to:

$typoScript = $configurationManager
    ->getConfiguration(
        \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
        'form'
    );
bednee commented 7 years ago

I can confirm this happening with Flux 8.1.0 under TYPO3 7.6.16

NamelessCoder commented 7 years ago

This is technically a fault of EXT:form that it doesn't check if null is returned instead of the expected template paths - the signature of this method is changed on v8+ to require an array and there is no consistent safeguarding against misconfigured TS. Also, if the extension key context is required for the TS to resolve correctly that of course has to be reported on the core issue tracker so it can be added.

I should note that the v8 version of EXT:form uses a base that has fallbacks to guard against this problem (paths can never become non-arrays).

We are only a few days away from dropping 7.6 LTS support so 8.1.0 will most likely be the last 7.6-compatible release - I mention this because at that time, 7.6-related issues will no longer be given priority and any fixes will have to be submitted by users as pull requests targeting the legacy branch. So, please report this problem to the TYPO3 core bug tracker - and if that isn't enough to solve the issue, expect to create a pull request to our legacy branch.

fnagel commented 7 years ago

Run into the same issue. Some temp fix for this might be the following TS overwrite:

[globalVar = TSFE:id = 123]
    config.tx_extbase {
        view.layoutRootPaths {
            11 = EXT:form/Resources/Private/Layouts
        }
        view.templateRootPaths {
            11 = EXT:form/Resources/Private/Templates
        }
        view.partialRootPaths {
            11 = EXT:form/Resources/Private/Partials
        }
    }
[global]

Ugly but works for my use case without side effects. Test carefully!

NamelessCoder commented 7 years ago

Will close this issue as there is an explanation for it along with a workaround - and the problem does not exist in currently supported versions.

Thanks for the detailed investigation @lucasinteractive - and thanks for the workaround @fnagel!

RauchF commented 6 years ago

This issue again appears with EXT:flux version 8.2.1 on a TYPO3 7.6.23 installation, the error is exactly the same. As the flux 8.2 branch is still supported and compatible with 7.6, is there any chance of a fix?