Issue Bug Closed

#58878Exception on form submit

Torsten Crass 05/16/14, 16:24 updated 10/02/18, 11:55

Description

Hi there,

I just installed the “form” extension into my 6.2.2 installation and created a very simple mail form:

————8<————
enctype = multipart/form-data
method = post
prefix = tx_form
confirmation =
postProcessor {
1 = mail
1 {
recipientEmail = my (at) email.adress
senderEmail = sender (at) email.address
subject = Test mail
}
}
10 = TEXTLINE
10 {
name = name
label {
value = Name
}
}
20 = SUBMIT
20 {
name = 3
value = Submit form
}
————8<————

When hitting the submit button, I get

————8<————
Uncaught TYPO3 Exception
#1: PHP Warning: Invalid argument supplied for foreach() in /PATH/TO/MY/typo3/typo3_src-6.2.2/typo3/sysext/form/Classes/Utility/ValidatorUtility.php line 125 (More information)

TYPO3\CMS\Core\Error\Exception thrown in file
/PATH/TO/MY/typo3/typo3_src-6.2.2/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 111.

13 TYPO3\CMS\Core\Error\ErrorHandler::handleError(2, “Invalid argument supplied for foreach()”, “/PATH/TO/MY/typo3/typo3_src-6….3/sysext/form/Classes/Utility/ValidatorUtility.php”, 125, array)

/PATH/TO/MY/typo3_src-6.2.2/typo3/sysext/form/Classes/Utility/ValidatorUtility.php:
00123: $this->errors[$prefix] = array();
00124: $result = TRUE;
00125: foreach ($this->rules[$prefix] as $key => $element) { <=====
00126: $rule = $element[‘instance’];
00127: $fieldName = $element[‘fieldName’];

12 TYPO3\CMS\Form\Utility\ValidatorUtility::isValid()

/PATH/TO/MY/typo3/typo3_src-6.2.2/typo3/sysext/form/Classes/Controller/FormController.php:
00153: if (
00154: $submittedByPrefix = NULL ||
00155: !empty($submittedByPrefix) && !$this->validate->isValid() || ===
00156: !empty($submittedByPrefix) && $this->validate->isValid() &&
00157: $this->requestHandler->getPost(‘confirmation-false’, NULL) !== NULL

11 TYPO3\CMS\Form\Controller\FormController::showForm()
…
————8<————

I temporarily introduced some var_dump() statements into both the FormController and the ValidatorUtility around the highlighted lines. According to these, both $submittedByPrefix (FormController) and $prefix (ValidationUtility) contain the expected values, but the $this->rules array (ValidateionUtility) is empty. Hence NULL gets passed to the foreach loop.

Any idea what might be wrong?

Regards —

— Torsten

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.