is_subclass_of() weird behaviour with APC

From: Date: Fri, 30 Sep 2005 16:10:05 +0000
Subject: is_subclass_of() weird behaviour with APC
Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-3032@lists.php.net to get a copy of this message
Hello, 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) APC : 3.0.8 PHP : 4.4.0 gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-113) APC was installed with "export PATH=/apache/bin/ ; pear install APC" and enabled with "extension = ./apc.so" in php.ini, no apc.* directives were added. 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" while is_subclass_of($this, 'Object') returned false, which is incoherent. I wish I could reproduce the problem with a small amount of code that we could use for testing but failed to do so for now 8-( Has anyone experienced similar problems ? I couldn't find any information on this with Google. Thank you, Olivier

« previous php.pecl.dev (#3032) next »