From: Nikita Popov Date: Sun, 10 Dec 2017 21:33:47 +0000 (+0100) Subject: Fix relative constant addressing in file cache X-Git-Tag: php-7.3.0alpha1~832 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf9e2692c0d01db3df698df9e0f0057fa192b165;p=php Fix relative constant addressing in file cache PASS_TWO_UNDO_CONSTANT was using the serialized op_array->literals pointer, resulting in incorrect offsets. --- diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c index 2e5f3afdd2..33c8da0d0c 100644 --- a/ext/opcache/zend_file_cache.c +++ b/ext/opcache/zend_file_cache.c @@ -392,6 +392,11 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra if (!IS_SERIALIZED(op_array->opcodes)) { zend_op *opline, *end; +#if !ZEND_USE_ABS_CONST_ADDR + zval *literals = op_array->literals; + UNSERIALIZE_PTR(literals); +#endif + SERIALIZE_PTR(op_array->opcodes); opline = op_array->opcodes; UNSERIALIZE_PTR(opline); @@ -406,10 +411,10 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra } #else if (opline->op1_type == IS_CONST) { - ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op1); + opline->op1.constant = RT_CONSTANT(opline, opline->op1) - literals; } if (opline->op2_type == IS_CONST) { - ZEND_PASS_TWO_UNDO_CONSTANT(op_array, opline, opline->op2); + opline->op2.constant = RT_CONSTANT(opline, opline->op2) - literals; } #endif #if ZEND_USE_ABS_JMP_ADDR