Stumped by this one. This code is giving me
PHP Fatal error: Call to undefined method 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!".
I'm in the process of upgrading to 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.
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. Because APC cache is bad your script fails on the seconds run.
See this bugs for references php #61219 and php #60658