Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7990 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21462 invoked by uid 1010); 19 Feb 2004 14:51:43 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 21388 invoked by uid 1007); 19 Feb 2004 14:51:42 -0000 To: internals@lists.php.net Date: Thu, 19 Feb 2004 15:51:41 +0100 Message-ID: <20040219155141.76088c90@localhost.localdomain> Organization: Freelancer X-Newsreader: Sylpheed version 0.9.8claws (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Thu__19_Feb_2004_15_51_41_+0100_O5PE4mv30vgNB4gR" X-Posted-By: 213.196.211.23 Subject: add fn_flags to getMethod() result (reflection) From: paj@pearfr.org (Pierre-Alain Joye) --Multipart=_Thu__19_Feb_2004_15_51_41_+0100_O5PE4mv30vgNB4gR Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 --Multipart=_Thu__19_Feb_2004_15_51_41_+0100_O5PE4mv30vgNB4gR Content-Type: text/plain; name="patc_reflection_add_fn_flags.txt" Content-Disposition: attachment; filename="patc_reflection_add_fn_flags.txt" Content-Transfer-Encoding: 7bit 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); } /* }}} */ --Multipart=_Thu__19_Feb_2004_15_51_41_+0100_O5PE4mv30vgNB4gR--