/* {{{ php_ini_available */ static int php_ini_available(zval *el, void *arg) { zend_ini_entry *ini_entry = (zend_ini_entry *)Z_PTR_P(el); int *module_number_available = (int *)arg; if (ini_entry->module_number == *(int *)module_number_available) { *(int *)module_number_available = -1; return ZEND_HASH_APPLY_STOP; } else { return ZEND_HASH_APPLY_KEEP; } }
static void autoload_func_info_dtor(zval *element) { autoload_func_info *alfi = (autoload_func_info*)Z_PTR_P(element); if (!Z_ISUNDEF(alfi->obj)) { zval_ptr_dtor(&alfi->obj); } if (!Z_ISUNDEF(alfi->closure)) { zval_ptr_dtor(&alfi->closure); } efree(alfi); }
static int clean_module_constant(zval *el, void *arg) { zend_constant *c = (zend_constant *)Z_PTR_P(el); int module_number = *(int *)arg; if (c->module_number == module_number) { return 1; } else { return 0; } }
static int clean_module_constant(zval *el, void *arg) { zend_constant *c = (zend_constant *)Z_PTR_P(el); int module_number = *(int *)arg; if (ZEND_CONSTANT_MODULE_NUMBER(c) == module_number) { return 1; } else { return 0; } }
static void zend_persist_property_info(zval *zv) { zend_property_info *prop; memcpy(ZCG(arena_mem), Z_PTR_P(zv), sizeof(zend_property_info)); zend_shared_alloc_register_xlat_entry(Z_PTR_P(zv), ZCG(arena_mem)); prop = Z_PTR_P(zv) = ZCG(arena_mem); ZCG(arena_mem) = (void*)((char*)ZCG(arena_mem) + ZEND_ALIGNED_SIZE(sizeof(zend_property_info))); zend_accel_store_interned_string(prop->name); if (prop->doc_comment) { if (ZCG(accel_directives).save_comments) { zend_accel_store_string(prop->doc_comment); } else { if (!zend_shared_alloc_get_xlat_entry(prop->doc_comment)) { zend_shared_alloc_register_xlat_entry(prop->doc_comment, prop->doc_comment); } zend_string_release(prop->doc_comment); prop->doc_comment = NULL; } } }
static void zend_file_cache_unserialize_prop_info(zval *zv, zend_persistent_script *script, void *buf) { if (!IS_UNSERIALIZED(Z_PTR_P(zv))) { zend_property_info *prop; UNSERIALIZE_PTR(Z_PTR_P(zv)); prop = Z_PTR_P(zv); if (prop->ce && !IS_UNSERIALIZED(prop->ce)) { UNSERIALIZE_PTR(prop->ce); } if (prop->name && !IS_UNSERIALIZED(prop->name)) { UNSERIALIZE_STR(prop->name); } if (prop->doc_comment && !IS_UNSERIALIZED(prop->doc_comment)) { UNSERIALIZE_STR(prop->doc_comment); } } }
static void zend_file_cache_serialize_class_constant(zval *zv, zend_persistent_script *script, zend_file_cache_metainfo *info, void *buf) { if (!IS_SERIALIZED(Z_PTR_P(zv))) { zend_class_constant *c; SERIALIZE_PTR(Z_PTR_P(zv)); c = Z_PTR_P(zv); UNSERIALIZE_PTR(c); zend_file_cache_serialize_zval(&c->value, script, info, buf); if (c->ce && !IS_SERIALIZED(c->ce)) { SERIALIZE_PTR(c->ce); } if (c->doc_comment && !IS_SERIALIZED(c->doc_comment)) { SERIALIZE_STR(c->doc_comment); } } }
ZEND_API zend_constant* ZEND_FASTCALL zend_quick_get_constant(const zval *key, uint32_t flags) { zval *zv; zend_constant *c = NULL; zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); if (zv) { c = (zend_constant*)Z_PTR_P(zv); } else { key++; zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); if (zv && (((zend_constant*)Z_PTR_P(zv))->flags & CONST_CS) == 0) { c = (zend_constant*)Z_PTR_P(zv); } else { if ((flags & (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) == (IS_CONSTANT_IN_NAMESPACE|IS_CONSTANT_UNQUALIFIED)) { key++; zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); if (zv) { c = (zend_constant*)Z_PTR_P(zv); } else { key++; zv = zend_hash_find_ex(EG(zend_constants), Z_STR_P(key), 1); if (zv && (((zend_constant*)Z_PTR_P(zv))->flags & CONST_CS) == 0) { c = (zend_constant*)Z_PTR_P(zv); } } } } } return c; }
void cassandra_batch_statement_entry_dtor(php5to7_dtor dest) { #if PHP_MAJOR_VERSION >= 7 cassandra_batch_statement_entry *batch_statement_entry = Z_PTR_P(dest); #else cassandra_batch_statement_entry *batch_statement_entry = *((cassandra_batch_statement_entry **) dest); #endif zval_ptr_dtor(&batch_statement_entry->statement); PHP5TO7_ZVAL_MAYBE_DESTROY(batch_statement_entry->arguments); efree(batch_statement_entry); }
static int move_user_function(zval *zv, int num_args, va_list args, zend_hash_key *hash_key) { zend_function *function = Z_PTR_P(zv); HashTable *function_table = va_arg(args, HashTable *); (void)num_args; /* keep the compiler happy */ if (function->type == ZEND_USER_FUNCTION) { zend_hash_update_ptr(function_table, hash_key->key, function); return 1; } else { return 0; } }
static void phpdbg_remove_watch_collision(phpdbg_watchpoint_t *watch) { phpdbg_watch_collision *cur; if ((cur = zend_hash_index_find_ptr(&PHPDBG_G(watch_collisions), (zend_ulong) Z_COUNTED_P(watch->addr.zv)))) { if (cur->refs && !--cur->refs) { phpdbg_delete_watchpoints_recursive(watch); } zend_hash_del(&cur->watches, watch->str); zend_hash_del(&cur->implicit_watches, watch->str); if (zend_hash_num_elements(&cur->watches) > 0) { cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->watches, NULL)); } else if (zend_hash_num_elements(&cur->implicit_watches) > 0) { cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->implicit_watches, NULL)); } else { phpdbg_deactivate_watchpoint(cur->watch); phpdbg_remove_watchpoint(cur->watch); zend_hash_index_del(&PHPDBG_G(watch_collisions), (zend_ulong) Z_COUNTED_P(watch->addr.zv)); } } }
static void zend_persist_property_info_calc(zval *zv) { zend_property_info *prop = Z_PTR_P(zv); if (!zend_shared_alloc_get_xlat_entry(prop)) { zend_shared_alloc_register_xlat_entry(prop, prop); ADD_ARENA_SIZE(sizeof(zend_property_info)); ADD_INTERNED_STRING(prop->name, 0); if (ZCG(accel_directives).save_comments && prop->doc_comment) { ADD_STRING(prop->doc_comment); } } }
void free_zend_constant(zval *zv) { zend_constant *c = Z_PTR_P(zv); if (!(c->flags & CONST_PERSISTENT)) { zval_dtor(&c->value); } else { zval_internal_dtor(&c->value); } if (c->name) { zend_string_release(c->name); } pefree(c, c->flags & CONST_PERSISTENT); }
static void promise_resolve_context_free(zval *value) { promise_resolve_context_t *context = Z_PTR_P(value); if (--GC_REFCOUNT(context) != 0) { return; } if (context->self) { zend_object_release(&context->self->std); } zval_ptr_dtor(&context->callback); efree(context); }
static void zend_accel_destroy_zend_function(zval *zv) { zend_function *function = Z_PTR_P(zv); TSRMLS_FETCH(); if (function->type == ZEND_USER_FUNCTION) { if (function->op_array.static_variables) { FREE_HASHTABLE(function->op_array.static_variables); function->op_array.static_variables = NULL; } } destroy_zend_function(function TSRMLS_CC); }
static void autoload_func_info_dtor(zval *element) { autoload_func_info *alfi = (autoload_func_info*)Z_PTR_P(element); if (!Z_ISUNDEF(alfi->obj)) { zval_ptr_dtor(&alfi->obj); } if (alfi->func_ptr && UNEXPECTED(alfi->func_ptr->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) { zend_string_release(alfi->func_ptr->common.function_name); zend_free_trampoline(alfi->func_ptr); } if (!Z_ISUNDEF(alfi->closure)) { zval_ptr_dtor(&alfi->closure); } efree(alfi); }
static void zend_accel_destroy_zend_function(zval *zv) { zend_function *function = Z_PTR_P(zv); if (function->type == ZEND_USER_FUNCTION) { if (function->op_array.static_variables) { if (!(GC_FLAGS(function->op_array.static_variables) & IS_ARRAY_IMMUTABLE)) { if (--GC_REFCOUNT(function->op_array.static_variables) == 0) { FREE_HASHTABLE(function->op_array.static_variables); } } function->op_array.static_variables = NULL; } } destroy_zend_function(function); }
void free_zend_constant(zval *zv) { zend_constant *c = Z_PTR_P(zv); if (!(c->flags & CONST_PERSISTENT)) { zval_ptr_dtor_nogc(&c->value); if (c->name) { zend_string_release_ex(c->name, 0); } efree(c); } else { zval_internal_ptr_dtor(&c->value); if (c->name) { zend_string_release_ex(c->name, 1); } free(c); } }
static void zend_accel_function_hash_copy(HashTable *target, HashTable *source) { zend_function *function1, *function2; uint idx; Bucket *p; zval *t; for (idx = 0; idx < source->nNumUsed; idx++) { p = source->arData + idx; if (Z_TYPE(p->val) == IS_UNDEF) continue; ZEND_ASSERT(p->key); t = zend_hash_add(target, p->key, &p->val); if (UNEXPECTED(t == NULL)) { if (p->key->len > 0 && p->key->val[0] == 0) { /* Mangled key */ t = zend_hash_update(target, p->key, &p->val); } else { t = zend_hash_find(target, p->key); goto failure; } } } target->nInternalPointer = target->nNumOfElements ? 0 : INVALID_IDX; return; failure: function1 = Z_PTR(p->val); function2 = Z_PTR_P(t); CG(in_compilation) = 1; zend_set_compiled_filename(function1->op_array.filename); CG(zend_lineno) = function1->op_array.opcodes[0].lineno; if (function2->type == ZEND_USER_FUNCTION && function2->op_array.last > 0) { zend_error(E_ERROR, "Cannot redeclare %s() (previously declared in %s:%d)", function1->common.function_name->val, function2->op_array.filename->val, (int)function2->op_array.opcodes[0].lineno); } else { zend_error(E_ERROR, "Cannot redeclare %s()", function1->common.function_name->val); } }
static void _type_dtor(zval *zv) { free(Z_PTR_P(zv)); }
static void context_copy_func(void *pElement) { promise_resolve_context_t *context = Z_PTR_P((zval *)pElement); GC_REFCOUNT((zend_refcounted *)context) ++; }
static void zend_accel_destroy_zend_class(zval *zv) { zend_class_entry *ce = Z_PTR_P(zv); ce->function_table.pDestructor = zend_accel_destroy_zend_function; destroy_zend_class(zv); }
static int is_not_internal_function(zval *zv) { zend_function *function = Z_PTR_P(zv); return(function->type != ZEND_INTERNAL_FUNCTION); }
static void zend_file_cache_serialize_class(zval *zv, zend_persistent_script *script, zend_file_cache_metainfo *info, void *buf) { zend_class_entry *ce; SERIALIZE_PTR(Z_PTR_P(zv)); ce = Z_PTR_P(zv); UNSERIALIZE_PTR(ce); SERIALIZE_STR(ce->name); zend_file_cache_serialize_hash(&ce->function_table, script, info, buf, zend_file_cache_serialize_func); if (ce->default_properties_table) { zval *p, *end; SERIALIZE_PTR(ce->default_properties_table); p = ce->default_properties_table; UNSERIALIZE_PTR(p); end = p + ce->default_properties_count; while (p < end) { zend_file_cache_serialize_zval(p, script, info, buf); p++; } } if (ce->default_static_members_table) { zval *p, *end; SERIALIZE_PTR(ce->default_static_members_table); p = ce->default_static_members_table; UNSERIALIZE_PTR(p); end = p + ce->default_static_members_count; while (p < end) { zend_file_cache_serialize_zval(p, script, info, buf); p++; } } zend_file_cache_serialize_hash(&ce->constants_table, script, info, buf, zend_file_cache_serialize_class_constant); SERIALIZE_STR(ce->info.user.filename); SERIALIZE_STR(ce->info.user.doc_comment); zend_file_cache_serialize_hash(&ce->properties_info, script, info, buf, zend_file_cache_serialize_prop_info); if (ce->trait_aliases) { zend_trait_alias **p, *q; SERIALIZE_PTR(ce->trait_aliases); p = ce->trait_aliases; UNSERIALIZE_PTR(p); while (*p) { SERIALIZE_PTR(*p); q = *p; UNSERIALIZE_PTR(q); if (q->trait_method) { zend_trait_method_reference *m; SERIALIZE_PTR(q->trait_method); m = q->trait_method; UNSERIALIZE_PTR(m); if (m->method_name) { SERIALIZE_STR(m->method_name); } if (m->class_name) { SERIALIZE_STR(m->class_name); } } if (q->alias) { SERIALIZE_STR(q->alias); } p++; } } if (ce->trait_precedences) { zend_trait_precedence **p, *q; SERIALIZE_PTR(ce->trait_precedences); p = ce->trait_precedences; UNSERIALIZE_PTR(p); while (*p) { SERIALIZE_PTR(*p); q = *p; UNSERIALIZE_PTR(q); if (q->trait_method) { zend_trait_method_reference *m; SERIALIZE_PTR(q->trait_method); m = q->trait_method; UNSERIALIZE_PTR(m); if (m->method_name) { SERIALIZE_STR(m->method_name); } if (m->class_name) { SERIALIZE_STR(m->class_name); } } if (q->exclude_from_classes) { zend_string **s; SERIALIZE_PTR(q->exclude_from_classes); s = (zend_string**)q->exclude_from_classes; UNSERIALIZE_PTR(s); while (*s) { SERIALIZE_STR(*s); s++; } } p++; } } SERIALIZE_PTR(ce->parent); SERIALIZE_PTR(ce->constructor); SERIALIZE_PTR(ce->destructor); SERIALIZE_PTR(ce->clone); SERIALIZE_PTR(ce->__get); SERIALIZE_PTR(ce->__set); SERIALIZE_PTR(ce->__call); SERIALIZE_PTR(ce->serialize_func); SERIALIZE_PTR(ce->unserialize_func); SERIALIZE_PTR(ce->__isset); SERIALIZE_PTR(ce->__unset); SERIALIZE_PTR(ce->__tostring); SERIALIZE_PTR(ce->__callstatic); SERIALIZE_PTR(ce->__debugInfo); }
static void zend_file_cache_unserialize_class(zval *zv, zend_persistent_script *script, void *buf) { zend_class_entry *ce; UNSERIALIZE_PTR(Z_PTR_P(zv)); ce = Z_PTR_P(zv); UNSERIALIZE_STR(ce->name); zend_file_cache_unserialize_hash(&ce->function_table, script, buf, zend_file_cache_unserialize_func, ZEND_FUNCTION_DTOR); if (ce->default_properties_table) { zval *p, *end; UNSERIALIZE_PTR(ce->default_properties_table); p = ce->default_properties_table; end = p + ce->default_properties_count; while (p < end) { zend_file_cache_unserialize_zval(p, script, buf); p++; } } if (ce->default_static_members_table) { zval *p, *end; UNSERIALIZE_PTR(ce->default_static_members_table); p = ce->default_static_members_table; end = p + ce->default_static_members_count; while (p < end) { zend_file_cache_unserialize_zval(p, script, buf); p++; } } zend_file_cache_unserialize_hash(&ce->constants_table, script, buf, zend_file_cache_unserialize_class_constant, NULL); UNSERIALIZE_STR(ce->info.user.filename); UNSERIALIZE_STR(ce->info.user.doc_comment); zend_file_cache_unserialize_hash(&ce->properties_info, script, buf, zend_file_cache_unserialize_prop_info, ZVAL_PTR_DTOR); if (ce->trait_aliases) { zend_trait_alias **p, *q; UNSERIALIZE_PTR(ce->trait_aliases); p = ce->trait_aliases; while (*p) { UNSERIALIZE_PTR(*p); q = *p; if (q->trait_method) { zend_trait_method_reference *m; UNSERIALIZE_PTR(q->trait_method); m = q->trait_method; if (m->method_name) { UNSERIALIZE_STR(m->method_name); } if (m->class_name) { UNSERIALIZE_STR(m->class_name); } } if (q->alias) { UNSERIALIZE_STR(q->alias); } p++; } } if (ce->trait_precedences) { zend_trait_precedence **p, *q; UNSERIALIZE_PTR(ce->trait_precedences); p = ce->trait_precedences; while (*p) { UNSERIALIZE_PTR(*p); q = *p; if (q->trait_method) { zend_trait_method_reference *m; UNSERIALIZE_PTR(q->trait_method); m = q->trait_method; if (m->method_name) { UNSERIALIZE_STR(m->method_name); } if (m->class_name) { UNSERIALIZE_STR(m->class_name); } } if (q->exclude_from_classes) { zend_string **s; UNSERIALIZE_PTR(q->exclude_from_classes); s = (zend_string**)q->exclude_from_classes; while (*s) { UNSERIALIZE_STR(*s); s++; } } p++; } } UNSERIALIZE_PTR(ce->parent); UNSERIALIZE_PTR(ce->constructor); UNSERIALIZE_PTR(ce->destructor); UNSERIALIZE_PTR(ce->clone); UNSERIALIZE_PTR(ce->__get); UNSERIALIZE_PTR(ce->__set); UNSERIALIZE_PTR(ce->__call); UNSERIALIZE_PTR(ce->serialize_func); UNSERIALIZE_PTR(ce->unserialize_func); UNSERIALIZE_PTR(ce->__isset); UNSERIALIZE_PTR(ce->__unset); UNSERIALIZE_PTR(ce->__tostring); UNSERIALIZE_PTR(ce->__callstatic); UNSERIALIZE_PTR(ce->__debugInfo); if (UNEXPECTED((ce->ce_flags & ZEND_ACC_ANON_CLASS))) { ce->serialize = zend_class_serialize_deny; ce->unserialize = zend_class_unserialize_deny; } }
static void auto_global_dtor(zval *zv) /* {{{ */ { free(Z_PTR_P(zv)); }
static inline void pthreads_guard_dtor(zval *el) { efree(Z_PTR_P(el)); }
static int print_module_info(zval *element) /* {{{ */ { zend_module_entry *module = (zend_module_entry*)Z_PTR_P(element); php_printf("%s\n", module->name); return ZEND_HASH_APPLY_KEEP; }
static void user_config_cache_entry_dtor(zval *el) { user_config_cache_entry *entry = (user_config_cache_entry *)Z_PTR_P(el); zend_hash_destroy(&entry->user_config); free(entry); }
{10, 1, "rfunction"}, {11, 1, "rc"}, {11, 1, "rclass"}, {12, 1, "re"}, {12, 1, "rextension"}, {13, 1, "rz"}, {13, 1, "rzendextension"}, {14, 1, "ri"}, {14, 1, "rextinfo"}, {15, 0, "ini"}, {'-', 0, NULL} /* end of args */ }; static int print_module_info(zval *element TSRMLS_DC) /* {{{ */ { zend_module_entry *module = (zend_module_entry*)Z_PTR_P(element); php_printf("%s\n", module->name); return ZEND_HASH_APPLY_KEEP; } /* }}} */ static int module_name_cmp(const void *a, const void *b TSRMLS_DC) /* {{{ */ { Bucket *f = (Bucket *) a; Bucket *s = (Bucket *) b; return strcasecmp(((zend_module_entry *)Z_PTR(f->val))->name, ((zend_module_entry *)Z_PTR(s->val))->name); } /* }}} */