On 4/24/07, Ci <[EMAIL PROTECTED]> wrote:
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?
I believe that the source string needs to be 0 terminated (\0). Don't ask me how to fix it ;) Tijnema
