summaryrefslogtreecommitdiff
path: root/ext/zend_test/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zend_test/test.c')
-rw-r--r--ext/zend_test/test.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/ext/zend_test/test.c b/ext/zend_test/test.c
index 0ad566a025..4a7fe540fb 100644
--- a/ext/zend_test/test.c
+++ b/ext/zend_test/test.c
@@ -149,17 +149,20 @@ static zend_function *zend_test_class_method_get(zend_object **object, zend_stri
/* }}} */
static zend_function *zend_test_class_static_method_get(zend_class_entry *ce, zend_string *name) /* {{{ */ {
- zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
- fptr->type = ZEND_OVERLOADED_FUNCTION;
- fptr->num_args = 1;
- fptr->arg_info = NULL;
- fptr->scope = ce;
- fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC;
- fptr->function_name = name;
- fptr->handler = ZEND_FN(zend_test_func);
- zend_set_function_arg_flags((zend_function*)fptr);
-
- return (zend_function*)fptr;
+ if (zend_string_equals_literal_ci(name, "test")) {
+ zend_internal_function *fptr = emalloc(sizeof(zend_internal_function));
+ fptr->type = ZEND_OVERLOADED_FUNCTION;
+ fptr->num_args = 1;
+ fptr->arg_info = NULL;
+ fptr->scope = ce;
+ fptr->fn_flags = ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_STATIC;
+ fptr->function_name = name;
+ fptr->handler = ZEND_FN(zend_test_func);
+ zend_set_function_arg_flags((zend_function*)fptr);
+
+ return (zend_function*)fptr;
+ }
+ return zend_std_get_static_method(ce, name, NULL);
}
/* }}} */
@@ -169,11 +172,22 @@ static int zend_test_class_call_method(zend_string *method, zend_object *object,
}
/* }}} */
+/* Internal function returns bool, we return int. */
+static ZEND_METHOD(_ZendTestClass, is_object) /* {{{ */ {
+ RETURN_LONG(42);
+}
+/* }}} */
+
static ZEND_METHOD(_ZendTestTrait, testMethod) /* {{{ */ {
RETURN_TRUE;
}
/* }}} */
+static const zend_function_entry zend_test_class_methods[] = {
+ ZEND_ME(_ZendTestClass, is_object, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
+ ZEND_FE_END
+};
+
static zend_function_entry zend_test_trait_methods[] = {
ZEND_ME(_ZendTestTrait, testMethod, NULL, ZEND_ACC_PUBLIC)
ZEND_FE_END
@@ -186,7 +200,7 @@ PHP_MINIT_FUNCTION(zend_test)
INIT_CLASS_ENTRY(class_entry, "_ZendTestInterface", NULL);
zend_test_interface = zend_register_internal_interface(&class_entry);
zend_declare_class_constant_long(zend_test_interface, ZEND_STRL("DUMMY"), 0);
- INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", NULL);
+ INIT_CLASS_ENTRY(class_entry, "_ZendTestClass", zend_test_class_methods);
zend_test_class = zend_register_internal_class_ex(&class_entry, NULL);
zend_class_implements(zend_test_class, 1, zend_test_interface);
zend_test_class->create_object = zend_test_class_new;