@@ -4128,6 +4128,27 @@ static bool fbc_is_finalized(zend_function *fbc) {
4128
4128
return !ZEND_USER_CODE (fbc -> type ) || (fbc -> common .fn_flags & ZEND_ACC_DONE_PASS_TWO );
4129
4129
}
4130
4130
4131
+ static bool zend_compile_ignore_class (zend_class_entry * ce , zend_string * filename )
4132
+ {
4133
+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
4134
+ return CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ;
4135
+ } else {
4136
+ return (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES )
4137
+ && ce -> info .user .filename != filename ;
4138
+ }
4139
+ }
4140
+
4141
+ static bool zend_compile_ignore_function (zend_function * fbc , zend_string * filename )
4142
+ {
4143
+ if (fbc -> type == ZEND_INTERNAL_FUNCTION ) {
4144
+ return CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ;
4145
+ } else {
4146
+ return (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS )
4147
+ || ((CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES )
4148
+ && fbc -> op_array .filename != filename );
4149
+ }
4150
+ }
4151
+
4131
4152
static zend_result zend_try_compile_ct_bound_init_user_func (zend_ast * name_ast , uint32_t num_args ) /* {{{ */
4132
4153
{
4133
4154
zend_string * name , * lcname ;
@@ -4142,11 +4163,9 @@ static zend_result zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast,
4142
4163
lcname = zend_string_tolower (name );
4143
4164
4144
4165
fbc = zend_hash_find_ptr (CG (function_table ), lcname );
4145
- if (!fbc || !fbc_is_finalized (fbc )
4146
- || (fbc -> type == ZEND_INTERNAL_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ))
4147
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS ))
4148
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) && fbc -> op_array .filename != CG (active_op_array )-> filename )
4149
- ) {
4166
+ if (!fbc
4167
+ || !fbc_is_finalized (fbc )
4168
+ || zend_compile_ignore_function (fbc , CG (active_op_array )-> filename )) {
4150
4169
zend_string_release_ex (lcname , 0 );
4151
4170
return FAILURE ;
4152
4171
}
@@ -4818,11 +4837,9 @@ static void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{
4818
4837
return ;
4819
4838
}
4820
4839
4821
- if (!fbc || !fbc_is_finalized (fbc )
4822
- || (fbc -> type == ZEND_INTERNAL_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ))
4823
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS ))
4824
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) && fbc -> op_array .filename != CG (active_op_array )-> filename )
4825
- ) {
4840
+ if (!fbc
4841
+ || !fbc_is_finalized (fbc )
4842
+ || zend_compile_ignore_function (fbc , CG (active_op_array )-> filename )) {
4826
4843
zend_string_release_ex (lcname , 0 );
4827
4844
zend_compile_dynamic_call (result , & name_node , args_ast , ast -> lineno );
4828
4845
return ;
@@ -4995,7 +5012,11 @@ static void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type
4995
5012
if (opline -> op1_type == IS_CONST ) {
4996
5013
zend_string * lcname = Z_STR_P (CT_CONSTANT (opline -> op1 ) + 1 );
4997
5014
ce = zend_hash_find_ptr (CG (class_table ), lcname );
4998
- if (!ce && CG (active_class_entry )
5015
+ if (ce ) {
5016
+ if (zend_compile_ignore_class (ce , CG (active_op_array )-> filename )) {
5017
+ ce = NULL ;
5018
+ }
5019
+ } else if (CG (active_class_entry )
4999
5020
&& zend_string_equals_ci (CG (active_class_entry )-> name , lcname )) {
5000
5021
ce = CG (active_class_entry );
5001
5022
}
@@ -8390,9 +8411,7 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
8390
8411
ce -> parent_name , NULL , ZEND_FETCH_CLASS_NO_AUTOLOAD );
8391
8412
8392
8413
if (parent_ce
8393
- && ((parent_ce -> type != ZEND_INTERNAL_CLASS ) || !(CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ))
8394
- && ((parent_ce -> type != ZEND_USER_CLASS ) || !(CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) || (parent_ce -> info .user .filename == ce -> info .user .filename ))) {
8395
-
8414
+ && !zend_compile_ignore_class (parent_ce , ce -> info .user .filename )) {
8396
8415
if (zend_try_early_bind (ce , parent_ce , lcname , NULL )) {
8397
8416
zend_string_release (lcname );
8398
8417
return ;
0 commit comments