summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-07-25 14:06:52 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-07-25 14:06:52 +0000
commite11e2a137ce5bd84aa710e152a2ecf10d67abd40 (patch)
tree447e301ccedd7a899875b34bff07dc4a489bef81 /ext/reflection/php_reflection.c
parent356facf4afc9c3cea3d6648923f69daba9e1ec82 (diff)
downloadphp-git-e11e2a137ce5bd84aa710e152a2ecf10d67abd40.tar.gz
Fixed bug #38132 (ReflectionClass::getStaticProperties() retains \0 in key
names).
Diffstat (limited to 'ext/reflection/php_reflection.c')
-rw-r--r--ext/reflection/php_reflection.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 06c04ab596..c8a6b2ae5e 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -2623,17 +2623,42 @@ ZEND_METHOD(reflection_class, __construct)
Returns an associative array containing all static property values of the class */
ZEND_METHOD(reflection_class, getStaticProperties)
{
- zval *tmp_copy;
reflection_object *intern;
zend_class_entry *ce;
-
+ HashPosition pos;
+ zval **value;
+
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
array_init(return_value);
- zend_hash_copy(Z_ARRVAL_P(return_value), CE_STATIC_MEMBERS(ce), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
+
+ zend_hash_internal_pointer_reset_ex(CE_STATIC_MEMBERS(ce), &pos);
+
+ while (zend_hash_get_current_data_ex(CE_STATIC_MEMBERS(ce), (void **) &value, &pos) == SUCCESS) {
+ uint key_len;
+ char *key;
+ ulong num_index;
+
+ if (zend_hash_get_current_key_ex(CE_STATIC_MEMBERS(ce), &key, &key_len, &num_index, 0, &pos) != FAILURE && key) {
+ zval_add_ref(value);
+
+ if (*key == '\0') {
+ *key++;
+ key_len--;
+
+ }
+ if (*key == '*' && *(key+1) == '\0') {
+ *(key+1) = *key++;
+ key_len--;
+ }
+
+ zend_hash_update(Z_ARRVAL_P(return_value), key, key_len, value, sizeof(zval *), NULL);
+ }
+ zend_hash_move_forward_ex(CE_STATIC_MEMBERS(ce), &pos);
+ }
}
/* }}} */