helly Tue Oct 12 07:01:12 2004 EDT
Modified files:
/ZendEngine2 zend_builtin_functions.c
Log:
- Fix visibility in get_class_vars() and get_class_methods()
# Still there is a problem/error in the executor, i'll have a look
http://cvs.php.net/diff.php/ZendEngine2/zend_builtin_functions.c?r1=1.250&r2=1.251&ty=u
Index: ZendEngine2/zend_builtin_functions.c
diff -u ZendEngine2/zend_builtin_functions.c:1.250
ZendEngine2/zend_builtin_functions.c:1.251
--- ZendEngine2/zend_builtin_functions.c:1.250 Tue Oct 12 05:13:20 2004
+++ ZendEngine2/zend_builtin_functions.c Tue Oct 12 07:01:08 2004
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_builtin_functions.c,v 1.250 2004/10/12 09:13:20 helly Exp $ */
+/* $Id: zend_builtin_functions.c,v 1.251 2004/10/12 11:01:08 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
@@ -663,6 +663,7 @@
{
zval **class_name;
zend_class_entry *ce, **pce;
+ int instanceof;
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1,
&class_name)==FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -674,6 +675,9 @@
RETURN_FALSE;
} else {
ce = *pce;
+
+ instanceof = EG(scope) && instanceof_function(EG(scope), ce
TSRMLS_CC);
+
array_init(return_value);
if (zend_hash_num_elements(&ce->default_properties) > 0) {
@@ -690,9 +694,14 @@
zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len,
&num_index, 0, &pos);
zend_hash_move_forward_ex(&ce->default_properties, &pos);
zend_unmangle_property_name(key, &class_name,
&prop_name);
- if (class_name && class_name[0] != '*' &&
strcmp(class_name, ce->name)) {
- /* filter privates from base classes */
- continue;
+ if (class_name) {
+ if (class_name[0] != '*' &&
strcmp(class_name, ce->name)) {
+ /* filter privates from base
classes */
+ continue;
+ } else if (!instanceof) {
+ /* filter protected if not
inside class */
+ continue;
+ }
}
/* copy: enforce read only access */
@@ -776,6 +785,7 @@
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();
@@ -797,18 +807,22 @@
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) {
- 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);
+ if ((mptr->common.fn_flags & ZEND_ACC_PUBLIC)
+ || (instanceof && ((mptr->common.fn_flags &
ZEND_ACC_PROTECTED) || 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);
+ }
zend_hash_move_forward_ex(&ce->function_table, &pos);
}
}
/* }}} */
-\
/* {{{ proto bool method_exists(object object, string method)
--
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|