@@ -171,7 +171,6 @@ typedef struct {
171171 void * ptr ;
172172 zend_class_entry * ce ;
173173 reflection_type_t ref_type ;
174- unsigned int ignore_visibility :1 ;
175174 zend_object zo ;
176175} reflection_object ;
177176
@@ -1440,7 +1439,6 @@ static void reflection_property_factory(zend_class_entry *ce, zend_string *name,
14401439 intern -> ptr = reference ;
14411440 intern -> ref_type = REF_TYPE_PROPERTY ;
14421441 intern -> ce = ce ;
1443- intern -> ignore_visibility = 0 ;
14441442 ZVAL_STR_COPY (reflection_prop_name (object ), name );
14451443 ZVAL_STR_COPY (reflection_prop_class (object ), prop ? prop -> ce -> name : ce -> name );
14461444}
@@ -1463,7 +1461,6 @@ static void reflection_class_constant_factory(zend_string *name_str, zend_class_
14631461 intern -> ptr = constant ;
14641462 intern -> ref_type = REF_TYPE_CLASS_CONSTANT ;
14651463 intern -> ce = constant -> ce ;
1466- intern -> ignore_visibility = 0 ;
14671464
14681465 ZVAL_STR_COPY (reflection_prop_name (object ), name_str );
14691466 ZVAL_STR_COPY (reflection_prop_class (object ), constant -> ce -> name );
@@ -1482,7 +1479,6 @@ static void reflection_enum_case_factory(zend_class_entry *ce, zend_string *name
14821479 intern -> ptr = constant ;
14831480 intern -> ref_type = REF_TYPE_CLASS_CONSTANT ;
14841481 intern -> ce = constant -> ce ;
1485- intern -> ignore_visibility = 0 ;
14861482
14871483 ZVAL_STR_COPY (reflection_prop_name (object ), name_str );
14881484 ZVAL_STR_COPY (reflection_prop_class (object ), constant -> ce -> name );
@@ -3313,15 +3309,6 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
33133309 RETURN_THROWS ();
33143310 }
33153311
3316- if (!(mptr -> common .fn_flags & ZEND_ACC_PUBLIC ) && intern -> ignore_visibility == 0 ) {
3317- zend_throw_exception_ex (reflection_exception_ptr , 0 ,
3318- "Trying to invoke %s method %s::%s() from scope %s" ,
3319- mptr -> common .fn_flags & ZEND_ACC_PROTECTED ? "protected" : "private" ,
3320- ZSTR_VAL (mptr -> common .scope -> name ), ZSTR_VAL (mptr -> common .function_name ),
3321- ZSTR_VAL (Z_OBJCE_P (ZEND_THIS )-> name ));
3322- RETURN_THROWS ();
3323- }
3324-
33253312 if (variadic ) {
33263313 ZEND_PARSE_PARAMETERS_START (1 , -1 )
33273314 Z_PARAM_OBJECT_OR_NULL (object )
@@ -3696,16 +3683,11 @@ ZEND_METHOD(ReflectionMethod, getPrototype)
36963683/* {{{ Sets whether non-public methods can be invoked */
36973684ZEND_METHOD (ReflectionMethod , setAccessible )
36983685{
3699- reflection_object * intern ;
37003686 bool visible ;
37013687
37023688 if (zend_parse_parameters (ZEND_NUM_ARGS (), "b" , & visible ) == FAILURE ) {
37033689 RETURN_THROWS ();
37043690 }
3705-
3706- intern = Z_REFLECTION_P (ZEND_THIS );
3707-
3708- intern -> ignore_visibility = visible ;
37093691}
37103692/* }}} */
37113693
@@ -3745,7 +3727,6 @@ ZEND_METHOD(ReflectionClassConstant, __construct)
37453727 intern -> ptr = constant ;
37463728 intern -> ref_type = REF_TYPE_CLASS_CONSTANT ;
37473729 intern -> ce = constant -> ce ;
3748- intern -> ignore_visibility = 0 ;
37493730 ZVAL_STR_COPY (reflection_prop_name (object ), constname );
37503731 ZVAL_STR_COPY (reflection_prop_class (object ), constant -> ce -> name );
37513732}
@@ -5453,7 +5434,6 @@ ZEND_METHOD(ReflectionProperty, __construct)
54535434 intern -> ptr = reference ;
54545435 intern -> ref_type = REF_TYPE_PROPERTY ;
54555436 intern -> ce = ce ;
5456- intern -> ignore_visibility = 0 ;
54575437}
54585438/* }}} */
54595439
@@ -5580,13 +5560,6 @@ ZEND_METHOD(ReflectionProperty, getValue)
55805560
55815561 GET_REFLECTION_OBJECT_PTR (ref );
55825562
5583- if (!(prop_get_flags (ref ) & ZEND_ACC_PUBLIC ) && intern -> ignore_visibility == 0 ) {
5584- zend_throw_exception_ex (reflection_exception_ptr , 0 ,
5585- "Cannot access non-public property %s::$%s" ,
5586- ZSTR_VAL (intern -> ce -> name ), ZSTR_VAL (ref -> unmangled_name ));
5587- RETURN_THROWS ();
5588- }
5589-
55905563 if (prop_get_flags (ref ) & ZEND_ACC_STATIC ) {
55915564 member_p = zend_read_static_property_ex (intern -> ce , ref -> unmangled_name , 0 );
55925565 if (member_p ) {
@@ -5630,13 +5603,6 @@ ZEND_METHOD(ReflectionProperty, setValue)
56305603
56315604 GET_REFLECTION_OBJECT_PTR (ref );
56325605
5633- if (!(prop_get_flags (ref ) & ZEND_ACC_PUBLIC ) && intern -> ignore_visibility == 0 ) {
5634- zend_throw_exception_ex (reflection_exception_ptr , 0 ,
5635- "Cannot access non-public property %s::$%s" ,
5636- ZSTR_VAL (intern -> ce -> name ), ZSTR_VAL (ref -> unmangled_name ));
5637- RETURN_THROWS ();
5638- }
5639-
56405606 if (prop_get_flags (ref ) & ZEND_ACC_STATIC ) {
56415607 if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "z" , & value ) == FAILURE ) {
56425608 if (zend_parse_parameters (ZEND_NUM_ARGS (), "zz" , & tmp , & value ) == FAILURE ) {
@@ -5669,13 +5635,6 @@ ZEND_METHOD(ReflectionProperty, isInitialized)
56695635
56705636 GET_REFLECTION_OBJECT_PTR (ref );
56715637
5672- if (!(prop_get_flags (ref ) & ZEND_ACC_PUBLIC ) && intern -> ignore_visibility == 0 ) {
5673- zend_throw_exception_ex (reflection_exception_ptr , 0 ,
5674- "Cannot access non-public property %s::$%s" ,
5675- ZSTR_VAL (intern -> ce -> name ), ZSTR_VAL (ref -> unmangled_name ));
5676- RETURN_THROWS ();
5677- }
5678-
56795638 if (prop_get_flags (ref ) & ZEND_ACC_STATIC ) {
56805639 member_p = zend_read_static_property_ex (intern -> ce , ref -> unmangled_name , 1 );
56815640 if (member_p ) {
@@ -5762,16 +5721,11 @@ ZEND_METHOD(ReflectionProperty, getAttributes)
57625721/* {{{ Sets whether non-public properties can be requested */
57635722ZEND_METHOD (ReflectionProperty , setAccessible )
57645723{
5765- reflection_object * intern ;
57665724 bool visible ;
57675725
57685726 if (zend_parse_parameters (ZEND_NUM_ARGS (), "b" , & visible ) == FAILURE ) {
57695727 RETURN_THROWS ();
57705728 }
5771-
5772- intern = Z_REFLECTION_P (ZEND_THIS );
5773-
5774- intern -> ignore_visibility = visible ;
57755729}
57765730/* }}} */
57775731
0 commit comments