Ci schrieb:
> Stefan Esser napisaƂ(a):
>> Hello,
>>
>>> zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]),
>>>     "DOCUMENT ROOT", sizeof("DOCUMENT ROOT"), &data);
>>> strcpy(buffer, Z_STRVAL_P(data);
>> It is called DOCUMENT_ROOT, not DOCUMENT ROOT...
> It was mistake in rewriting. If I choose any php variable, such as
> DOCUMENT_ROOT, SERVER_NAME I got data in buffer like: '`5u', '1x'.
> Is that method of getting variable correct?
>
No. The correct way for getting the variable is


zval **data;
...
if (zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]),
"DOCUMENT_ROOT", sizeof("DOCUMENT_ROOT"), &data)==SUCCESS) {
    ...
    strlcpy(buffer, Z_STRVAL_PP(data), sizeof(buffer));
}

-sesser

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

Reply via email to