Re: Internal class, read_property() and type == BP_VAR_W
| From: | Sara Golemon | Date: | Fri, 28 Oct 2005 19:56:18 +0000 |
| Subject: | Re: Internal class, read_property() and type == BP_VAR_W | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19796@lists.php.net to get a copy of this message | ||
> Hm... maybe I made not a good start with my question, let me ty again,
please:
>
> typedef struct {
> zend_object zo;
> int i;
> } my_obj;
>
> Would you say it's possible that one can maintain i as class
> property with write access through references?
>
Nope, because PHP variables are loose typed.
Say you *did* have some way to bind my_obj->i to a userspace variable (e.g.:
$i =& $this->i; ). The next instruction could say $i = 'foo';, then what is
the engine supposed to do with that?
If you want i to have any visibility in userspace, then it needs to be a
zval, and that means it can be modified, and that means that you'll need to
be prepared to re-cast it back to the right type later. Kinda sucks, but it
sucks for a good reason...
-Sara