I want to get the cookie information stored using setcookie function in the source code of the php.. not the php source code.. What is the corresponding C code for _COOKIE['xx'];
In other words where is the _COOKIE array created and populated?
I want to get the cookie information stored using setcookie function in the source code of the php.. not the php source code.. What is the corresponding C code for _COOKIE['xx'];
In other words where is the _COOKIE array created and populated?
The $_COOKIE
variable doesn't use JIT (just-in-time initialization), so it's always accessible by reading the global variables table EG(symbol_table)
:
zval **cookie_var;
if (zend_hash_find(&EG(symbol_table), "_COOKIE", sizeof("_COOKIE"),
(void**)&cookie_var) == SUCCESS) {
/* do something with cookie_var */
} else {
/* handle error; shouldn't happen */
}
Cookie info comes as part of your http headers (that the browser sends). PHP makes it easier to access them by parsing it out in to a neat array and putting it in _COOKIE. You'll have to do it in C.