- 将 getClassEntryPtr 方法重命名为 getClassId 并修改返回值为整数ID - 将 getFuncPtr 方法重命名为 getFuncId 并修改返回值为整数ID - 添加新的 getMethodPtr 方法用于获取方法指针 - 重新实现 getClassEntryPtr 和 getFuncPtr 方法,基于新的ID获取方法 - 更新方法调用逻辑以使用新的方法指针机制 - 在C++模板中添加 php_get_method 函数实现 - 更新PHP AOT辅助头文件中的函数声明 - 优化Reflection类中的反射异常处理和参数类型引用pull/1/head
parent
257616d571
commit
9c51551567
5 changed files with 71 additions and 21 deletions
@ -1,20 +1,21 @@ |
|||||||
#include <phpx.h> |
#include <phpx.h> |
||||||
|
|
||||||
extern zend_class_entry *php_get_class(int class_id, const php::String &class_name); |
extern zend_class_entry *php_get_class(int class_id, const php::Str &class_name); |
||||||
extern zend_function *php_get_func(int func_id, const php::String &func_name); |
extern zend_function *php_get_func(int func_id, const php::Str &func_name); |
||||||
|
extern zend_function *php_get_method(int func_id, const php::Str &method_name, int class_id, const php::Str &class_name); |
||||||
|
|
||||||
static inline php::Variant CALL(int func_id, const php::String &func_name, const php::ArgList &args) { |
static inline php::Variant CALL(int func_id, const php::Str &func_name, const php::ArgList &args) { |
||||||
return php::call(php_get_func(func_id, func_name), args); |
return php::call(php_get_func(func_id, func_name), args); |
||||||
} |
} |
||||||
|
|
||||||
static inline php::Variant CALL(int func_id, const php::String &func_name) { |
static inline php::Variant CALL(int func_id, const php::Str &func_name) { |
||||||
return php::call(php_get_func(func_id, func_name)); |
return php::call(php_get_func(func_id, func_name)); |
||||||
} |
} |
||||||
|
|
||||||
static inline php::Variant CALL_SILENT(int func_id, const php::String &func_name, const php::ArgList &args) { |
static inline php::Variant CALL_SILENT(int func_id, const php::Str &func_name, const php::ArgList &args) { |
||||||
return php::silentCall(php_get_func(func_id, func_name), args); |
return php::silentCall(php_get_func(func_id, func_name), args); |
||||||
} |
} |
||||||
|
|
||||||
static inline php::Variant CALL_SILENT(int func_id, const php::String &func_name) { |
static inline php::Variant CALL_SILENT(int func_id, const php::Str &func_name) { |
||||||
return php::silentCall(php_get_func(func_id, func_name)); |
return php::silentCall(php_get_func(func_id, func_name)); |
||||||
} |
} |
||||||
|
|||||||
@ -0,0 +1,10 @@ |
|||||||
|
--TEST-- |
||||||
|
method call |
||||||
|
--FILE-- |
||||||
|
<?php |
||||||
|
$date = new DateTime('2000-01-01'); |
||||||
|
$rs = $date->format('Y-m-d H:i:s'); |
||||||
|
var_dump($rs); |
||||||
|
?> |
||||||
|
--EXPECT-- |
||||||
|
string(19) "2000-01-01 00:00:00" |
||||||
Loading…
Reference in new issue