Project

General

Profile

Actions

Bug #99130

open

Form Variants: Dynamic validators on formValues break in PHP 8

Added by David Nax over 1 year ago. Updated 10 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2022-11-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Since Version 8 PHP breaks when array key not exists. This affects the usage of dynamic validators of form variants as documented here:
https://docs.typo3.org/c/typo3/cms-form/11.5/en-us/I/Concepts/Variants/Index.html#adding-validators-dynamically.

When we use e.g.

condition: 'formValues["country"] == "GB"'

we get the following error
#1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Undefined array key "country" in /var/www/html/vendor/symfony/expression-language/Node/GetAttrNode.php line 97

A possible explanation is that in TYPO3\CMS\Form\Domain\Runtime\FormRuntime , processVariants() is called a number of times (also when the form is initially rendered), but the formValues (which are filled from the formState and the request arguments, see lines 1124ff. ) remain empty until they are filled later. The condition matcher ( line 476 ) then is invoked to match the condition against an empty array with no keys, resulting in the above error.


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Bug #94707: Undefined array key / Trying to access array offset on value of type null / PHP Version 8.0.8Closed2021-08-04

Actions
Related to TYPO3 Core - Bug #95781: PHP Warning: Undefined array key "uid" in /app/vendor/symfony/expression-language/Node/GetAttrNode.phpRejected2021-10-26

Actions
Actions #1

Updated by Gerrit Code Review over 1 year ago

  • Status changed from New 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/+/76693

Actions #2

Updated by Gerrit Code Review over 1 year ago

Patch set 2 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/+/76693

Actions #3

Updated by Gerrit Code Review over 1 year ago

Patch set 3 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/+/76693

Actions #4

Updated by Gerrit Code Review over 1 year ago

Patch set 4 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/+/76693

Actions #5

Updated by Felix Nagel over 1 year ago

  • Related to Bug #94707: Undefined array key / Trying to access array offset on value of type null / PHP Version 8.0.8 added
Actions #6

Updated by Felix Nagel over 1 year ago

  • Related to Bug #95781: PHP Warning: Undefined array key "uid" in /app/vendor/symfony/expression-language/Node/GetAttrNode.php added
Actions #7

Updated by Felix Nagel over 1 year ago

Take a look here #95781

Actions #8

Updated by Gerrit Code Review 12 months ago

Patch set 5 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/+/76693

Actions #9

Updated by Gerrit Code Review 12 months ago

Patch set 6 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/+/76693

Actions #10

Updated by Gerrit Code Review 10 months ago

Patch set 7 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/+/76693

Actions

Also available in: Atom PDF