summaryrefslogtreecommitdiff
path: root/Zend/zend_builtin_functions.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2005-05-03 08:52:04 +0000
committerDmitry Stogov <dmitry@php.net>2005-05-03 08:52:04 +0000
commit81b536f4a63bac7e823f8e82421b18a67db6c78b (patch)
tree307299795286170f5e9cedc5ad8206d054d369ea /Zend/zend_builtin_functions.c
parent2ad6cacf7e432213748a4c47635ba8f3de297ecd (diff)
downloadphp-git-81b536f4a63bac7e823f8e82421b18a67db6c78b.tar.gz
Fixed bug #32296 (get_class_methods output has changed between 5.0.2 and 5.0.3)
Now get_class_methods() shows accessible private and protected methods if it is called from class scope.
Diffstat (limited to 'Zend/zend_builtin_functions.c')
-rw-r--r--Zend/zend_builtin_functions.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index abd5996623..34fe3db7c0 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -812,7 +812,6 @@ ZEND_FUNCTION(get_class_methods)
zend_class_entry *ce = NULL, **pce;
HashPosition pos;
zend_function *mptr;
- int instanceof;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &class)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -834,14 +833,16 @@ ZEND_FUNCTION(get_class_methods)
RETURN_NULL();
}
- instanceof = EG(scope) && instanceof_function(EG(scope), ce TSRMLS_CC);
-
array_init(return_value);
zend_hash_internal_pointer_reset_ex(&ce->function_table, &pos);
while (zend_hash_get_current_data_ex(&ce->function_table, (void **) &mptr, &pos) == SUCCESS) {
if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
- || (instanceof && ((mptr->common.fn_flags & ZEND_ACC_PROTECTED) || EG(scope) == mptr->common.scope))) {
+ || (EG(scope) &&
+ (((mptr->common.fn_flags & ZEND_ACC_PROTECTED) &&
+ instanceof_function(EG(scope), mptr->common.scope TSRMLS_CC))
+ || ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) &&
+ EG(scope) == mptr->common.scope)))) {
MAKE_STD_ZVAL(method_name);
ZVAL_STRING(method_name, mptr->common.function_name, 1);
zend_hash_next_index_insert(return_value->value.ht, &method_name, sizeof(zval *), NULL);