#71464Misspelling of the variable field prevents the use of dynamical subject in form postprocessing
Description
Subject of the bug is the postprocessing function of the form sysext to send the emails.
file:
sysext/form/Classes/PostProcess/MailPostProcessor.php
According to the code, if there is no “subject” defined but a form field is defined as the subject field we use the data from the form field instead.
line: 139
protected function setSubject() {
if (isset($this->typoScript['subject'])) {
$subject = $this->typoScript['subject'];
} elseif ($this->getTypoScriptValueFromIncomingData('subject') !== NULL) {
$subject = $this->getTypoScriptValueFromIncomingData('subject');
} else {
$subject = 'Formmail on ' . GeneralUtility::getIndpEnv('HTTP_HOST');
}
$subject = $this->sanitizeHeaderString($subject);
$this->mailMessage->setSubject($subject);
}
The part
} elseif ($this->getTypoScriptValueFromIncomingData('subject') !== NULL) {
calls the same variable as in the if condition below, resulting in the condition always being false.
line: 482
protected function getTypoScriptValueFromIncomingData($propertyName) {
if (empty($this->typoScript[$propertyName])) {
return NULL;
}
......
According to other name definitions in the same class the part should be changed to
protected function setSubject() {
if (isset($this->typoScript['subject'])) {
$subject = $this->typoScript['subject'];
} elseif ($this->getTypoScriptValueFromIncomingData('subjectField') !== NULL) {
$subject = $this->getTypoScriptValueFromIncomingData('subjectField');
} else {
$subject = 'Formmail on ' . GeneralUtility::getIndpEnv('HTTP_HOST');
}
$subject = $this->sanitizeHeaderString($subject);
$this->mailMessage->setSubject($subject);
}
this way “subjectField” can be defined as the field to hold the subject value
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.