#31998faulty check for missing SMTP-port
Description
The install tool explains for $TYPO3_CONF_VARS[‘MAIL’][‘transport_smtp_server’]:
<server:port> of mailserver to connect to. <port> defaults to “25”.<br></port></server:port>
In fact a missing port will not being set to the default SMTP-port (25), but will result in a fatal error:
Warning: fsockopen() [function.fsockopen]: unable to connect to mail.example.org:0 (Failed to parse address "mail.example.org") in (...)/typo3/contrib/swiftmailer/classes/Swift/Transport/StreamBuffer.php on line 233 Fatal error: Uncaught exception 'Swift_TransportException' with message 'Connection could not be established with host mail.example.org [Failed to parse address "mail.example.org" #0]' in (...)/typo3/contrib/swiftmailer/classes/Swift/Transport/StreamBuffer.php:235 (...)
preg_split in t3lib_mail_Mailer::initializeTransport() returns in case of a missing port (and missing colon) for the second part ($port) NULL. Later in this method $port is checked to be an empty string and in that case it would be set to ‘25’. Because NULL is not a string this does not match, if the port and the colon is missing.
Instead of checking $port===’‘ it should be ($port==NULL || $port===’‘).
Tested on:
- Xampp, PHP 5.3.5, Apache/2.2.17 (Win32) mod_ssl/2.2.17 OpenSSL/0.9.8o PHP/5.3.4 mod_perl/2.0.4 Perl/v5.10.1
- MAMP, PHP 5.3.6,
Reviews 7
- TYPO3_4-5 27514[BUGFIX] Namespace usage in test
- TYPO3_4-7 27513[BUGFIX] Namespace usage in test
- TYPO3_4-5 23518[BUGFIX] Faulty check for missing SMTP port
- TYPO3_4-7 23517[BUGFIX] Faulty check for missing SMTP port
- TYPO3_6-0 23516[BUGFIX] Faulty check for missing SMTP port
- TYPO3_6-1 23515[BUGFIX] Faulty check for missing SMTP port
- main 23504[BUGFIX] Faulty check for missing SMTP port