Bug #58878
closedException on form submit
0%
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
Updated by Torsten Crass over 10 years ago
Thanks to the kind and helpful Typo3 forum it turned out that this only happens when running in "Development" mode; when in "Production" context, the form submission gets properly processed. Funny, hovever, that this null pointer issue occurs at all, isn't it?
Regards --
-- Torsten
Updated by Stephan Großberndt over 9 years ago
I just had the same problem with a form. Setting production context helped. Thanks!
Updated by Helmut Hummel over 9 years ago
- Status changed from New to Resolved
Updated by Björn Jacob over 8 years ago
- Category changed from 1602 to Form Framework