@@ -171,7 +171,6 @@ typedef struct {
171
171
void * ptr ;
172
172
zend_class_entry * ce ;
173
173
reflection_type_t ref_type ;
174
- unsigned int ignore_visibility :1 ;
175
174
zend_object zo ;
176
175
} reflection_object ;
177
176
@@ -1440,7 +1439,6 @@ static void reflection_property_factory(zend_class_entry *ce, zend_string *name,
1440
1439
intern -> ptr = reference ;
1441
1440
intern -> ref_type = REF_TYPE_PROPERTY ;
1442
1441
intern -> ce = ce ;
1443
- intern -> ignore_visibility = 0 ;
1444
1442
ZVAL_STR_COPY (reflection_prop_name (object ), name );
1445
1443
ZVAL_STR_COPY (reflection_prop_class (object ), prop ? prop -> ce -> name : ce -> name );
1446
1444
}
@@ -1463,7 +1461,6 @@ static void reflection_class_constant_factory(zend_string *name_str, zend_class_
1463
1461
intern -> ptr = constant ;
1464
1462
intern -> ref_type = REF_TYPE_CLASS_CONSTANT ;
1465
1463
intern -> ce = constant -> ce ;
1466
- intern -> ignore_visibility = 0 ;
1467
1464
1468
1465
ZVAL_STR_COPY (reflection_prop_name (object ), name_str );
1469
1466
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
1482
1479
intern -> ptr = constant ;
1483
1480
intern -> ref_type = REF_TYPE_CLASS_CONSTANT ;
1484
1481
intern -> ce = constant -> ce ;
1485
- intern -> ignore_visibility = 0 ;
1486
1482
1487
1483
ZVAL_STR_COPY (reflection_prop_name (object ), name_str );
1488
1484
ZVAL_STR_COPY (reflection_prop_class (object ), constant -> ce -> name );
@@ -3313,15 +3309,6 @@ static void reflection_method_invoke(INTERNAL_FUNCTION_PARAMETERS, int variadic)
3313
3309
RETURN_THROWS ();
3314
3310
}
3315
3311
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
-
3325
3312
if (variadic ) {
3326
3313
ZEND_PARSE_PARAMETERS_START (1 , -1 )
3327
3314
Z_PARAM_OBJECT_OR_NULL (object )
@@ -3696,16 +3683,11 @@ ZEND_METHOD(ReflectionMethod, getPrototype)
3696
3683
/* {{{ Sets whether non-public methods can be invoked */
3697
3684
ZEND_METHOD (ReflectionMethod , setAccessible )
3698
3685
{
3699
- reflection_object * intern ;
3700
3686
bool visible ;
3701
3687
3702
3688
if (zend_parse_parameters (ZEND_NUM_ARGS (), "b" , & visible ) == FAILURE ) {
3703
3689
RETURN_THROWS ();
3704
3690
}
3705
-
3706
- intern = Z_REFLECTION_P (ZEND_THIS );
3707
-
3708
- intern -> ignore_visibility = visible ;
3709
3691
}
3710
3692
/* }}} */
3711
3693
@@ -3745,7 +3727,6 @@ ZEND_METHOD(ReflectionClassConstant, __construct)
3745
3727
intern -> ptr = constant ;
3746
3728
intern -> ref_type = REF_TYPE_CLASS_CONSTANT ;
3747
3729
intern -> ce = constant -> ce ;
3748
- intern -> ignore_visibility = 0 ;
3749
3730
ZVAL_STR_COPY (reflection_prop_name (object ), constname );
3750
3731
ZVAL_STR_COPY (reflection_prop_class (object ), constant -> ce -> name );
3751
3732
}
@@ -5453,7 +5434,6 @@ ZEND_METHOD(ReflectionProperty, __construct)
5453
5434
intern -> ptr = reference ;
5454
5435
intern -> ref_type = REF_TYPE_PROPERTY ;
5455
5436
intern -> ce = ce ;
5456
- intern -> ignore_visibility = 0 ;
5457
5437
}
5458
5438
/* }}} */
5459
5439
@@ -5580,13 +5560,6 @@ ZEND_METHOD(ReflectionProperty, getValue)
5580
5560
5581
5561
GET_REFLECTION_OBJECT_PTR (ref );
5582
5562
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
-
5590
5563
if (prop_get_flags (ref ) & ZEND_ACC_STATIC ) {
5591
5564
member_p = zend_read_static_property_ex (intern -> ce , ref -> unmangled_name , 0 );
5592
5565
if (member_p ) {
@@ -5630,13 +5603,6 @@ ZEND_METHOD(ReflectionProperty, setValue)
5630
5603
5631
5604
GET_REFLECTION_OBJECT_PTR (ref );
5632
5605
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
-
5640
5606
if (prop_get_flags (ref ) & ZEND_ACC_STATIC ) {
5641
5607
if (zend_parse_parameters_ex (ZEND_PARSE_PARAMS_QUIET , ZEND_NUM_ARGS (), "z" , & value ) == FAILURE ) {
5642
5608
if (zend_parse_parameters (ZEND_NUM_ARGS (), "zz" , & tmp , & value ) == FAILURE ) {
@@ -5669,13 +5635,6 @@ ZEND_METHOD(ReflectionProperty, isInitialized)
5669
5635
5670
5636
GET_REFLECTION_OBJECT_PTR (ref );
5671
5637
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
-
5679
5638
if (prop_get_flags (ref ) & ZEND_ACC_STATIC ) {
5680
5639
member_p = zend_read_static_property_ex (intern -> ce , ref -> unmangled_name , 1 );
5681
5640
if (member_p ) {
@@ -5762,16 +5721,11 @@ ZEND_METHOD(ReflectionProperty, getAttributes)
5762
5721
/* {{{ Sets whether non-public properties can be requested */
5763
5722
ZEND_METHOD (ReflectionProperty , setAccessible )
5764
5723
{
5765
- reflection_object * intern ;
5766
5724
bool visible ;
5767
5725
5768
5726
if (zend_parse_parameters (ZEND_NUM_ARGS (), "b" , & visible ) == FAILURE ) {
5769
5727
RETURN_THROWS ();
5770
5728
}
5771
-
5772
- intern = Z_REFLECTION_P (ZEND_THIS );
5773
-
5774
- intern -> ignore_visibility = visible ;
5775
5729
}
5776
5730
/* }}} */
5777
5731
0 commit comments