Skip to content

Commit 82c4ffd

Browse files
authored
Add ExecuteData::get_mut_parameter method. (#108)
1 parent a5f284b commit 82c4ffd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

phper/src/values.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,15 @@ impl ExecuteData {
161161
}
162162

163163
/// Gets parameter by index.
164-
pub fn get_parameter(&mut self, index: usize) -> &mut ZVal {
164+
pub fn get_parameter(&self, index: usize) -> &ZVal {
165+
unsafe {
166+
let val = phper_zend_call_var_num(self.as_ptr() as *mut _, index.try_into().unwrap());
167+
ZVal::from_ptr(val)
168+
}
169+
}
170+
171+
/// Gets mutable parameter by index.
172+
pub fn get_mut_parameter(&mut self, index: usize) -> &mut ZVal {
165173
unsafe {
166174
let val = phper_zend_call_var_num(self.as_mut_ptr(), index.try_into().unwrap());
167175
ZVal::from_mut_ptr(val)

0 commit comments

Comments
 (0)