Skip to content

Commit 7edaed6

Browse files
committed
Merge branch 'PHP-7.1'
* PHP-7.1: op_arrays may be optimized independetly and "script" might be NULL
2 parents 6e7c372 + 129e8da commit 7edaed6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2350,7 +2350,7 @@ static inline zend_uchar get_compound_assign_op(zend_uchar opcode) {
23502350
}
23512351

23522352
static inline zend_class_entry *get_class_entry(const zend_script *script, zend_string *lcname) {
2353-
zend_class_entry *ce = zend_hash_find_ptr(&script->class_table, lcname);
2353+
zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL;
23542354
if (ce) {
23552355
return ce;
23562356
}
@@ -2943,7 +2943,7 @@ static void zend_update_type_info(const zend_op_array *op_array,
29432943
case ZEND_DECLARE_ANON_CLASS:
29442944
case ZEND_DECLARE_ANON_INHERITED_CLASS:
29452945
UPDATE_SSA_TYPE(MAY_BE_CLASS, ssa_ops[i].result_def);
2946-
if ((ce = zend_hash_find_ptr(&script->class_table, Z_STR_P(CRT_CONSTANT_EX(op_array, opline->op1, ssa->rt_constants)))) != NULL) {
2946+
if (script && (ce = zend_hash_find_ptr(&script->class_table, Z_STR_P(CRT_CONSTANT_EX(op_array, opline->op1, ssa->rt_constants)))) != NULL) {
29472947
UPDATE_SSA_OBJ_TYPE(ce, 0, ssa_ops[i].result_def);
29482948
}
29492949
break;

ext/opcache/Optimizer/zend_ssa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ static void place_essa_pis(
500500
(opline-1)->op2_type == IS_CONST) {
501501
int var = EX_VAR_TO_NUM((opline-1)->op1.var);
502502
zend_string *lcname = Z_STR_P(CRT_CONSTANT((opline-1)->op2) + 1);
503-
zend_class_entry *ce = zend_hash_find_ptr(&script->class_table, lcname);
503+
zend_class_entry *ce = script ? zend_hash_find_ptr(&script->class_table, lcname) : NULL;
504504
if (!ce) {
505505
ce = zend_hash_find_ptr(CG(class_table), lcname);
506506
if (!ce || ce->type != ZEND_INTERNAL_CLASS) {

0 commit comments

Comments
 (0)