|
Posted by ogrange on 10/21/51 11:28
Hello,
I posted to pecl-dev but got no reply. I'm sorry if you already read
this message on pecl-dev.
I'm experiencing strange behaviour with APC. We use the famous trick
to simulate an abstract class in PHP 4 using is_subclass_of(), as in :
class Object
{
// properties...
function Object()
{
if (!is_subclass_of($this, "Object"))
{
die("Cannot instantiate Object");
}
// etc
}
// methods...
}
and then :
require_once('Object.php');
class User extends Object
{
// more properties...
function User ()
{
Object::Object();
// etc
}
// more methods...
}
This works fine without APC. However, with APC, in some cases,
is_subclass_of($this, "Object")) returns false, instead of true. We
experienced it with two different (not sharing code) applications.
Ironically, I haven't been able to reproduce the bug on the first
application, which is also the simplest, but I can reproduce it in the
second one (which is pretty large).
Context :
Redhat 7.3 + all Fedora Legacy patches (2.4.20-43.7.legacy)
Apache 1.3.33
PHP : 4.4.0 as a DSO
APC : 3.0.8
gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113)
APC was installed with "export PATH=/path/to/apache/bin/ ; pear
install APC" and enabled with "extension = ./apc.so" in php.ini, no
apc.* directives were added. I accepted default choices during the
installation so it uses mmap. I get the same bug with APC pulled from
CVS.
While investigating, I added in Object constructor some code to log
more information : var_dump($this) and get_class($this) correctly
showed $this was of class "user" and at the same time
is_subclass_of($this, 'Object') returned false, which is incoherent.
I wish I could reproduce the problem with a small amount of code so
that I could open a real bug report but I failed to do so for now and
have the bad feeling I could spend days on this, eventually with no
success 8-( Has anyone experienced similar problems ? I couldn't find
any information.
Thanks a lot,
Olivier
[Back to original message]
|