18.09.2020 14:36, Nikita Popov wrote:
ZVAL_STRINGL allocates a per-request string. You'll want to use ZVAL_STR(&val_z, zend_string_init(val, val_len, 1)); or so.
Thank you very much, it helped.
Might I ask a further question?
I want to make a PHP extension call certain functions from external
libraries. The libraries and function names are to be taken from
php.ini, therefore the libraries are to be loaded with dlopen(), and
pointers to functions will be returned by dlsym(). Functions'
signatures are uniform and known at compilation time.
The pointers to the functions are to be stored in a global hashtable
MYEXT_G(libs).
The task is to make sure that these pointers, initialised at PHP_MINIT
stage remain valid and callable while serving HTTP requests.
So, how I should initialise the hashtable, wrap function pointers in
zval and add them to the hashtable?
I tried things like ZVAL_PTR and ZVAL_FUNC but the pointers became
invalid by the time HTTP request was served.
Alexander Mashin