com php-src: Fixed getDefaultProperties (it should not return reference): ext/reflection/php_reflection.c
| From: | Xinchen Hui | Date: | Thu, 31 Jul 2014 04:55:53 +0000 |
| Subject: | com php-src: Fixed getDefaultProperties (it should not return reference): ext/reflection/php_reflection.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-79688@lists.php.net to get a copy of this message | ||
Commit: be010e26c4e3ccf489747bc3626211400dd192d7
Author: Xinchen Hui <laruence@php.net> Thu, 31 Jul 2014 12:55:53 +0800
Parents: 70fb0e751913a408e7906adba8bcaff08da44e9e
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=be010e26c4e3ccf489747bc3626211400dd192d7
Log:
Fixed getDefaultProperties (it should not return reference)
Changed paths:
M ext/reflection/php_reflection..c
Diff:
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index f2d3059..508ddce 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -3351,16 +3351,12 @@ ZEND_METHOD(reflection_class, __construct)
/* {{{ add_class_vars */
static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value TSRMLS_DC)
{
- HashPosition pos;
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
ulong num_index;
- zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
- while ((prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) !=
NULL) {
- zend_hash_get_current_key_ex(&ce->properties_info, &key, &num_index, 0, &pos);
- zend_hash_move_forward_ex(&ce->properties_info, &pos);
+ ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != ce) ||
((prop_info->flags & ZEND_ACC_PROTECTED) &&
@@ -3382,6 +3378,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval
*return_value
}
/* copy: enforce read only access */
+ ZVAL_DEREF(prop);
ZVAL_DUP(&prop_copy, prop);
/* this is necessary to make it able to work with default array
@@ -3391,7 +3388,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval
*return_value
}
zend_hash_update(Z_ARRVAL_P(return_value), key, &prop_copy);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* }}} */