Re: How do I access a hash from an extention/module?
| From: | Eric Veldhuyzen | Date: | Thu, 06 Jun 2002 09:43:55 +0000 |
| Subject: | Re: How do I access a hash from an extention/module? | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-84923@lists.php.net to get a copy of this message | ||
On Thu, Jun 06, 2002 at 11:27:06AM +0200, Markus Fischer wrote:
> You can fech the zval * for _SESSION from the
> EG(symbol_table), e.g. something like this (untested):
>
> zval **z_sess;
> if (zend_hash_find(&EG(symbol_table), "_SESSION",
> sizeof("_SESSION")-1, (void**)&z_sess) == SUCCESS) {
> ...
> }
Well, this doesn't work. The _SESSION thing is something of another ext
module (the session module), and I haven't been able to access anything
from that directly.
But I have worked around that, I can simply check whether a variable is
registered in a session by calling the session_is_registered function
from the session module (by using the call_user_function_ex() function).
I don't think it is very pretty, but it works...
Normal variables can then be fetched by using this zend_hash_find()
function. But if it is an array or a hash the zend_hash_find function
fails. I've got no idea why. And even if it would work I would still
have no clue about how the access the key/value pairs in this
array/hash.
It would be nice it there was some REAL documentation about the API...
--
#!perl # Life ain't fair, but root passwords help.
# Eric Veldhuyzen eric@terra.telemediair.nl
$!=$;=$_+(++$_);($:,$~,$/,$^,$*,$@)=$!=~ # Perl Monger
/.(.)...(.)(.)....(.)..(.)..(.)/;
$^$~$/$: $^$*$@$~ $_>&$;