Bug #35894

CheckboxViewHelper and RadioViewHelper missing an existence check for formObject, and thus an exception is being thrown

Added by Sebastian Wojtowicz over 9 years ago. Updated over 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
ViewHelpers
Start date:
2012-04-12
Due date:
% Done:

100%

Estimated time:
0.10 h
Has patch:
No

Description

Scenario:

Controller:
    indexAction(FormObject $formObject = NULL){ ... }
Template:
    <f:form ... object="{formObject}' >
        <f:form.checkbox property="somePropertyOfFormObject" value="yes"/>
        ...
 

This scenario fails with

#1243325768: No value found for key "TYPO3\Fluid\ViewHelpers\FormViewHelper->formObject" 

The problem is that in the CheckboxViewHelper and the RadioViewHelper we call $this->getPropertyValue() which callls $formObject = $this->viewHelperVariableContainer->get('TYPO3\Fluid\ViewHelpers\FormViewHelper', 'formObject'); even though we did not check if the formObject exists, so that instead we get thrown an exception.

For example in CheckboxViewHelper.php, Line 80 before we call getPropertyValue() we only check

if ($this->isObjectAccessorMode())

while all other [InputType]ViewHelper always check (in the getValue() function):
if ($this->isObjectAccessorMode() && $this->viewHelperVariableContainer->exists('TYPO3\Fluid\ViewHelpers\FormViewHelper', 'formObject'))

So I think that in CheckboxViewHelper, Line 80 and in RadioViewHelper, Line 81 there should also be the same check for the existence of the formObject. Unless someone knows of a better place to inject that bugfix.

#1

Updated by Karsten Dambekalns over 9 years ago

  • Target version changed from 1.0.4 to 1.0.5
#2

Updated by Sebastian Wojtowicz over 9 years ago

  • Target version changed from 1.0.5 to 1.1 beta 2
  • % Done changed from 0 to 10

The problem is that we get formObject = NULL
1. ... if we visit the index action
2. ... if the form submit fails

So upper code changes fix the exception, but at least the checkbox code doesn't seem to expect this and so the automatic checked=checked or not checked setting reflecting the last submitted form values simply does not work. So this needs to be fixed as well.

#3

Updated by Gerrit Code Review over 9 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#4

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#5

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#6

Updated by Karsten Dambekalns over 9 years ago

  • Assignee set to Sebastian Wojtowicz
#7

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#8

Updated by Karsten Dambekalns over 9 years ago

  • Target version changed from 1.1 beta 2 to 1.1 RC1
#9

Updated by Gerrit Code Review over 9 years ago

Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#10

Updated by Gerrit Code Review over 9 years ago

Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#11

Updated by Gerrit Code Review over 9 years ago

Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#12

Updated by Gerrit Code Review over 9 years ago

Patch set 8 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/11637

#13

Updated by Gerrit Code Review over 9 years ago

Patch set 1 for branch FLOW3-1.1 has been pushed to the review server.
It is available at http://review.typo3.org/12164

#14

Updated by Gerrit Code Review over 9 years ago

Patch set 2 for branch FLOW3-1.1 has been pushed to the review server.
It is available at http://review.typo3.org/12164

#15

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch FLOW3-1.1 has been pushed to the review server.
It is available at http://review.typo3.org/12164

#16

Updated by Rens Admiraal over 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 10 to 100

Also available in: Atom PDF