Project

General

Profile

Actions

Bug #97834

closed

Exception when AdvancedPassword is used

Added by Ralf Zimmermann over 2 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2022-06-30
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:
Remote Sprint

Description

The new type hint ?object $object in EXT:fluid AbstractFormViewHelper:renderHiddenIdentityField leads to errors in combination with the EXT:form AdvancedPassword form element after the form was submitted.

main: https://github.com/TYPO3/typo3/blob/main/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php#L75
v11.5: https://github.com/TYPO3/typo3/blob/11.5/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php#L80


(1/1) TypeError

TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper::renderHiddenIdentityField(): Argument #1 ($object) must be of type ?object, string given, called in /var/www/html/packages/TYPO3.CMS/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php on line 258
in /var/www/html/packages/TYPO3.CMS/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php line 75

     * @param string|null $name Name
     * @return string A hidden field containing the Identity (uid) of the given object
     * @see \TYPO3\CMS\Extbase\Mvc\Controller\Argument::setValue()
     */
    protected function renderHiddenIdentityField(?object $object, ?string $name): string
    {
        if ($object instanceof LazyLoadingProxy) {
            $object = $object->_loadRealInstance();
        }

at TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper->renderHiddenIdentityField('e', 'xxx-1[advancedpassword-1]')
in /var/www/html/packages/TYPO3.CMS/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php line 258

        $propertySegmentsCount = count($propertySegments);
        for ($i = 1; $i < $propertySegmentsCount; $i++) {
            $object = ObjectAccess::getPropertyPath($formObject, implode('.', array_slice($propertySegments, 0, $i)));
            $objectName .= '[' . $propertySegments[$i - 1] . ']';
            $hiddenIdentityField = $this->renderHiddenIdentityField($object, $objectName);
            // Add the hidden identity field to the ViewHelperVariableContainer
            $additionalIdentityProperties = $viewHelperVariableContainer->get(
                FormViewHelper::class,
                'additionalIdentityProperties'

at TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper->addAdditionalIdentityPropertiesIfNeeded()
in /var/www/html/packages/TYPO3.CMS/typo3/sysext/fluid/Classes/ViewHelpers/Form/PasswordViewHelper.php line 78

        $this->tag->addAttribute('type', 'password');
        $this->tag->addAttribute('name', $name);
        $this->tag->addAttribute('value', $this->getValueAttribute());

        $this->addAdditionalIdentityPropertiesIfNeeded();
        $this->setErrorClassAttribute();

        return $this->tag->render();
    }

at TYPO3\CMS\Fluid\ViewHelpers\Form\PasswordViewHelper->render()
at call_user_func(array(object(TYPO3\CMS\Fluid\ViewHelpers\Form\PasswordViewHelper), 'render'))
in /var/www/html/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 264

     */
    protected function callRenderMethod()
    {
        if (method_exists($this, 'render')) {
            return call_user_func([$this, 'render']);
        }
        if ((new \ReflectionMethod($this, 'renderStatic'))->getDeclaringClass()->getName() !== AbstractViewHelper::class) {
            // Method is safe to call - will not recurse through ViewHelperInvoker via the default
            // implementation of renderStatic() on this class.

at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->callRenderMethod()
in /var/www/html/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 252

    {
        $this->validateArguments();
        $this->initialize();

        return $this->callRenderMethod();
    }

    /**
     * Call the render() method and handle errors.

at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper->initializeArgumentsAndRender()
in /var/www/html/vendor/typo3fluid/fluid/src/Core/ViewHelper/ViewHelperInvoker.php line 79

            }
            $viewHelper->setRenderingContext($renderingContext);
            $viewHelper->setArguments($evaluatedArguments);
            $viewHelper->handleAdditionalArguments($undeclaredArguments);
            return $viewHelper->initializeArgumentsAndRender();
        } catch (Exception $error) {
            return $renderingContext->getErrorHandler()->handleViewHelperError($error);
        }
    }

at TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker->invoke('TYPO3\\CMS\\Fluid\\ViewHelpers\\Form\\PasswordViewHelper', array('additionalAttributes' => '', 'data' => null, 'aria' => null, 'name' => null, 'value' => null, 'property' => 'advancedpassword-1.password', 'disabled' => null, 'maxlength' => null, 'placeholder' => null, 'readonly' => null, 'autocomplete' => null, 'size' => null, 'errorClass' => 'error', 'class' => 'input-medium form-control', 'dir' => null, 'id' => 'xxx-1-advancedpassword-1', 'lang' => null, 'style' => null, 'title' => null, 'accesskey' => null, 'tabindex' => null, 'onclick' => null), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext), object(Closure))
in /var/www/html/vendor/typo3fluid/fluid/src/Core/ViewHelper/AbstractViewHelper.php line 524

     */
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
    {
        $viewHelperClassName = get_called_class();
        return $renderingContext->getViewHelperInvoker()->invoke($viewHelperClassName, $arguments, $renderingContext, $renderChildrenClosure);
    }

    /**
     * Save the associated ViewHelper node in a static public class variable.

at TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper::renderStatic(array('additionalAttributes' => '', 'data' => null, 'aria' => null, 'name' => null, 'value' => null, 'property' => 'advancedpassword-1.password', 'disabled' => null, 'maxlength' => null, 'placeholder' => null, 'readonly' => null, 'autocomplete' => null, 'size' => null, 'errorClass' => 'error', 'class' => 'input-medium form-control', 'dir' => null, 'id' => 'xxx-1-advancedpassword-1', 'lang' => null, 'style' => null, 'title' => null, 'accesskey' => null, 'tabindex' => null, 'onclick' => null), object(Closure), object(TYPO3\CMS\Fluid\Core\Rendering\RenderingContext))
in /var/www/html/var/cache/code/fluid_template/partial_AdvancedPassword_5fc9c3846dcca9980cf7256ba335450f77bde3b2.php line 110

);$arguments18['element'] = $renderingContext->getVariableProvider()->getByPath('element', $array20);
$arguments18['property'] = 'fluidAdditionalAttributes';
$arguments10['additionalAttributes'] = TYPO3\CMS\Form\ViewHelpers\TranslateElementPropertyViewHelper::renderStatic($arguments18, $renderChildrenClosure19, $renderingContext);

$output9 .= TYPO3\CMS\Fluid\ViewHelpers\Form\PasswordViewHelper::renderStatic($arguments10, $renderChildrenClosure11, $renderingContext);

$output9 .= '
            ';
// Rendering ViewHelper TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #94428: Extbase Request implements ServerRequestInterfaceClosed2021-06-29

Actions
Actions #1

Updated by Björn Jacob over 2 years ago

  • Sprint Focus set to Remote Sprint
Actions #2

Updated by Björn Jacob over 2 years ago

  • Status changed from New to Accepted
Actions #3

Updated by Gerrit Code Review over 2 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/75004

Actions #4

Updated by Anonymous over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #5

Updated by Christian Kuhn over 2 years ago

  • Related to Feature #94428: Extbase Request implements ServerRequestInterface added
Actions #6

Updated by Benni Mack about 2 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF