Answer the question
In order to leave comments, you need to log in
Newbie problems with zend API?
When working with zval in the function, there is no way to find the string index in the input array using the zend_hash_find function. Brief listing:
PHP_FUNCTION(test){
HashTable *array1;
zval **value1;
char *key1 = "one";
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "H", &array1) == FAILURE) {
RETURN_NULL();
}
if(zend_hash_find(array1, key1, strlen(key1), (void **)&value1) == FAILURE) {
RETURN_BOOL(0);
}
RETURN_BOOL(1);
}
Answer the question
In order to leave comments, you need to log in
Missed an error. instead of strlen(key1), you need strlen(key1) +1. Otherwise, the end-of-line character '\0' is ignored
Try to localize the problem by selecting other functions with different parameters, try with PHP too
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question