@@ -3996,6 +3996,27 @@ static bool fbc_is_finalized(zend_function *fbc) {
3996
3996
return !ZEND_USER_CODE (fbc -> type ) || (fbc -> common .fn_flags & ZEND_ACC_DONE_PASS_TWO );
3997
3997
}
3998
3998
3999
+ static bool zend_compile_ignore_class (zend_class_entry * ce , zend_string * filename )
4000
+ {
4001
+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
4002
+ return CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ;
4003
+ } else {
4004
+ return (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES )
4005
+ && ce -> info .user .filename != filename ;
4006
+ }
4007
+ }
4008
+
4009
+ static bool zend_compile_ignore_function (zend_function * fbc , zend_string * filename )
4010
+ {
4011
+ if (fbc -> type == ZEND_INTERNAL_FUNCTION ) {
4012
+ return CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ;
4013
+ } else {
4014
+ return (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS )
4015
+ || ((CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES )
4016
+ && fbc -> op_array .filename != filename );
4017
+ }
4018
+ }
4019
+
3999
4020
static zend_result zend_try_compile_ct_bound_init_user_func (zend_ast * name_ast , uint32_t num_args ) /* {{{ */
4000
4021
{
4001
4022
zend_string * name , * lcname ;
@@ -4010,11 +4031,9 @@ static zend_result zend_try_compile_ct_bound_init_user_func(zend_ast *name_ast,
4010
4031
lcname = zend_string_tolower (name );
4011
4032
4012
4033
fbc = zend_hash_find_ptr (CG (function_table ), lcname );
4013
- if (!fbc || !fbc_is_finalized (fbc )
4014
- || (fbc -> type == ZEND_INTERNAL_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ))
4015
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS ))
4016
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) && fbc -> op_array .filename != CG (active_op_array )-> filename )
4017
- ) {
4034
+ if (!fbc
4035
+ || !fbc_is_finalized (fbc )
4036
+ || zend_compile_ignore_function (fbc , CG (active_op_array )-> filename )) {
4018
4037
zend_string_release_ex (lcname , 0 );
4019
4038
return FAILURE ;
4020
4039
}
@@ -4538,11 +4557,9 @@ static void zend_compile_call(znode *result, zend_ast *ast, uint32_t type) /* {{
4538
4557
return ;
4539
4558
}
4540
4559
4541
- if (!fbc || !fbc_is_finalized (fbc )
4542
- || (fbc -> type == ZEND_INTERNAL_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_FUNCTIONS ))
4543
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_USER_FUNCTIONS ))
4544
- || (fbc -> type == ZEND_USER_FUNCTION && (CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) && fbc -> op_array .filename != CG (active_op_array )-> filename )
4545
- ) {
4560
+ if (!fbc
4561
+ || !fbc_is_finalized (fbc )
4562
+ || zend_compile_ignore_function (fbc , CG (active_op_array )-> filename )) {
4546
4563
zend_string_release_ex (lcname , 0 );
4547
4564
zend_compile_dynamic_call (result , & name_node , args_ast , ast -> lineno );
4548
4565
return ;
@@ -4709,7 +4726,11 @@ static void zend_compile_static_call(znode *result, zend_ast *ast, uint32_t type
4709
4726
if (opline -> op1_type == IS_CONST ) {
4710
4727
zend_string * lcname = Z_STR_P (CT_CONSTANT (opline -> op1 ) + 1 );
4711
4728
ce = zend_hash_find_ptr (CG (class_table ), lcname );
4712
- if (!ce && CG (active_class_entry )
4729
+ if (ce ) {
4730
+ if (zend_compile_ignore_class (ce , CG (active_op_array )-> filename )) {
4731
+ ce = NULL ;
4732
+ }
4733
+ } else if (CG (active_class_entry )
4713
4734
&& zend_string_equals_ci (CG (active_class_entry )-> name , lcname )) {
4714
4735
ce = CG (active_class_entry );
4715
4736
}
@@ -7990,9 +8011,7 @@ static void zend_compile_class_decl(znode *result, zend_ast *ast, bool toplevel)
7990
8011
ce -> parent_name , NULL , ZEND_FETCH_CLASS_NO_AUTOLOAD );
7991
8012
7992
8013
if (parent_ce
7993
- && ((parent_ce -> type != ZEND_INTERNAL_CLASS ) || !(CG (compiler_options ) & ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ))
7994
- && ((parent_ce -> type != ZEND_USER_CLASS ) || !(CG (compiler_options ) & ZEND_COMPILE_IGNORE_OTHER_FILES ) || (parent_ce -> info .user .filename == ce -> info .user .filename ))) {
7995
-
8014
+ && !zend_compile_ignore_class (parent_ce , ce -> info .user .filename )) {
7996
8015
if (zend_try_early_bind (ce , parent_ce , lcname , NULL )) {
7997
8016
zend_string_release (lcname );
7998
8017
return ;
0 commit comments