Don't completely follow you since I don't have the required knowledge of the
Zend Engine (yet). The problem that I ran into (I think) was that
destroy_zend_class gets called before rshutdown and it was releasing the
entries in the constants_table before I had a chance to do it, hence the
patch which lets the engine manage them.

Sorry if I'm totally lost, but I don't understand why class constants would
be handled any differently than properties which are created and destroyed
with the class. (Which, on the surface at least, appears to work, they get
released during destroy_zend_class).

Bob Silva



-----Original Message-----
From: Andi Gutmans [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 14, 2004 5:14 PM
To: Robert Silva; [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] [PATCH] Resubmitted for review

Hi Robert,

If I remember correctly, we came to the conclusion a while ago, that unless 
we make some big changes (which I'm not quite sure yet how far reaching 
they would be), then we could not malloc() constants. You would really need 
to emalloc()/efree() them on each request because the engine could connect 
to these malloced()'ed variables and all hell would break loose. Also we do 
a zval_update_constant() today in order to initialize constants with 
constants just before they are being used the first time.

What this basically means that you'd initialize and free these constants in 
RINIT()/RSHUTDOWN(). Not too sexy but looking at how much this is needed 
it's not too bad.

Andi

At 11:54 PM 10/11/2004 -0700, Robert Silva wrote:
>This patch allows php extension authors to declare constants on internal
>objects. This pretty much just duplicates the zend_declare_property_*
>functions but for constants. Currently there is no way for C level class
>authors to declare constants on their objects since the engine has to
>allocate space for them.
>
>Bob Silva
>
>--
>PHP Internals - PHP Runtime Development Mailing List
>To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to