本文介绍了错误“PHP致命错误:无法为非对象调用重载函数"是什么意思?方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 GoDaddy Linux 主机上运行了 WordPress 网站.错误 PHP Fatal error: Cannot call Overloaded function for non-object in wp-includes/class-wp.php on line 529 随机发生,通常是为了响应 POST 请求,我认为.

I have WordPress website running on a GoDaddy Linux host. The error PHP Fatal error: Cannot call overloaded function for non-object in wp-includes/class-wp.php on line 529 is being happening at random, usually in response to a POST request, I think.

  • WordPress 版本:3.8
  • PHP 版本:5.4.23

文件wp-includes/class-wp.php的第529行是WP类中以下函数的主体:

Line 529 of file wp-includes/class-wp.php is the body of the following function in class WP:

function init() {
    wp_get_current_user();
}

该错误似乎与 WooCommerce 插件的存在有关.当插件被停用时,我没有看到错误.

The error seems to be somehow related to the presence of the WooCommerce plugin. I haven't seen the error when the plugin is deactivated.

不幸的是,删除 WooCommerce 不是一个选项,所以我需要发现错误是如何触发的并提供解决方案.问题是我不知道该找什么.

Unfortunately, removing WooCommerce is not an option so I need to discover how is the error being triggered and provide a solution. The problem is I don't know what to look for.

我想了解在一般情况下是什么导致了上述错误.

  • 谁能提供一个生成此类错误的 PHP 代码示例?或
  • 解释为什么会发生?

我希望能够使用这些信息在 WooCommerce 的源代码中找到类似的问题.

我快速浏览了 PHP 的解释器源代码(这里这里>) 并找到了生成错误消息的行,但老实说,这对我没有帮助.

I took a quick look at PHP's interpreter source code (here and here) and found the line that generates the error message, but to be honest, that didn't help me.

A SO 中的问题不同应用程序中的相同错误有一个答案,表明问题是由服务器过载引起的.我不认为这是这里的情况.我们没有太多流量.

A question in SO about the same error in a different application has an answer indicating the problem was caused by server overload. I don't think that's the case here. We don't get too much traffic.

A WordPress SE 中的不同问题 提供了两个可能的原因.问题要么与启用的备用 PHP 缓存 (APC) 相关,要么问题是由插件引起的.不幸的是,没有人提供实际的解决方案或具体的原因.

A different question in WordPress SE offers two possible causes. Either the problem is associated with Alternate PHP Cache (APC) being enabled or the problem is caused by a plugin. Unfortunately nobody offers actual solutions or specific causes.

我的情况与上述问题中暴露的情况类似:我启用了 APC(目前正在尝试从 GoDaddy 获取帮助以禁用它)并且我的测试表明 WooCommerce 有一些责任.

My case is similar to the one exposed in the question above: I have APC enabled (currently trying to get help from GoDaddy to disable it) and my tests suggest WooCommerce has some responsibility.

感谢您的帮助.

推荐答案

通过将 php_flag apc.cache_by_default Off 添加到 .htaccess

I was able to solve this for individual sites by adding php_flag apc.cache_by_default Off to .htaccess

这篇关于错误“PHP致命错误:无法为非对象调用重载函数"是什么意思?方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 12:00