最近访客
百度未收录

Discuz! remote_service mod_index has a deprecated constructor 报错与解决办法

Discuz 系统中出现如下报错:

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; remote_service has a deprecated constructor in …\\api\\remote\\index.php on line 111

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP; mod_index has a deprecated constructor in …\\api\\remote\\mod\\mod_index.php on line 14

PHP Notice:  Undefined index: mod in …\\connect.php on line 10

前面两个报错

都是由一个原因引起的:使用了和类名相同的方法作为构造方法。(目前官方已经不建议使用该方法构建),目前该问题还是会出现一些老版本的DZ程序中。

解决办法:

按照系统报错提示,打开该类的所在文件,然后将类名相同的方法名改为__construct。细节问题可以参考PHP手册中的魔术方法一节。

PHP Notice:  Undefined index: mod in …\\connect.php on line 10 报错

这个问题的出现是因为Discuz! connect.php中使用了可能不存在的超全局变量$_GET的索引值

解决办法:

打开connect.php 搜索

if($_GET[\'mod\'] == \'register\')

修改为

if(filter_has_var(INPUT_GET, \'mod\') && $_GET[\'mod\'] == \'register\') 

Discuz!有大量的BUG和代码错误,一旦发现就要纠正,否则很容易被黑客利用。

温馨提示: 本文最后更新于2022/10/20 00:53:39。若文章内容或图片失效,请 留言联系站长反馈!
!
也想出现在这里? 联系我们
创意广告
© 版权声明
THE END
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    请登录后查看评论内容