Skip to content
Snippets Groups Projects
Commit d14ac266 authored by Benni Mack's avatar Benni Mack Committed by Oliver Bartsch
Browse files

[BUGFIX] Fix PHP warning in FormFieldViewHelper

When using a formField with a property name
that only consists of a number (e.g. a UID),
Fluid will now allow this.

Resolves: #100281
Releases: main, 11.5
Change-Id: Ief95b87af1025f65ac0db1ed0c64b6fcf9c40bbe
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78573


Tested-by: default avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
Tested-by: default avatarcore-ci <typo3@b13.com>
parent 036957d5
Branches
Tags
No related merge requests found
......@@ -118,7 +118,7 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
'formObjectName'
);
if (!empty($formObjectName)) {
$propertySegments = explode('.', $this->arguments['property'] ?? '');
$propertySegments = explode('.', (string)($this->arguments['property'] ?? ''));
$propertyPath = '';
foreach ($propertySegments as $segment) {
$propertyPath .= '[' . $segment . ']';
......@@ -136,7 +136,7 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
$name .= '[__identity]';
}
}
return $name;
return (string)$name;
}
/**
......@@ -256,7 +256,7 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
) {
return;
}
$propertySegments = explode('.', $this->arguments['property']);
$propertySegments = explode('.', (string)($this->arguments['property'] ?? ''));
// hierarchical property. If there is no "." inside (thus $propertySegments == 1), we do not need to do anything
if (count($propertySegments) < 2) {
return;
......@@ -296,7 +296,7 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
*/
protected function getPropertyValue()
{
if ($this->arguments['property'] === null) {
if (!isset($this->arguments['property'])) {
return null;
}
$viewHelperVariableContainer = $this->renderingContext->getViewHelperVariableContainer();
......@@ -311,7 +311,7 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
FormViewHelper::class,
'formObject'
);
return ObjectAccess::getPropertyPath($formObject, $this->arguments['property']);
return ObjectAccess::getPropertyPath($formObject, (string)$this->arguments['property']);
}
/**
......@@ -364,7 +364,7 @@ abstract class AbstractFormFieldViewHelper extends AbstractFormViewHelper
FormViewHelper::class,
'formObjectName'
);
return $originalRequestMappingResults->forProperty($formObjectName)->forProperty($this->arguments['property']);
return $originalRequestMappingResults->forProperty($formObjectName)->forProperty((string)$this->arguments['property']);
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment