Project

General

Profile

Actions

Bug #71464

closed

Misspelling of the variable field prevents the use of dynamical subject in form postprocessing

Added by Dimitri Lavrenük about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Should have
Category:
Form Framework
Target version:
-
Start date:
2015-11-10
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
No
Sprint Focus:

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

Actions

Also available in: Atom PDF