You are here: Re: [PHP] is_subclass_of() weird behaviour with APC « PHP « IT news, forums, messages
Re: [PHP] is_subclass_of() weird behaviour with APC

Posted by Jochem Maas on 10/17/60 11:28

ogrange@gmail.com wrote:
> 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"))
> {

could it be a case-sensitivity problem (within APC)
so that maybe this does work?:

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
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация