简体   繁体   English

升级到PHP 5.4.0后调用未定义的方法

[英]Call to undefined method after upgrading to PHP 5.4.0

Stumped by this one. 被这一个难倒。 This code is giving me 这段代码给了我

PHP Fatal error: Call to undefined method MyObject::helloWorld() PHP致命错误:调用未定义的方法MyObject :: helloWorld()

But only the second time I run it, the first time it runs fine. 但只是第二次运行它,第一次运行正常。

class MyObject
{

  function __construct()
  {
    echo("creating MyObject...");
  }


  public function helloWorld()
  {
    echo("Hello World!");
  }


}

$obj = new MyObject();
$obj->helloWorld();

I also see "creating MyObject..." generated the second time, but not "Hello World!". 我也看到第二次生成“创建MyObject ...”,但不是“Hello World!”。

I'm in the process of upgrading to PHP 5.4.0. 我正在升级到PHP 5.4.0。

I Must be missing something really obvious. 我必须遗漏一些非常明显的东西。

This is APC bug... you can apply a patch or disable APC in /etc/php.ini or /etc/php.d/apc.ini depending on your configs. 这是APC错误...您可以在/etc/php.ini/etc/php.d/apc.ini应用补丁或禁用APC,具体取决于您的配置。

The first time you run your script the opcode is getting generated and is cached by APC, the second time you run your script opcode is pulled from APC cache. 第一次运行脚本时,操作码生成并由APC缓存,第二次运行脚本操作码从APC缓存中提取。 Because APC cache is bad your script fails on the seconds run. 因为APC缓存很糟糕,所以脚本在秒运行时失败。

See this bugs for references php #61219 and php #60658 请参阅此错误以获取参考php#61219php#60658

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

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