From 4fec06587b10b2658a8752e44a28cb5ecd342f81 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Tue, 15 Jun 2004 20:39:49 +0000 Subject: [PATCH] #28789: ReflectionProperty getValue() fails on public static members --- Zend/zend_reflection_api.c | 15 +++++++++++---- ext/reflection/php_reflection.c | 15 +++++++++++---- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c index 7817f41330..f198cbd593 100644 --- a/Zend/zend_reflection_api.c +++ b/Zend/zend_reflection_api.c @@ -2873,7 +2873,7 @@ ZEND_METHOD(reflection_property, getValue) METHOD_NOTSTATIC; GET_REFLECTION_OBJECT_PTR(ref); - if (ref->prop->flags & ~ZEND_ACC_PUBLIC) { + if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) { _DO_THROW("Cannot access non-public member"); /* Returns from this function */ } @@ -2882,9 +2882,16 @@ ZEND_METHOD(reflection_property, getValue) return; } - if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); - /* Bails out */ + if ((ref->prop->flags & ZEND_ACC_STATIC)) { + if (zend_hash_quick_find(Z_OBJCE_P(object)->static_members, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { + zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); + /* Bails out */ + } + } else { + if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { + zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); + /* Bails out */ + } } *return_value= **member; diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7817f41330..f198cbd593 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2873,7 +2873,7 @@ ZEND_METHOD(reflection_property, getValue) METHOD_NOTSTATIC; GET_REFLECTION_OBJECT_PTR(ref); - if (ref->prop->flags & ~ZEND_ACC_PUBLIC) { + if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) { _DO_THROW("Cannot access non-public member"); /* Returns from this function */ } @@ -2882,9 +2882,16 @@ ZEND_METHOD(reflection_property, getValue) return; } - if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { - zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); - /* Bails out */ + if ((ref->prop->flags & ZEND_ACC_STATIC)) { + if (zend_hash_quick_find(Z_OBJCE_P(object)->static_members, ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { + zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); + /* Bails out */ + } + } else { + if (zend_hash_quick_find(Z_OBJPROP_P(object), ref->prop->name, ref->prop->name_length + 1, ref->prop->h, (void **) &member) == FAILURE) { + zend_error(E_ERROR, "Internal error: Could not find the property %s", ref->prop->name); + /* Bails out */ + } } *return_value= **member; -- 2.50.1