@@ -692,6 +692,69 @@ static bool zend_may_be_dynamic_property(zend_class_entry *ce, zend_string *memb
692692 return 0 ;
693693}
694694
695+ static bool zend_jit_class_may_be_modified (const zend_class_entry * ce , const zend_op_array * called_from )
696+ {
697+ uint32_t i ;
698+
699+ if (ce -> type == ZEND_INTERNAL_CLASS ) {
700+ #ifdef _WIN32
701+ /* ASLR */
702+ return 1 ;
703+ #else
704+ return 0 ;
705+ #endif
706+ } else if (ce -> type == ZEND_USER_CLASS ) {
707+ if (ce -> ce_flags & ZEND_ACC_PRELOADED ) {
708+ return 0 ;
709+ }
710+ if (ce -> info .user .filename == called_from -> filename ) {
711+ if (ce -> parent && zend_jit_class_may_be_modified (ce -> parent , called_from )) {
712+ return 1 ;
713+ }
714+ if (ce -> num_interfaces ) {
715+ for (i = 0 ; i < ce -> num_interfaces ; i ++ ) {
716+ if (zend_jit_class_may_be_modified (ce -> interfaces [i ], called_from )) {
717+ return 1 ;
718+ }
719+ }
720+ }
721+ if (ce -> num_traits ) {
722+ for (i = 0 ; i < ce -> num_traits ; i ++ ) {
723+ zend_class_entry * trait = zend_fetch_class_by_name (ce -> trait_names [i ].name ,
724+ ce -> trait_names [i ].lc_name , ZEND_FETCH_CLASS_TRAIT );
725+ if (zend_jit_class_may_be_modified (trait , called_from )) {
726+ return 1 ;
727+ }
728+ }
729+ }
730+ return 0 ;
731+ }
732+ }
733+ return 1 ;
734+ }
735+
736+ static bool zend_jit_may_be_modified (const zend_function * func , const zend_op_array * called_from )
737+ {
738+ if (func -> type == ZEND_INTERNAL_FUNCTION ) {
739+ #ifdef _WIN32
740+ /* ASLR */
741+ return 1 ;
742+ #else
743+ return 0 ;
744+ #endif
745+ } else if (func -> type == ZEND_USER_FUNCTION ) {
746+ if (func -> common .fn_flags & ZEND_ACC_PRELOADED ) {
747+ return 0 ;
748+ }
749+ if (func -> op_array .filename == called_from -> filename
750+ && (!func -> op_array .scope
751+ || !zend_jit_class_may_be_modified (func -> op_array .scope , called_from ))) {
752+ return 0 ;
753+ }
754+ }
755+ return 1 ;
756+ }
757+
695758#define OP_RANGE (ssa_op , opN ) \
696759 (((opline->opN##_type & (IS_TMP_VAR|IS_VAR|IS_CV)) && \
697760 ssa->var_info && \
0 commit comments