Project

General

Profile

Actions

Bug #97647

open

Forward to referring controller causes Property Mapping exception

Added by Philip Masser almost 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2022-05-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hi folks,

I have an issue where I receive an TYPO3\CMS\Extbase\Property\Exception\InvalidPropertyMappingConfigurationException. The problem arises when a <f:form> is sent to a controller which results in a validation error, and subsequentely is sent back to the referring controller, if that controller also has parameters from a <f:form>.

The problem is that the general TYPO3\CMS\Extbase\Mvc\Controller\ActionController->forwardToReferringRequest rebuilds the controller/action/parameters of the referrer, but NOT the __trustedProperties.
Thus the referring controller is called with its original <f:form> POSTed parameters, but with the trusted fields of the <f:form> parameters for the new (failing) controller.

I built my page based on Extcode/Cart, but the issue comes from the Typo3 Extbase Core and can come from all such situations.

Scenario:
- Page with <f:form> that POSTs data to some controller
- This page has another <f:form> with (similar) fields, posting to another page
- Validation error on second POST => forward to referring controller
- Property Mapper Exception because OLD form fields are checked agains NEW trusted fields

A basic setup can be done with Extcode/Cart and Extcode/Cart-Products, and a slightly modified EXT:cart/Resources/Private/Templates/Cart/Cart/Show.html:

[...]
<f:comment> This is instead of original Cart/OrderForm partial </f:comment>
<f:form id="form-order-address" class="form" 
        name="orderItem" 
        object="{orderItem}" 
        controller="Cart\Cart" 
        action="show" 
        arguments="{step: nextStep}" 
        method="post">
    <f:render partial="Cart/OrderForm/Address/Billing" arguments="{cart:cart, billingAddress:billingAddress}"/>
    <f:form.submit value="Save Address"/>
</f:form>

<f:form id="form-order" class="form" 
        name="orderItem" 
        object="{orderItem}" 
        controller="Cart\Order" 
        action="create" 
        method="post">
    <f:render partial="Cart/OrderForm/Cart" arguments="{_all}"/>
    <f:form.submit value="Order"/>
</f:form>

This renders 2 forms on the cart page, one for Address Editing, Second for Submitting.

When you enter an address and POST via "Save Address", and directly after that click on "Order" without checking the required checkboxes, the error occurs


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #70384: Make it possible to redirect (instead of forwarding) to referring action on validation errorClosed2015-10-05

Actions
Actions #1

Updated by Simon Schaufelberger 3 months ago

  • Related to Feature #70384: Make it possible to redirect (instead of forwarding) to referring action on validation error added
Actions

Also available in: Atom PDF