Actions
Bug #31998
closedfaulty check for missing SMTP-port
Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2011-11-22
Due date:
% Done:
100%
Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.2
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:
Description
The install tool explains for $TYPO3_CONF_VARS['MAIL']['transport_smtp_server']:
<server:port> of mailserver to connect to. <port> defaults to "25".
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,
Actions