ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-cvs
php-cvs
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/reflection php_reflection.c
by Marcus Boerger other posts by this author
Jun 24 2006 10:55AM messages near this date
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/reflection php_reflection.c | [PHP-CVS] cvs: php-src(PHP_5_2) /ext/reflection php_reflection.c
helly		Sat Jun 24 18:55:15 2006 UTC

  Modified files:              (Branch: PHP_5_2)
    /php-src/ext/reflection	php_reflection.c 
  Log:
  - MFH Fix ReflectionObject::getProperties() + dyn properties
  
http://cvs.php.net/viewvc.cgi/php-src/ext/reflection/php_reflection.c?r1=1.164.2.33.2.7&r2=1
.164.2.33.2.8&diff_format=u
Index: php-src/ext/reflection/php_reflection.c
diff -u php-src/ext/reflection/php_reflection.c:1.164.2.33.2.7 php-src/ext/reflection/php_re
flection.c:1.164.2.33.2.8
--- php-src/ext/reflection/php_reflection.c:1.164.2.33.2.7	Sat Jun 10 00:40:56 2006
+++ php-src/ext/reflection/php_reflection.c	Sat Jun 24 18:55:15 2006
@@ -20,7 +20,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_reflection.c,v 1.164.2.33.2.7 2006/06/10 00:40:56 bjori Exp $ */
+/* $Id: php_reflection.c,v 1.164.2.33.2.8 2006/06/24 18:55:15 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -3078,6 +3078,28 @@
 }
 /* }}} */
 
+/* {{{ _adddynproperty */
+static int _adddynproperty(zval **pptr, int num_args, va_list args, zend_hash_key *hash_key
)
+{
+	zval *property;
+	zend_class_entry *ce = *va_arg(args, zend_class_entry**);
+	zval *retval = va_arg(args, zval*), member;
+	TSRMLS_FETCH();
+
+	if (hash_key-> arKey[0] == '\0') {
+		return 0; /* non public cannot be dynamic */
+	}
+
+	ZVAL_STRINGL(&member, hash_key-> arKey, hash_key->nKeyLength-1, 0);
+	if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) {
+		ALLOC_ZVAL(property);
+		reflection_property_factory(ce, &EG(std_property_info), property TSRMLS_CC);
+		add_next_index_zval(retval, property);
+	}
+	return 0;
+}
+/* }}} */
+
 /* {{{ proto public ReflectionProperty[] ReflectionClass::getProperties()
    Returns an array of this class' properties */
 ZEND_METHOD(reflection_class, getProperties)
@@ -3101,6 +3123,11 @@
 
 	array_init(return_value);
 	zend_hash_apply_with_arguments(&ce-> properties_info, (apply_func_args_t) _addproperty, 3, 
&ce, return_value, filter);
+
+	if (intern-> obj && (filter & ZEND_ACC_PUBLIC) != 0 && Z_OBJ_HT_P(intern->obj)->get_propert
ies) {
+		HashTable *properties = Z_OBJ_HT_P(intern-> obj)->get_properties(intern->obj TSRMLS_CC);
+		zend_hash_apply_with_arguments(properties, (apply_func_args_t) _adddynproperty, 2, &ce, r
eturn_value);
+	}
 }
 /* }}} */
 
@@ -4713,7 +4740,7 @@
 	php_info_print_table_start();
 	php_info_print_table_header(2, "Reflection", "enabled");
 
-	php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.7 2006/06/10 
00:40:56 bjori Exp $");
+	php_info_print_table_row(2, "Version", "$Id: php_reflection.c,v 1.164.2.33.2.8 2006/06/24 
18:55:15 helly Exp $");
 
 	php_info_print_table_end();
 } /* }}} */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Thread:
Antony Dovgal
Marcus Boerger
Marcus Boerger
Marcus Boerger
Marcus Boerger
Antony Dovgal

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved