Re: Extension class inherit from PHP class
| From: | Johannes Schlüter | Date: | Fri, 09 Apr 2010 15:36:15 +0000 |
| Subject: | Re: Extension class inherit from PHP class | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-7142@lists.php.net to get a copy of this message | ||
On Thu, 2010-04-08 at 16:33 -0700, Trevan Richins wrote:
> I'm wondering if it is possible to have a class defined in a C extension
> inherit from a class defined in PHP.
[...]
> Is there something that I'm missing or is this even possible?
It's nothing that's supposed tobe possible. The engine is designed in a
way that internal classes are registered on module startup and survive
multiple requests and are destroyed on PHP module shutdown.
The only hack to do what you want I can image is to manually unregister
it on request shutdown. While I have no idea what the consequences for
opcode caches and similar thing might be.
> If you are wondering why I'm doing this, it is an attempt to speed up legacy
> code. I plan to move slow methods from Grandchild to Child while leaving
> the normal hierarchy intact.
Well, I'd rather rethink the approach. Either make your internal class
the base class or make the existing functions proxies calling global
function/methods from some specific class.
johannes