Config option "NONE" has empty value instead of "none"
Closed this issue · 1 comments
Hatsunga commented
Config option "NONE" has empty value instead of "none"
Preconditions
- Magento 2.3.1
- PHP 7.2
Steps to reproduce
- Open Backend configuration of the module
- Select "NONE" for "Protocol" or for "Authentication"
- Save Config
Expected result
The value "none" will be saved and used when sending an Email.
Actual result
An empty value is used when sending an Email.
This breaks a few conditions inside "KiwiCommerce\EnhancedSMTP\Email\Transport.php".
Most critically:
$auth = strtolower($this->config->getConfig(Config::ENHANCED_SMTP_AUTH));
if ($auth != 'none') {
$options->setConnectionClass($auth);
$connectionConfig = [
'username' => $this->config->getConfig(Config::ENHANCED_SMTP_USERNAME),
'password' => $this->config->getConfig(Config::ENHANCED_SMTP_PASSWORD)
];
}
Since $auth != 'none' is matched, because an empty value != 'none', the ConnectioClass will be an empty value. This causes a critical error, since the Zend PluginManager tries to load the class ''.
I found, that inside the files
KiwiCommerce\EnhancedSMTP\Model\Config\Source\SMTP\Authentication.php
and
KiwiCommerce\EnhancedSMTP\Model\Config\Source\SMTP\Protocol.php
you return the options:
$options = [
[
'value' => '',
'label' => __('None')
],
....
So either change the conditions searching for a "none" or fix the values provided in the backend configuration ;)
kiwi-commerce commented