On 4/24/07, Ci <[EMAIL PROTECTED]> wrote:
I tried to use smth like that:

zval *data = NULL;

zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]),
       "DOCUMENT ROOT", sizeof("DOCUMENT ROOT"), &data);
strcpy(buffer, Z_STRVAL_P(data);

Then I write the buffer to file, but I don't get correct variable.
I'm working with php-5.2.1.

Am I in a good way to solve my problem?

Regards,
Ci

Ok, i don't know a lot about the core of PHP, but i do know the C language.

First of all, i don't see you declaring buffer somewhere, i guess you
did it without showing, or that it is in the core. But if it isn't
both, you should do :)
Also note that buffer should be declared as char *buffer to be able to
use the strcpy function on it.

Second, when you're using the strcpy function, you have 2 '(' used,
and only one ')'
I guess this is a type here. (else it would return error on compilation i guess)

Third, the function strcpy also has a return value. It should be
returned to a pointer to the string where it is copied to.
so it would become:
buffer = strcpy(buffer,Z_STRVAL_P(data));

If all above noted is correct, then it is a problem with your
zend_hash_find function, but as i noted already, i don't know a lot of
the PHP core, so i can't help further with it.

Tijnema

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

Reply via email to