From 5ee7b7d01ae3588e3e026592eb61159e778cdde4 Mon Sep 17 00:00:00 2001
From: Dmitry Stogov <dmitry@zend.com>
Date: Wed, 9 Dec 2015 05:15:58 +0300
Subject: [PATCH] Don't create live-range across NOPs and some other
 instructions

---
 Zend/zend_compile.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index d304a6b28e..dd9c5a44de 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1945,14 +1945,25 @@ static void zend_find_live_range(zend_op *opline, zend_uchar type, uint32_t var)
 
 static zend_always_inline int zend_is_def_range(zend_op *opline, zend_uchar type, uint32_t var) /* {{{ */
 {
-	if (opline->result_type == type && opline->result.var == var) {
-		return opline->opcode != ZEND_ADD_ARRAY_ELEMENT &&
-			opline->opcode != ZEND_ROPE_ADD;
-	} else if (opline->opcode == ZEND_OP_DATA) {
-		return (opline-1)->result_type == type &&
-			(opline-1)->result.var == var;
+	while (1) {
+		if (opline->result_type == type && opline->result.var == var) {
+			return opline->opcode != ZEND_ADD_ARRAY_ELEMENT &&
+				opline->opcode != ZEND_ROPE_ADD;
+		} else if (opline->opcode == ZEND_OP_DATA) {
+			return (opline-1)->result_type == type &&
+				(opline-1)->result.var == var;
+		} else if (opline->opcode == ZEND_END_SILENCE ||
+		           opline->opcode == ZEND_NOP ||
+	    	       opline->opcode == ZEND_EXT_NOP ||
+	        	   opline->opcode == ZEND_EXT_STMT ||
+	        	   opline->opcode == ZEND_EXT_FCALL_BEGIN ||
+	        	   opline->opcode == ZEND_EXT_FCALL_END ||
+	        	   opline->opcode == ZEND_TICKS) {
+			opline--;
+		} else {
+			return 0;
+		}
 	}
-	return 0;
 }
 /* }}} */
 
-- 
2.40.0