Re: Re: access to variables
| From: | Ci | Date: | Tue, 24 Apr 2007 14:28:42 +0000 |
| Subject: | Re: Re: access to variables | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-28979@lists.php.net to get a copy of this message | ||
Stefan Esser napisał(a):
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));
}
I tried to use it. I figured out that zend_hash_find function returns SUCCESS, but when the strlcpy is executed I can't do anything after that. I'm thinking about writing results to file.
I used:
FILE *log;
log = fopen("/var/log/mail_spam", "w");
fprintf(log, "data: %s", buffer);
It writes any data I want but only when I don't execute strlcpy (or strcpy) function. What could be the problem?