为了账号安全,请及时绑定邮箱和手机立即绑定

为何覆盖父类方法参数不一致时报致命错误而不是警告?

为何覆盖父类方法参数不一致时报致命错误而不是警告?

PHP
qq_花开花谢_0 2019-03-04 08:43:11
公司的老旧代码了,好多错误,暂时无法一一修复,下面这个子类覆盖父类出错时不应该是警告吗?为什么是error,我的PHP5.6,程序跑不下去了,同事的5.3可以通过继续运行。 2018/03/13 16:00:00 [error] 3073#0: *52 FastCGI sent in stderr: "PHP message: PHP Strict Standards: Declaration of AddressRCache::query() should be compatible with RCache::query($name, $field = NULL, $section = NULL, $lang = NULL, $type = 'json') in /data1/wwwroot/ssss/zc_core/sssss/refactor/cache/structs/address.php on line 72 PHP message: PHP Strict Standards: Declaration of PublicPageQueryKeywords::getResult() should be compatible with PageQuery::getResult() in /data1/wwwroot/ssssss/zc_core/sssssss/refactor/pagequery/location/public/keywords.php on line 290" while reading response header from upstream, client: 192.168.161.92, server: local.ssssss.com, request: "GET /index.php?com=crontab&t=syncOrderToCRM&zmkm=1 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "local.ssssssss.com"
查看完整描述

2 回答

?
胡子哥哥

TA贡献1825条经验 获得超6个赞

5.3以后,重写父类方法时参数个数必须一致

查看完整回答
反对 回复 2019-03-18
?
慕慕森

TA贡献1856条经验 获得超17个赞

父类和子类中使用相同的函数时,子类需要参数,而父类不需要参数时,就会报这个错误。

查看完整回答
反对 回复 2019-03-18
  • 2 回答
  • 0 关注
  • 410 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信