Totally Zenned
- Join Date:
- Aug 2007
- Location:
- Gijón, Asturias, Spain
- Posts:
- 2,880
- Plugin Contributions:
- 7
Debug log created when changing admin options on php 5.6+ LOCAL installation
(Windows 10, Xampp 7.04/php7.04)
php 5.6 introduced SSL certificate verification. So when phpmailer tries to send an auto email for the change of an admin options on a LOCAL/development server AND the certificate is self-signed, it cannot, and generates a debug log along the lines of
[08-Apr-2016 11:13:32 Europe/Madrid] PHP Warning: stream_socket_enable_crypto(): Peer certificate .... did not match expected CN=.........in .............\includes\classes\vendors\PHPMailer\class.smtp.php on line 350
.....
.....
08-Apr-2016 11:13:32 Europe/Madrid] PHP Notice: Email Error: SMTP connect() failed.
To get round this I put this in class.smtp.php
public function connect($host, $port = null, $timeout = 30, $options = array()) {
//steve to stop local debug errors
if (file_exists('includes/local/configure.php')) {
if (count($options) == 0) {
$options['ssl'] = array('verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true);
}
}
//eof
static $streamok;
...but I don't like this in the core code.
Anyone can suggest a cleaner solution?
Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...