Prestashop 1.7 邮件警报 ps_emailalerts.php 错误

Prestashop 1.7 Mail Alerts ps_emailalerts.php error

我遇到了一个有趣的问题,即阻止邮件提醒模块在我的 Prestashop 1.7.5.1 商店中运行。

我刚刚(2019 年 4 月 25 日)安装了来自官方仓库的模块 (https://github.com/PrestaShop/ps_emailalerts)。

我激活它,转到配置,用我的电子邮件填写 "MERCHANT NOTIFICATIONS" 部分,单击保存,我得到这个:

Warning on line 205 in file /var/www/html/shop.example.com/public_html/modules/ps_emailalerts/ps_emailalerts.php
[2] count(): Parameter must be an array or an object that implements Countable

对我输入的每封电子邮件重复一次。

有什么想法吗?

这是由于 PHP 7.3 中的一些更改以及您启用了 PHP 警告这一事实(也许您在 PrestaShop 中打开了 "DEV MODE"?)。

您可以通过三种方式解决此问题:

  1. 降级到 PHP7.1

  2. 编辑第 205 行的 ps_emailalerts.php 文件并在 count() 之前添加一个 is_array() &&,如下所示:

    } elseif (!empty($email) && is_array($email) && count($email) > 0) {

  3. 关闭 php.ini and/or PrestaShop

  4. 中的 PHP 警告和错误

希望对您有所帮助。