简体   繁体   English

使用E_STRICT错误报告调试Wordpress

[英]Debugging Wordpress with E_STRICT error reporting

I have set error reporting in my development environment to E_STRICT by adding to the top of my wp-config.php file: 通过将wp-config.php文件的顶部添加到我的开发环境中,我已将错误报告设置为E_STRICT:

ini_set( 'error_reporting', E_STRICT );

This shows many places where return values are passed by reference, eg $wp_the_query = &new WP_Query(); 这显示了许多通过引用传递返回值的地方,例如$wp_the_query = &new WP_Query(); throws the error Strict standards: Assigning the return value of new by reference is deprecated in /htdocs/site/wp-settings.php 引发错误Strict standards: Assigning the return value of new by reference is deprecated in /htdocs/site/wp-settings.php

I'm hoping I can simply remove the reference operator and not break this anywhere else, or do I need a more complex solution? 我希望我可以简单地删除引用运算符,而不在其他任何地方破坏它,还是我需要一个更复杂的解决方案? I'm hoping do to better than just turn error_reporting off, that would just feel dirty. 我希望做得比关闭error_reporting更好,那会感觉很脏。

I am running Wordpress 2.7.1 mu, PHP 5.2.6 with Xdebug 2.1.0. 我正在使用Xdebug 2.1.0运行Wordpress 2.7.1亩,PHP 5.2.6。

Edit : As well as passing objects / values by reference, there are plenty of other warnings, including Redefining already defined constructor for class WP_Object_Cache , Creating default object from empty value , Non-static method WP_Http_ExtHTTP::test() should not be called statically , etc. Rather than looking for specific solutions, can you share any experiences in dealing with this mess of code? 编辑 :除了通过引用传递对象/值外,还有许多其他警告,包括Redefining already defined constructor for class WP_Object_CacheCreating default object from empty valueNon-static method WP_Http_ExtHTTP::test() should not be called statically ,而不是寻找特定的解决方案,您可以分享处理这种混乱代码的任何经验吗? I'm okay with modifying the core files, at the risk of losing the ability upgrade in the future. 我可以修改核心文件,但将来会失去升级功能的风险。

Since PHP5, objects are always passed by reference, so the & is not needed here. 从PHP5开始,对象始终通过引用传递,因此此处不需要& You can remove it without having to worry. 您可以删除它而不必担心。 However, it does not hurt either. 但是,它也没有伤害。

Edit: You can find some more information on object references in PHP5 here . 编辑:你可以找到在PHP5对象引用一些更多的信息在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM