【发布时间】:2010-11-01 07:47:23
【问题描述】:
我已通过添加到我的 wp-config.php 文件顶部将我的开发环境中的错误报告设置为 E_STRICT:
ini_set( 'error_reporting', E_STRICT );
这显示了许多通过引用传递返回值的地方,例如$wp_the_query = &new WP_Query(); 抛出错误Strict standards: Assigning the return value of new by reference is deprecated in /htdocs/site/wp-settings.php
我希望我可以简单地删除引用运算符而不在其他任何地方破坏它,还是我需要更复杂的解决方案?我希望做得比仅仅关闭 error_reporting 更好,那样会感觉很脏。
我正在运行 Wordpress 2.7.1 mu、PHP 5.2.6 和 Xdebug 2.1.0。
编辑:
除了通过引用传递对象/值之外,还有很多其他警告,包括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 等。与其寻找具体的解决方案,您能否分享处理这种混乱的任何经验代码?我可以修改核心文件,但将来可能会失去能力升级。
【问题讨论】:
标签: php wordpress coding-style