/* {{{ phpg_read_property() */ zval* phpg_read_property(zval *object, zval *member, int type PHPGTK_PROPERTY_END) { phpg_head_t *poh = NULL; zval tmp_member; zval result, *result_ptr = NULL; prop_info_t *pi = NULL; int ret; if (member->type != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; } ret = FAILURE; poh = (phpg_head_t *) zend_object_store_get_object(object TSRMLS_CC); if (poh->pi_hash) { ret = zend_hash_find(poh->pi_hash, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, (void **) &pi); } if (ret == SUCCESS) { memset(&result, 0, sizeof(zval)); ZVAL_NULL(&result); ret = pi->read(poh, &result TSRMLS_CC); if (ret == SUCCESS) { ALLOC_ZVAL(result_ptr); *result_ptr = result; //INIT_PZVAL(result_ptr); Z_SET_REFCOUNT_P(result_ptr, 0); Z_UNSET_ISREF_P(result_ptr); } else { result_ptr = EG(uninitialized_zval_ptr); } } else { #if PHP_VERSION_ID < 50399 result_ptr = zend_get_std_object_handlers()->read_property(object, member, type TSRMLS_CC); #else result_ptr = zend_get_std_object_handlers()->read_property(object, member, type, NULL TSRMLS_CC); #endif } if (member == &tmp_member) { zval_dtor(member); } return result_ptr; }
int php_runkit_init_sandbox_parent(INIT_FUNC_ARGS) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, PHP_RUNKIT_SANDBOX_PARENT_CLASSNAME, php_runkit_sandbox_parent_functions); php_runkit_sandbox_parent_entry = zend_register_internal_class(&ce); php_runkit_sandbox_parent_entry->create_object = php_runkit_sandbox_parent_ctor; /* Make a new object handler struct with a couple minor changes */ memcpy(&php_runkit_sandbox_parent_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_runkit_sandbox_parent_handlers.read_property = php_runkit_sandbox_parent_read_property; php_runkit_sandbox_parent_handlers.write_property = php_runkit_sandbox_parent_write_property; php_runkit_sandbox_parent_handlers.has_property = php_runkit_sandbox_parent_has_property; php_runkit_sandbox_parent_handlers.unset_property = php_runkit_sandbox_parent_unset_property; /* No dimension access for parent (initially) */ php_runkit_sandbox_parent_handlers.read_dimension = NULL; php_runkit_sandbox_parent_handlers.write_dimension = NULL; php_runkit_sandbox_parent_handlers.has_dimension = NULL; php_runkit_sandbox_parent_handlers.unset_dimension = NULL; /* ZE has no concept of modifying properties in place via zval** across contexts */ php_runkit_sandbox_parent_handlers.get_property_ptr_ptr = NULL; return SUCCESS; }
void zend_register_closure_ce(void) /* {{{ */ { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Closure", closure_functions); zend_ce_closure = zend_register_internal_class(&ce); zend_ce_closure->ce_flags |= ZEND_ACC_FINAL; zend_ce_closure->create_object = zend_closure_new; zend_ce_closure->serialize = zend_class_serialize_deny; zend_ce_closure->unserialize = zend_class_unserialize_deny; memcpy(&closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); closure_handlers.free_obj = zend_closure_free_storage; closure_handlers.get_constructor = zend_closure_get_constructor; closure_handlers.get_method = zend_closure_get_method; closure_handlers.write_property = zend_closure_write_property; closure_handlers.read_property = zend_closure_read_property; closure_handlers.get_property_ptr_ptr = zend_closure_get_property_ptr_ptr; closure_handlers.has_property = zend_closure_has_property; closure_handlers.unset_property = zend_closure_unset_property; closure_handlers.compare_objects = zend_closure_compare_objects; closure_handlers.clone_obj = zend_closure_clone; closure_handlers.get_debug_info = zend_closure_get_debug_info; closure_handlers.get_closure = zend_closure_get_closure; closure_handlers.get_gc = zend_closure_get_gc; }
/* {{{ mysqli_read_property */ zval *mysqli_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) { zval tmp_member; zval *retval; mysqli_object *obj; mysqli_prop_handler *hnd = NULL; obj = Z_MYSQLI_P(object); if (Z_TYPE_P(member) != IS_STRING) { ZVAL_COPY(&tmp_member, member); convert_to_string(&tmp_member); member = &tmp_member; } if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd) { retval = hnd->read_func(obj, rv); if (retval == NULL) { retval = &EG(uninitialized_zval); } } else { zend_object_handlers *std_hnd = zend_get_std_object_handlers(); retval = std_hnd->read_property(object, member, type, cache_slot, rv); } if (member == &tmp_member) { zval_dtor(member); } return retval; }
/* {{{ xmlreader_get_property_ptr_ptr */ zval *xmlreader_get_property_ptr_ptr(zval *object, zval *member, int type, void **cache_slot) { xmlreader_object *obj; zval tmp_member; zval *retval = NULL; xmlreader_prop_handler *hnd = NULL; zend_object_handlers *std_hnd; if (Z_TYPE_P(member) != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; } obj = Z_XMLREADER_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd == NULL) { std_hnd = zend_get_std_object_handlers(); retval = std_hnd->get_property_ptr_ptr(object, member, type, cache_slot); } if (member == &tmp_member) { zval_dtor(member); } return retval; }
/* {{{ xmlreader_write_property */ void xmlreader_write_property(zval *object, zval *member, zval *value, void **cache_slot) { xmlreader_object *obj; zval tmp_member; xmlreader_prop_handler *hnd = NULL; zend_object_handlers *std_hnd; if (Z_TYPE_P(member) != IS_STRING) { tmp_member = *member; zval_copy_ctor(&tmp_member); convert_to_string(&tmp_member); member = &tmp_member; } obj = Z_XMLREADER_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd != NULL) { php_error_docref(NULL, E_WARNING, "Cannot write to read-only property"); } else { std_hnd = zend_get_std_object_handlers(); std_hnd->write_property(object, member, value, cache_slot); } if (member == &tmp_member) { zval_dtor(member); } }
/* {{{ mysqli_write_property */ void mysqli_write_property(zval *object, zval *member, zval *value, void **cache_slot) { zval tmp_member; mysqli_object *obj; mysqli_prop_handler *hnd = NULL; if (Z_TYPE_P(member) != IS_STRING) { ZVAL_COPY(&tmp_member, member); convert_to_string(&tmp_member); member = &tmp_member; } obj = Z_MYSQLI_P(object); if (obj->prop_handler != NULL) { hnd = zend_hash_find_ptr(obj->prop_handler, Z_STR_P(member)); } if (hnd) { hnd->write_func(obj, value); } else { zend_object_handlers *std_hnd = zend_get_std_object_handlers(); std_hnd->write_property(object, member, value, cache_slot); } if (member == &tmp_member) { zval_dtor(member); } }
int php_krb5_register_kadm5_principal(TSRMLS_D) { zend_class_entry kadm5_principal; INIT_CLASS_ENTRY(kadm5_principal, "KADM5Principal", krb5_kadm5_principal_functions); krb5_ce_kadm5_principal = zend_register_internal_class(&kadm5_principal TSRMLS_CC); krb5_ce_kadm5_principal->create_object = php_krb5_kadm5_principal_object_new; memcpy(&krb5_kadm5_principal_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); return SUCCESS; }
int php_krb5_register_kadm5_policy(TSRMLS_D) { zend_class_entry kadm5_policy; INIT_CLASS_ENTRY(kadm5_policy, "KADM5Policy", krb5_kadm5_policy_functions); krb5_ce_kadm5_policy = zend_register_internal_class(&kadm5_policy TSRMLS_CC); krb5_ce_kadm5_policy->create_object = php_krb5_kadm5_policy_object_new; memcpy(&krb5_kadm5_policy_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); return SUCCESS; }
void mhcontroller_init(TSRMLS_D) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "MHController", php_microhouse_mhcontroller_class_functions); memcpy(&mhcontroller_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); mhcontroller_object_handlers.clone_obj = NULL; mhcontroller_ce = zend_register_internal_class(&ce TSRMLS_CC); }
static void vector_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ { zval tmp; if (zend_hash_exists(&Z_OBJCE_P(object)->properties_info, Z_STR_P(member))) { ZVAL_DOUBLE(&tmp, zval_get_double(value)); zend_get_std_object_handlers()->write_property(object, member, &tmp, cache_slot); } }
void register_ws_connection_class(TSRMLS_DC) { zend_class_entry tmp_ws_connection_ce; INIT_NS_CLASS_ENTRY(tmp_ws_connection_ce, "WebSocket", "Connection", obj_ws_connection_funcs); ws_connection_ce = zend_register_internal_class(&tmp_ws_connection_ce TSRMLS_CC); ws_connection_ce->create_object = ws_connection_create_object_handler; memcpy(&ws_connection_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); ws_connection_object_handlers.free_obj = (zend_object_free_obj_t) ws_connection_free_object_storage_handler; }
void init_distance_map(TSRMLS_D) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "distance_map", distance_map_methods); distance_map_ce = zend_register_internal_class(&ce TSRMLS_CC); distance_map_ce->create_object = create_distance_map_object; memcpy(&distance_map_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); distance_map_handlers.clone_obj = clone_distance_map_object; }
void grpc_init_timeval() { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Grpc\\Timeval", timeval_methods); ce.create_object = create_wrapped_grpc_timeval; grpc_ce_timeval = zend_register_internal_class(&ce); memcpy(&timeval_object_handlers_timeval, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); timeval_object_handlers_timeval.offset = XtOffsetOf(wrapped_grpc_timeval, std); timeval_object_handlers_timeval.free_obj = free_wrapped_grpc_timeval; }
void grpc_init_call() { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Grpc\\Call", call_methods); ce.create_object = create_wrapped_grpc_call; grpc_ce_call = zend_register_internal_class(&ce); memcpy(&call_object_handlers_call, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); call_object_handlers_call.offset = XtOffsetOf(wrapped_grpc_call, std); call_object_handlers_call.free_obj = free_wrapped_grpc_call; return; }
static int phalcon_translate_adapter_gettext_has_dimension(zval *object, zval *offset, int check_empty TSRMLS_DC) { char *msgstr; if (!is_phalcon_class(Z_OBJCE_P(object))) { return zend_get_std_object_handlers()->has_dimension(object, offset, check_empty TSRMLS_CC); } msgstr = gettext(Z_STRVAL_P(offset)); return (1 == check_empty) ? strlen(msgstr) : 1; }
void MAPIAppointmentRegisterClass(TSRMLS_D) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "MAPIAppointment", mapi_appointment_class_functions); mapi_appointment_ce = zend_register_internal_class_ex(&ce, NULL, "mapimessage" TSRMLS_CC); mapi_appointment_ce->create_object = mapi_message_create_handler; memcpy(&mapi_appointment_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); mapi_appointment_object_handlers.clone_obj = NULL; }
void message_init(TSRMLS_D) { zend_class_entry class_type; INIT_CLASS_ENTRY(class_type, "Google\\Protobuf\\Internal\\Message", message_methods); message_type = zend_register_internal_class(&class_type TSRMLS_CC); message_handlers = PEMALLOC(zend_object_handlers); memcpy(message_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); message_handlers->write_property = message_set_property; message_handlers->read_property = message_get_property; message_handlers->get_property_ptr_ptr = message_get_property_ptr_ptr; }
static void init_generated_pool_once(TSRMLS_D) { if (generated_pool_php == NULL) { MAKE_STD_ZVAL(generated_pool_php); Z_TYPE_P(generated_pool_php) = IS_OBJECT; generated_pool = ALLOC(DescriptorPool); descriptor_pool_init_c_instance(generated_pool TSRMLS_CC); Z_OBJ_HANDLE_P(generated_pool_php) = zend_objects_store_put( generated_pool, NULL, (zend_objects_free_object_storage_t)descriptor_pool_free, NULL TSRMLS_CC); Z_OBJ_HT_P(generated_pool_php) = zend_get_std_object_handlers(); } }
void grpc_init_server_credentials() { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Grpc\\ServerCredentials", server_credentials_methods); ce.create_object = create_wrapped_grpc_server_credentials; grpc_ce_server_credentials = zend_register_internal_class(&ce); memcpy(&server_credentials_ce_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); server_credentials_ce_handlers.offset = XtOffsetOf(wrapped_grpc_server_credentials, std); server_credentials_ce_handlers.free_obj = free_wrapped_grpc_server_credentials; }
/* {{{ timezone_register_IntlTimeZone_class * Initialize 'IntlTimeZone' class */ U_CFUNC void timezone_register_IntlTimeZone_class(void) { zend_class_entry ce; /* Create and register 'IntlTimeZone' class. */ INIT_CLASS_ENTRY(ce, "IntlTimeZone", TimeZone_class_functions); ce.create_object = TimeZone_object_create; TimeZone_ce_ptr = zend_register_internal_class(&ce); if (!TimeZone_ce_ptr) { //can't happen now without bigger problems before php_error_docref0(NULL, E_ERROR, "IntlTimeZone: class registration has failed."); return; } memcpy(&TimeZone_handlers, zend_get_std_object_handlers(), sizeof TimeZone_handlers); TimeZone_handlers.offset = XtOffsetOf(TimeZone_object, zo); TimeZone_handlers.clone_obj = TimeZone_clone_obj; TimeZone_handlers.compare_objects = TimeZone_compare_objects; TimeZone_handlers.get_debug_info = TimeZone_get_debug_info; TimeZone_handlers.dtor_obj = TimeZone_objects_dtor; TimeZone_handlers.free_obj = TimeZone_objects_free; /* Declare 'IntlTimeZone' class constants */ #define TIMEZONE_DECL_LONG_CONST(name, val) \ zend_declare_class_constant_long(TimeZone_ce_ptr, name, sizeof(name) - 1, \ val) TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT", TimeZone::SHORT); TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG", TimeZone::LONG); #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 44 TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GENERIC", TimeZone::SHORT_GENERIC); TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GENERIC", TimeZone::LONG_GENERIC); TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_GMT", TimeZone::SHORT_GMT); TIMEZONE_DECL_LONG_CONST("DISPLAY_LONG_GMT", TimeZone::LONG_GMT); TIMEZONE_DECL_LONG_CONST("DISPLAY_SHORT_COMMONLY_USED", TimeZone::SHORT_COMMONLY_USED); TIMEZONE_DECL_LONG_CONST("DISPLAY_GENERIC_LOCATION", TimeZone::GENERIC_LOCATION); #endif #if U_ICU_VERSION_MAJOR_NUM * 10 + U_ICU_VERSION_MINOR_NUM >= 48 TIMEZONE_DECL_LONG_CONST("TYPE_ANY", UCAL_ZONE_TYPE_ANY); TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL", UCAL_ZONE_TYPE_CANONICAL); TIMEZONE_DECL_LONG_CONST("TYPE_CANONICAL_LOCATION", UCAL_ZONE_TYPE_CANONICAL_LOCATION); #endif /* Declare 'IntlTimeZone' class properties */ }
void php_ds_register_queue_handlers() { memcpy(&php_queue_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_queue_handlers.offset = XtOffsetOf(php_ds_queue_t, std); php_queue_handlers.dtor_obj = zend_objects_destroy_object; php_queue_handlers.free_obj = ds_queue_free_object; php_queue_handlers.clone_obj = ds_queue_clone_obj; php_queue_handlers.cast_object = ds_default_cast_object; php_queue_handlers.get_debug_info = ds_queue_get_debug_info; php_queue_handlers.count_elements = ds_queue_count_elements; php_queue_handlers.write_dimension = ds_queue_write_dimension; }
void php_lua_closure_register() /* {{{ */ { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "LuaClosure", lua_closure_methods); lua_closure_ce = zend_register_internal_class(&ce); lua_closure_ce->create_object = php_lua_closure_create_object; lua_closure_ce->ce_flags |= ZEND_ACC_FINAL; memcpy(&lua_closure_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); lua_closure_handlers.offset = XtOffsetOf(lua_closure_object, std); lua_closure_handlers.clone_obj = NULL; lua_closure_handlers.free_obj = php_lua_closure_free_obj; } /* }}} */
extern int oauth_provider_register_class() /* {{{ */ { zend_class_entry osce; INIT_CLASS_ENTRY(osce, "OAuthProvider", oauth_provider_methods); osce.create_object = oauth_provider_new; oauthprovider = zend_register_internal_class(&osce); memcpy(&oauth_provider_obj_hndlrs, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); oauth_provider_obj_hndlrs.offset = XtOffsetOf(php_oauth_provider, zo); oauth_provider_obj_hndlrs.free_obj = oauth_provider_free_storage; return SUCCESS; }
void php_ds_register_set_handlers() { memcpy(&php_ds_set_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_ds_set_handlers.offset = XtOffsetOf(php_ds_set_t, std); php_ds_set_handlers.free_obj = ds_set_free_object; php_ds_set_handlers.clone_obj = ds_set_clone_obj; php_ds_set_handlers.get_debug_info = ds_set_get_debug_info; php_ds_set_handlers.count_elements = ds_set_count_elements; php_ds_set_handlers.read_dimension = ds_set_read_dimension; php_ds_set_handlers.write_dimension = ds_set_write_dimension; php_ds_set_handlers.cast_object = ds_default_cast_object; // php_ds_set_handlers.do_operation = ds_set_do_operation; }
/* {{{ spoofchecker_register_Spoofchecker_class * Initialize 'Spoofchecker' class */ void spoofchecker_register_Spoofchecker_class(void) { zend_class_entry ce; /* Create and register 'Spoofchecker' class. */ INIT_CLASS_ENTRY(ce, "Spoofchecker", Spoofchecker_class_functions); ce.create_object = Spoofchecker_object_create; Spoofchecker_ce_ptr = zend_register_internal_class(&ce); memcpy(&Spoofchecker_handlers, zend_get_std_object_handlers(), sizeof Spoofchecker_handlers); Spoofchecker_handlers.offset = XtOffsetOf(Spoofchecker_object, zo); Spoofchecker_handlers.clone_obj = spoofchecker_clone_obj; Spoofchecker_handlers.free_obj = Spoofchecker_objects_free; }
static zval* phalcon_translate_adapter_gettext_read_dimension(zval *object, zval *offset, int type TSRMLS_DC) { zval *translation; char *msgstr; if (!is_phalcon_class(Z_OBJCE_P(object))) { return zend_get_std_object_handlers()->read_dimension(object, offset, type TSRMLS_CC); } msgstr = gettext(Z_STRVAL_P(offset)); PHALCON_INIT_VAR(translation); ZVAL_STRING(translation, msgstr, 1); return translation; }
void mongo_init_Mongo(TSRMLS_D) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "Mongo", mongo_methods); /* FIXME: Use mongo_methods here */ ce.create_object = php_mongoclient_new; mongo_ce_Mongo = zend_register_internal_class_ex(&ce, mongo_ce_MongoClient, NULL TSRMLS_CC); /* make mongoclient object uncloneable, and with its own read_property */ memcpy(&mongoclient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); mongoclient_handlers.clone_obj = NULL; mongoclient_handlers.read_property = mongo_read_property; #if PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3 mongoclient_handlers.get_debug_info = mongo_get_debug_info; #endif }
/* {{{ dateformat_register_class * Initialize 'IntlDateFormatter' class */ void dateformat_register_IntlDateFormatter_class( void ) { zend_class_entry ce; /* Create and register 'IntlDateFormatter' class. */ INIT_CLASS_ENTRY( ce, "IntlDateFormatter", IntlDateFormatter_class_functions ); ce.create_object = IntlDateFormatter_object_create; IntlDateFormatter_ce_ptr = zend_register_internal_class( &ce ); memcpy(&IntlDateFormatter_handlers, zend_get_std_object_handlers(), sizeof IntlDateFormatter_handlers); IntlDateFormatter_handlers.offset = XtOffsetOf(IntlDateFormatter_object, zo); IntlDateFormatter_handlers.clone_obj = IntlDateFormatter_object_clone; IntlDateFormatter_handlers.dtor_obj = IntlDateFormatter_object_dtor; IntlDateFormatter_handlers.free_obj = IntlDateFormatter_object_free; }
void register_map_handlers() { memcpy(&map_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); map_handlers.offset = XtOffsetOf(Map, std); map_handlers.dtor_obj = zend_objects_destroy_object; map_handlers.free_obj = map_free_object; map_handlers.clone_obj = map_clone_obj; map_handlers.get_debug_info = map_get_debug_info; map_handlers.count_elements = map_count_elements; map_handlers.read_dimension = map_read_dimension; map_handlers.write_dimension = map_write_dimension; map_handlers.has_dimension = map_has_dimension; map_handlers.unset_dimension = map_unset_dimension; map_handlers.cast_object = ds_default_cast_object; // map_handlers.get_properties = map_get_properties; }