@@ -18,7 +18,7 @@ use crate::{
1818 errors:: { ArgumentCountError , CallFunctionError , CallMethodError } ,
1919 exceptions:: Exception ,
2020 objects:: { StatefulObj , ZObj } ,
21- strings:: ZStr ,
21+ strings:: { ZStr , ZString } ,
2222 sys:: * ,
2323 utils:: ensure_end_with_zero,
2424 values:: { ExecuteData , ZVal } ,
9292 & self , execute_data : & mut ExecuteData , arguments : & mut [ ZVal ] , return_value : & mut ZVal ,
9393 ) {
9494 unsafe {
95- let this = execute_data. get_this ( ) . unwrap ( ) ;
95+ let this = execute_data. get_this_mut ( ) . unwrap ( ) ;
9696 let this = StatefulObj :: from_z_obj ( this) ;
9797 let r = ( self . f ) ( this, arguments) ;
9898 * return_value = r. into ( ) ;
@@ -235,13 +235,20 @@ impl ZendFunction {
235235 & mut self . inner
236236 }
237237
238- pub fn get_name ( & self ) -> & ZStr {
238+ pub fn get_function_name ( & self ) -> & ZStr {
239239 unsafe {
240- let s = phper_get_function_or_method_name ( self . as_ptr ( ) ) ;
240+ let s = phper_get_function_name ( self . as_ptr ( ) ) ;
241241 ZStr :: from_ptr ( s)
242242 }
243243 }
244244
245+ pub fn get_function_or_method_name ( & self ) -> ZString {
246+ unsafe {
247+ let s = phper_get_function_or_method_name ( self . as_ptr ( ) ) ;
248+ ZString :: from_raw ( s)
249+ }
250+ }
251+
245252 pub ( crate ) fn call (
246253 & mut self , mut object : Option < & mut ZObj > , mut arguments : impl AsMut < [ ZVal ] > ,
247254 ) -> crate :: Result < ZVal > {
@@ -301,7 +308,7 @@ impl ZendFunction {
301308
302309 zend_call_function ( & mut fci, & mut fcc) == ZEND_RESULT_CODE_SUCCESS
303310 } ,
304- || Ok ( self . get_name ( ) . to_str ( ) ?. to_owned ( ) ) ,
311+ || Ok ( self . get_function_or_method_name ( ) . to_str ( ) ?. to_owned ( ) ) ,
305312 object,
306313 )
307314 }
@@ -334,7 +341,7 @@ unsafe extern "C" fn invoke(execute_data: *mut zend_execute_data, return_value:
334341 let num_args = execute_data. num_args ( ) as usize ;
335342 let required_num_args = execute_data. common_required_num_args ( ) as usize ;
336343 if num_args < required_num_args {
337- let func_name = execute_data. func ( ) . get_name ( ) ;
344+ let func_name = execute_data. func ( ) . get_function_or_method_name ( ) ;
338345 let result = func_name
339346 . to_str ( )
340347 . map ( |func_name| {
0 commit comments