If this is your first visit, check our documentation. To post, register or login.
Forums / Zen Cart Code Suggestions / Debug log created when changing admin options on php 5.6+ LOCAL installation

Debug log created when changing admin options on php 5.6+ LOCAL installation

Started by torvista on 8 Apr 2016, 9:26 AM · Views: 62

Results 1 to 3 of 3
8 Apr 2016, 9:26 AM
#1
torvista avatar

torvista

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...

12 Apr 2016, 6:16 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: Debug log created when changing admin options on php 5.6+ LOCAL installation

In offline/local test sites I often turn off email entirely, often because I don't need emails from my offline sites ... and I'd never want to accidentally email my customers when testing something within my offline sites.
Admin->Configuration->Email Options->Send Email = false

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

12 Apr 2016, 8:09 AM
#3
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: Debug log created when changing admin options on php 5.6+ LOCAL installation

In offline/local test sites I often turn off email entirely..

Yes...that would have been a more time-efficient solution...still, more knowledge gained in the process.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...