@@ -4118,6 +4118,27 @@ static bool fbc_is_finalized(zend_function *fbc) {
4118
4118
return !ZEND_USER_CODE (fbc -> type ) || (fbc -> common .fn_flags & ZEND_ACC_DONE_PASS_TWO );
4119
4119
}
4120
4120
4121
+ static bool zend_compile_ignore_class (zend_class_entry * ce , zend_string * filename )
4122
+ {
4123
+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
4124
+ return CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ;
4125
+ } else {
4126
+ return (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES )
4127
+ && ce -> info .user .filename != filename ;
4128
+ }
4129
+ }
4130
+
4131
+ static bool zend_compile_ignore_function (zend_function * fbc , zend_string * filename )
4132
+ {
4133
+ if (fbc -> type == ZEND_INTERNAL_FUNCTION ) {
4134
+ return CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ;
4135
+ } else {
4136
+ return (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS )
4137
+ || ((CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES )
4138
+ && fbc -> op_array .filename != filename );
4139
+ }
4140
+ }
4141
+
4121
4142
static zend_result zend_try_compile_ct_bound_init_user_func (zend_ast * name_ast , uint32_t num_args ) /* {{{ */
4122
4143
{
4123
4144
zend_string * name , * lcname ;
@@ -4132,11 +4153,9 @@ static zend_result zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast,
4132
4153
lcname = zend_string_tolower (name );
4133
4154
4134
4155
fbc = zend_hash_find_ptr (CG (function_table ), lcname );
4135
- if (!fbc || !fbc_is_finalized (fbc )
4136
- || (fbc -> type == ZEND_INTERNAL_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ))
4137
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS ))
4138
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) && fbc -> op_array .filename != CG (active_op_array )-> filename )
4139
- ) {
4156
+ if (!fbc
4157
+ || !fbc_is_finalized (fbc )
4158
+ || zend_compile_ignore_function (fbc , CG (active_op_array )-> filename )) {
4140
4159
zend_string_release_ex (lcname , 0 );
4141
4160
return FAILURE ;
4142
4161
}
@@ -4646,11 +4665,9 @@ static void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{
4646
4665
return ;
4647
4666
}
4648
4667
4649
- if (!fbc || !fbc_is_finalized (fbc )
4650
- || (fbc -> type == ZEND_INTERNAL_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ))
4651
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS ))
4652
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) && fbc -> op_array .filename != CG (active_op_array )-> filename )
4653
- ) {
4668
+ if (!fbc
4669
+ || !fbc_is_finalized (fbc )
4670
+ || zend_compile_ignore_function (fbc , CG (active_op_array )-> filename )) {
4654
4671
zend_string_release_ex (lcname , 0 );
4655
4672
zend_compile_dynamic_call (result , & name_node , args_ast , ast -> lineno );
4656
4673
return ;
@@ -4817,7 +4834,11 @@ static void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type
4817
4834
if (opline -> op1_type == IS_CONST ) {
4818
4835
zend_string * lcname = Z_STR_P (CT_CONSTANT (opline -> op1 ) + 1 );
4819
4836
ce = zend_hash_find_ptr (CG (class_table ), lcname );
4820
- if (!ce && CG (active_class_entry )
4837
+ if (ce ) {
4838
+ if (zend_compile_ignore_class (ce , CG (active_op_array )-> filename )) {
4839
+ ce = NULL ;
4840
+ }
4841
+ } else if (CG (active_class_entry )
4821
4842
&& zend_string_equals_ci (CG (active_class_entry )-> name , lcname )) {
4822
4843
ce = CG (active_class_entry );
4823
4844
}
@@ -8162,9 +8183,7 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
8162
8183
ce -> parent_name , NULL , ZEND_FETCH_CLASS_NO_AUTOLOAD );
8163
8184
8164
8185
if (parent_ce
8165
- && ((parent_ce -> type != ZEND_INTERNAL_CLASS ) || !(CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ))
8166
- && ((parent_ce -> type != ZEND_USER_CLASS ) || !(CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) || (parent_ce -> info .user .filename == ce -> info .user .filename ))) {
8167
-
8186
+ && !zend_compile_ignore_class (parent_ce , ce -> info .user .filename )) {
8168
8187
if (zend_try_early_bind (ce , parent_ce , lcname , NULL )) {
8169
8188
zend_string_release (lcname );
8170
8189
return ;
0 commit comments