Hello,
Regarding the question about how to know if a method is declared static
or not, I add the fn_flags to the result (flags property) of
getMethod();. I tested it with PHP userland classes but not internal
objects. This new property reflects the internal fn_flags in
zend_function struct. The constants required are already available so
it's easy to get the method type.
If I missed some other reflection methods which already provide this
info, please point me to them :)
hth
pierre
Index: zend_reflection_api.c
===================================================================
RCS file: /repository/ZendEngine2/zend_reflection_api.c,v
retrieving revision 1.87
diff -u -u -p -r1.87 zend_reflection_api.c
--- zend_reflection_api.c 12 Feb 2004 10:38:14 -0000 1.87
+++ zend_reflection_api.c 19 Feb 2004 14:46:44 -0000
@@ -741,17 +741,21 @@ static void reflection_method_factory(ze
reflection_object *intern;
zval *name;
zval *classname;
+ zval *fn_flags;
MAKE_STD_ZVAL(name);
ZVAL_STRING(name, method->common.function_name, 1);
MAKE_STD_ZVAL(classname);
ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
+ MAKE_STD_ZVAL(fn_flags);
+ ZVAL_LONG(fn_flags, method->common.fn_flags);
reflection_instanciate(reflection_method_ptr, object TSRMLS_CC);
intern = (reflection_object *) zend_object_store_get_object(object TSRMLS_CC);
intern->ptr = method;
intern->free_ptr = 0;
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &name,
sizeof(zval *), NULL);
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **)
&classname, sizeof(zval *), NULL);
+ zend_hash_update(Z_OBJPROP_P(object), "flags", sizeof("flags"), (void **)
&fn_flags, sizeof(zval *), NULL);
}
/* }}} */
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php