# Internal properties

- Thread: https://externals.io/message/11456
- Original archive: https://news-web.php.net/php.internals/11456
- Started by Andrei Zmievski on 2004-07-22T06:01:30+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #11456 — Andrei Zmievski — 2004-07-22T06:01:30+00:00

URL: https://externals.io/message/11456#11456

Hi,

I saw this in zend_opcode.c zend_cleanup_class_data():

       /* Note that only run-time accessed data need to be cleaned up,
		* pre-defined data can not contain objects and thus are not probelmatic */

Which lead me to look into zend_declare_property() and I noticed that
you cannot declare properties that are objects/arrays/resources. Is
there a good reason for disallowing extension authors to do that?

Alternatively, do you suggest using zend_hash_update() on class
properties even though I really need this property to be static so its
shared by all instances of the class?

-Andrei
* Unix is user friendly, it is just chooses its users selectively. *

---

## #11457 — Andi Gutmans — 2004-07-22T06:16:10+00:00

URL: https://externals.io/message/11456#11457 · In reply to: #11456

At 11:01 PM 7/21/2004 -0700, Andrei Zmievski wrote:
>Hi,
>
>I saw this in zend_opcode.c zend_cleanup_class_data():
>
>        /* Note that only run-time accessed data need to be cleaned up,
>                 * pre-defined data can not contain objects and thus are 
> not probelmatic */
>
>Which lead me to look into zend_declare_property() and I noticed that
>you cannot declare properties that are objects/arrays/resources. Is
>there a good reason for disallowing extension authors to do that?

The problem is that objects and resources can't really stay alive in 
between requests because those mechanisms are shutdown at rshutdown. Arrays 
also can't stay alive because they need to be emalloc()'ed or they won't 
work with the engine. I think it'd be quite complex to change this behavior 
and the work around probably needs to be in the extension depending on how 
bad it is to recreate these or somehow cache them for rinit.

>Alternatively, do you suggest using zend_hash_update() on class
>properties even though I really need this property to be static so its
>shared by all instances of the class?

If these are per-request statics it can probably be solved.

Andi

---

## #11473 — Andrei Zmievski — 2004-07-22T17:45:14+00:00

URL: https://externals.io/message/11456#11473 · In reply to: #11457

> > […]
> 
> If these are per-request statics it can probably be solved.

How could it be solved?

- Andrei

---

## #11474 — Marcus Boerger — 2004-07-22T18:44:38+00:00

URL: https://externals.io/message/11456#11474 · In reply to: #11457

Hello Andi,

Thursday, July 22, 2004, 8:16:10 AM, you wrote:

> At 11:01 PM 7/21/2004 -0700, Andrei Zmievski wrote:
> > […]

> The problem is that objects and resources can't really stay alive in 
> between requests because those mechanisms are shutdown at rshutdown. Arrays
> also can't stay alive because they need to be emalloc()'ed or they won't 
> work with the engine.

I rememer seeing a patch that gave anything that was allocated (either
malloc or emalloc or whatever_alloc) a destructor function pointer alias
free. Wouldn't that solve any related problem?

-- 
Best regards,
 Marcus                            mailto:helly@php.net
