Project

General

Profile

Actions

Bug #58878

closed

Exception on form submit

Added by Torsten Crass almost 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2014-05-16
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

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


Related issues 2 (0 open2 closed)

Related to TYPO3 Core - Task #64668: Move Mailform to compatibility6ClosedBenni Mack2015-01-30

Actions
Has duplicate TYPO3 Core - Bug #66508: tx_form validator throws exception if no validation rules are setClosed2015-04-21

Actions
Actions #1

Updated by Torsten Crass almost 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

Actions #2

Updated by Stephan Großberndt about 9 years ago

I just had the same problem with a form. Setting production context helped. Thanks!

Actions #3

Updated by Helmut Hummel almost 9 years ago

  • Status changed from New to Resolved

Fixed in master with #64668 and in 6.2 with #66508

Actions #4

Updated by Björn Jacob almost 9 years ago

  • Category set to 1602
Actions #5

Updated by Björn Jacob about 8 years ago

  • Category changed from 1602 to Form Framework
Actions #6

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF