Typecho1.2.0版本中Comment2Mail插件无法使用的解决方法


插件地址为:https://gitee.com/HoeXhe/typecho-Comment2Mail

BUG描述

  当用户在发布一个主楼层评论的时候没有问题,Comment2Mail插件不会报错,但是当用户在评论主楼层的评论时,会抛出一个错误,其问题本质就是在获取不到上一级楼层评论对象,不会自动发起邮件通知。具体错误信息如下:

Argument1passedtoTypecho\Widget::__construct()mustbeaninstanceofTypecho\Widget\Request,instanceofTypecho\Requestgiven,calledin/xxx/www/1crh.cn/usr/plugins/Comment2Mail/Plugin.phponline173`

解决方案

  抛出的错误提示是Plugin.php的第173行的代码,具体代码如下:

$widget = new Widget_Abstract_Comments(new Typecho_Request(), new Typecho_Response());

  解决方法是将new Widget_Abstract_Comments(new Typecho_Request(), new Typecho_Response());替换为Widget_Base_Comments::alloc()即可。

// $widget = new Widget_Abstract_Comments(new Typecho_Request(), new Typecho_Response());
$widget = Widget_Base_Comments::alloc();

  这个方法我也是在Github上一个Issue找到的,鉴于Github连接不稳定,就将方法更新到自己的博客上。原地址:https://github.com/typecho/typecho/issues/1192

声明:极客角度|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA协议进行授权

转载:转载请注明原文链接 - Typecho1.2.0版本中Comment2Mail插件无法使用的解决方法


拒绝拖延,勇于表达!