pub type IniEntryDef = zend_ini_entry_def;Expand description
A Zend ini entry definition.
Register ini definitions from your module’s startup_function with
IniEntryDef::register. The table is borrowed by the engine for the life
of the process — PHP 8.5 stores it as zend_ini_entry.def and the CLI SAPI
reads def->value for php --ini — so it must be a static, exactly like
a C extension’s zend_ini_entry_def[]:
ⓘ
static INI: IniEntryDefs<2> = IniEntryDefs::new([
IniEntryDef::new(c"my_ext.enabled", c"1", IniEntryPermission::All),
IniEntryDef::end(),
]);
pub fn startup(_ty: i32, mod_num: i32) -> i32 {
IniEntryDef::register(INI.as_slice(), mod_num);
0
}Aliased Type§
#[repr(C)]pub struct IniEntryDef {
pub name: *const i8,
pub on_modify: Option<unsafe extern "C" fn(*mut _zend_ini_entry, *mut _zend_string, *mut c_void, *mut c_void, *mut c_void, i32) -> i32>,
pub mh_arg1: *mut c_void,
pub mh_arg2: *mut c_void,
pub mh_arg3: *mut c_void,
pub value: *const i8,
pub displayer: Option<unsafe extern "C" fn(*mut _zend_ini_entry, i32)>,
pub value_length: u32,
pub name_length: u16,
pub modifiable: u8,
}Fields§
§name: *const i8§on_modify: Option<unsafe extern "C" fn(*mut _zend_ini_entry, *mut _zend_string, *mut c_void, *mut c_void, *mut c_void, i32) -> i32>§mh_arg1: *mut c_void§mh_arg2: *mut c_void§mh_arg3: *mut c_void§value: *const i8§displayer: Option<unsafe extern "C" fn(*mut _zend_ini_entry, i32)>§value_length: u32§name_length: u16§modifiable: u8Implementations§
Source§impl IniEntryDef
impl IniEntryDef
Sourcepub const fn new(
name: &'static CStr,
default_value: &'static CStr,
permission: IniEntryPermission,
) -> Self
pub const fn new( name: &'static CStr, default_value: &'static CStr, permission: IniEntryPermission, ) -> Self
Creates a new ini entry definition.
§Panics
- If the name is longer than
u16::MAXor the value longer thanu32::MAX.
Sourcepub fn register(entries: &'static [Self], module_number: i32)
pub fn register(entries: &'static [Self], module_number: i32)
Registers a list of ini entries.
entries must be terminated by IniEntryDef::end and must live for
the whole process: zend_register_ini_entries_ex interns the names and
values, but PHP 8.5 also keeps the table itself as
zend_ini_entry.def.
§Panics
If entries is empty or its last element is not IniEntryDef::end.