Issue Bug Closed

#36937Custom Swift_Transport is impossible due to wrong variable

Georg Ringer 05/07/12, 23:20 updated 10/23/17, 22:15

Description

Because of a wrong variable it is impossible to implement a custom Swift_Transport

Imagine you want to do an own Swift_Transport implementation you add

$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'Tx_Fo_Bar';

but because of the constructor being called without any special name, it is tried to look the default one up in the TYPO3_CONF_VARS as stated in the comment
—-
Swift_Transport optionally pass a transport to the constructor. By default the configured transport from $TYPO3_CONF_VARS is used
——

current code

$customTransport = t3lib_div::makeInstance($mailSettings['transport'], $mailSettings);
if ($this->transport instanceof Swift_Transport) {
    $this->transport = $customTransport;
} else {
    throw new RuntimeException(
        $mailSettings['transport'] . ' is not an implementation of Swift_Transport,
        but must implement that interface to be used as a mail transport.',
        1323006478
    );
}

therefore $this->transport will never be an instanceof Swift_Transport as it will be always empty at that place. needs to be of course $customTransport

Reviews 2