php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #70587
Patch vld-0.13.0-compatible-php7-patch revision 2015-09-26 09:05 UTC by sohuxuxing at hotmail dot com

Patch vld-0.13.0-compatible-php7-patch for vld Bug #70587

Patch version 2015-09-26 09:05 UTC

Return to Bug #70587 | Download this patch
Patch Revisions:

Developer: sohuxuxing@hotmail.com

diff -ruN vld-0.13.0/php_vld.h vld-0.13.0_compatible_php7/php_vld.h
--- vld-0.13.0/php_vld.h	2014-11-14 19:29:32.000000000 +0800
+++ vld-0.13.0_compatible_php7/php_vld.h	2015-09-26 16:45:22.000000000 +0800
@@ -67,9 +67,9 @@
 
 # define ZVAL_VALUE_TYPE                zend_value
 # define ZVAL_VALUE_STRING_TYPE         zend_string
-# define ZVAL_STRING_VALUE(s)           (s.str)->val
-# define ZVAL_STRING_LEN(s)             (s.str)->len
-# define ZSTRING_VALUE(s)               (s)->val
+# define ZVAL_STRING_VALUE(s)           (s.str == 0) ? "" : (s.str)->val
+# define ZVAL_STRING_LEN(s)             (s.str == 0) ? 0 : (s.str)->len
+# define ZSTRING_VALUE(s)               (s == 0) ? "" :  (s)->val
 # define OPARRAY_VAR_NAME(v)            (v)->val
 #else
 # define ZHASHKEYSTR(k) ((k)->arKey)
diff -ruN vld-0.13.0/srm_oparray.c vld-0.13.0_compatible_php7/srm_oparray.c
--- vld-0.13.0/srm_oparray.c	2014-11-14 19:29:32.000000000 +0800
+++ vld-0.13.0_compatible_php7/srm_oparray.c	2015-09-26 16:45:24.000000000 +0800
@@ -81,20 +81,35 @@
 	/*  50 */	{ "BRK", SPECIAL },
 	/*  51 */	{ "CONT", ALL_USED },
 	/*  52 */	{ "BOOL", RES_USED | OP1_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  53 */	{ "FAST_CONCAT", RES_USED },
+	/*  54 */	{ "ROPE_INIT", ALL_USED },
+	/*  55 */	{ "ROPE_ADD", ALL_USED },
+	/*  56 */	{ "ROPE_END", ALL_USED },
+#else
 	/*  53 */	{ "INIT_STRING", RES_USED },
 	/*  54 */	{ "ADD_CHAR", ALL_USED },
 	/*  55 */	{ "ADD_STRING", ALL_USED },
 	/*  56 */	{ "ADD_VAR", ALL_USED },
+#endif
 	/*  57 */	{ "BEGIN_SILENCE", ALL_USED },
 	/*  58 */	{ "END_SILENCE", ALL_USED },
 	/*  59 */	{ "INIT_FCALL_BY_NAME", SPECIAL },
 	/*  60 */	{ "DO_FCALL", SPECIAL },
+#if defined(ZEND_ENGINE_3)
+	/*  61 */	{ "INIT_FCALL", SPECIAL },
+#else
 	/*  61 */	{ "DO_FCALL_BY_NAME", SPECIAL },
+#endif
 	/*  62 */	{ "RETURN", OP1_USED },
 	/*  63 */	{ "RECV", RES_USED | OP1_USED },
 	/*  64 */	{ "RECV_INIT", ALL_USED },
 	/*  65 */	{ "SEND_VAL", OP1_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  66 */	{ "SEND_VAR_EX", OP1_USED },
+#else
 	/*  66 */	{ "SEND_VAR", OP1_USED },
+#endif
 	/*  67 */	{ "SEND_REF", ALL_USED },
 	/*  68 */	{ "NEW", SPECIAL },
 #if (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 1)
@@ -111,15 +126,20 @@
 	/*  72 */	{ "ADD_ARRAY_ELEMENT", ALL_USED },
 	/*  73 */	{ "INCLUDE_OR_EVAL", ALL_USED | OP2_INCLUDE },
 	/*  74 */	{ "UNSET_VAR", ALL_USED },
-#ifdef ZEND_ENGINE_2
+#if  (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 	/*  75 */	{ "UNSET_DIM", ALL_USED },
 	/*  76 */	{ "UNSET_OBJ", ALL_USED },
 #else
 	/*  75 */	{ "UNSET_DIM_OBJ", ALL_USED },
 	/*  76 */	{ "ISSET_ISEMPTY", ALL_USED },
 #endif
+#if defined(ZEND_ENGINE_3)
+	/*  77 */	{ "FE_RESET_R", SPECIAL },
+	/*  78 */	{ "FE_FETCH_R", ALL_USED | OP2_OPNUM },
+#else
 	/*  77 */	{ "FE_RESET", SPECIAL },
 	/*  78 */	{ "FE_FETCH", ALL_USED | OP2_OPNUM },
+#endif
 	/*  79 */	{ "EXIT", ALL_USED },
 	/*  80 */	{ "FETCH_R", RES_USED | OP1_USED | OP_FETCH },
 	/*  81 */	{ "FETCH_DIM_R", ALL_USED },
@@ -139,7 +159,11 @@
 	/*  95 */	{ "FETCH_UNSET", ALL_USED },
 	/*  96 */	{ "FETCH_DIM_UNSET", ALL_USED },
 	/*  97 */	{ "FETCH_OBJ_UNSET", ALL_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  98 */	{ "FETCH_LIST", ALL_USED },
+#else
 	/*  98 */	{ "FETCH_DIM_TMP_VAR", ALL_USED },
+#endif
 	/*  99 */	{ "FETCH_CONSTANT", ALL_USED },
 #if (PHP_MAJOR_VERSION < 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3)
 	/*  100 */	{ "DECLARE_FUNCTION_OR_CLASS", ALL_USED },
@@ -152,7 +176,7 @@
 	/*  104 */	{ "EXT_NOP", ALL_USED },
 	/*  105 */	{ "TICKS", ALL_USED },
 	/*  106 */	{ "SEND_VAR_NO_REF", ALL_USED | EXT_VAL },
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 	/*  107 */	{ "CATCH", ALL_USED | EXT_VAL },
 	/*  108 */	{ "THROW", ALL_USED | EXT_VAL },
 	
@@ -175,6 +199,27 @@
 	/*  114 */	{ "ISSET_ISEMPTY_VAR", ALL_USED | EXT_VAL },
 	/*  115 */	{ "ISSET_ISEMPTY_DIM_OBJ", ALL_USED | EXT_VAL },
 	
+#if defined(ZEND_ENGINE_3)
+	/*  116 */	{ "SEND_VAL_EX", ALL_USED },
+	/*  117 */	{ "SEND_VAR", ALL_USED },
+	/*  118 */	{ "INIT_USER_CALL", ALL_USED },
+	
+	/*  119 */	{ "SEND_ARRAY", ALL_USED },
+	/*  120 */	{ "SEND_USER", ALL_USED },
+	
+	/*  121 */	{ "STRLEN", ALL_USED },
+	/*  122 */	{ "DEFINED", ALL_USED },
+	/*  123 */	{ "TYPE_CHECK", ALL_USED },
+	/*  124 */	{ "VERIFY_RETURN_TYPE", ALL_USED },
+	/*  125 */	{ "FE_RESET_RW", ALL_USED },
+	/*  126 */	{ "FE_FETCH_RW", ALL_USED },
+	/*  127 */	{ "FE_FREE", ALL_USED },
+	/*  128 */	{ "INIT_DYNAMIC_CALL", ALL_USED },
+	/*  129 */	{ "DO_ICALL", ALL_USED },
+	/*  130 */	{ "DO_UCALL", ALL_USED },
+	/*  131 */	{ "DO_FCALL_BY_NAME", ALL_USED },
+
+#else
 	/*  116 */	{ "IMPORT_FUNCTION", ALL_USED },
 	/*  117 */	{ "IMPORT_CLASS", ALL_USED },
 	/*  118 */	{ "IMPORT_CONST", ALL_USED },
@@ -194,6 +239,7 @@
 	/*  130 */	{ "ASSIGN_BW_AND_OBJ", ALL_USED },
 	/*  131 */	{ "ASSIGN_BW_XOR_OBJ", ALL_USED },
 
+#endif
 	/*  132 */	{ "PRE_INC_OBJ", ALL_USED },
 	/*  133 */	{ "PRE_DEC_OBJ", ALL_USED },
 	/*  134 */	{ "POST_INC_OBJ", ALL_USED },
@@ -208,34 +254,61 @@
 	/*  140 */	{ "DECLARE_INHERITED_CLASS", ALL_USED },
 	/*  141 */	{ "DECLARE_FUNCTION", ALL_USED },
 	
+#if defined(ZEND_ENGINE_3)
+	/*  142 */	{ "YIELD_FROM", ALL_USED },
+#else
 	/*  142 */	{ "RAISE_ABSTRACT_ERROR", ALL_USED },
-	
+#endif
 	/*  143 */	{ "DECLARE_CONST", OP1_USED | OP2_USED },
 	
 	/*  144 */	{ "ADD_INTERFACE", ALL_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  145 */	{ "DECLARE_INHERITED_CLASS_DELAYED", ALL_USED },
+#else
 	/*  145 */	{ "VERIFY_INSTANCEOF", ALL_USED },
+#endif
 	/*  146 */	{ "VERIFY_ABSTRACT_CLASS", ALL_USED },
 	/*  147 */	{ "ASSIGN_DIM", ALL_USED },
 	/*  148 */	{ "ISSET_ISEMPTY_PROP_OBJ", ALL_USED },
 	/*  149 */	{ "HANDLE_EXCEPTION", NONE_USED },
 	/*  150 */	{ "USER_OPCODE", ALL_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  151 */	{ "ASSERT_CHECK", ALL_USED },
+#else
 	/*  151 */	{ "UNKNOWN", ALL_USED },
+#endif
 	/*  152 */	{ "JMP_SET", ALL_USED | OP2_OPLINE },
 	/*  153 */	{ "DECLARE_LAMBDA_FUNCTION", OP1_USED },
 	/*  154 */	{ "ADD_TRAIT", ALL_USED },
 	/*  155 */	{ "BIND_TRAITS", OP1_USED },
 	/*  156 */	{ "SEPARATE", OP1_USED | RES_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  157 */	{ "FETCH_CLASS_NAME", OP1_USED | RES_USED },
+	/*  158 */	{ "CALL_TRAMPOLINE", OP1_USED | RES_USED },
+#else
 	/*  157 */	{ "QM_ASSIGN_VAR", OP1_USED | RES_USED },
 	/*  158 */	{ "JMP_SET_VAR", OP1_USED | RES_USED },
+#endif
 	/*  159 */	{ "DISCARD_EXCEPTION", NONE_USED },
 	/*  160 */	{ "YIELD", ALL_USED },
 	/*  161 */	{ "GENERATOR_RETURN", NONE_USED },
 	/*  162 */	{ "FAST_CALL", SPECIAL },
 	/*  163 */	{ "FAST_RET", SPECIAL },
-	/*  164 */	{ "ZEND_RECV_VARIADIC", ALL_USED },
+	/*  164 */	{ "RECV_VARIADIC", ALL_USED },
+#if defined(ZEND_ENGINE_3)
+	/*  165 */	{ "SEND_UNPACK", ALL_USED },
+	/*  166 */	{ "POW", ALL_USED },
+	/*  167 */	{ "ASSIGN_POW", ALL_USED },
+	/*  168 */	{ "BIND_GLOBAL", ALL_USED },
+	/*  169 */	{ "COALESCE", ALL_USED },
+	/*  170 */	{ "SPACESHIP", ALL_USED },
+	/*  171 */	{ "DECLARE_ANON_CLASS", ALL_USED },
+	/*  172 */	{ "DECLARE_ANON_INHERITED_CLASS", ALL_USED },
+#else
 	/*  165 */	{ "POW", ALL_USED },
 	/*  166 */	{ "ASSIGN_POW", ALL_USED | EXT_VAL },
 #endif
+#endif
 };
 
 zend_brk_cont_element* vld_find_brk_cont(int nest_levels, int array_offset, zend_op_array *op_array);
@@ -350,7 +423,7 @@
 }
 
 
-int vld_dump_znode (int *print_sep, unsigned int node_type, VLD_ZNODE node, unsigned int base_address TSRMLS_DC)
+int vld_dump_znode (int *print_sep, unsigned int node_type, VLD_ZNODE node, unsigned int base_address, zend_op_array *opa TSRMLS_DC)
 {
 	int len = 0;
 
@@ -366,12 +439,16 @@
 			break;
 		case IS_CONST: /* 1 */
 #if PHP_VERSION_ID >= 70000
-			VLD_PRINT1(3, " IS_CONST (%d) ", VLD_ZNODE_ELEM(node, var) / sizeof(zval));
+			VLD_PRINT1(3, " IS_CONST (%d) ", VLD_ZNODE_ELEM(node, constant));
 #else
 			VLD_PRINT1(3, " IS_CONST (%d) ", VLD_ZNODE_ELEM(node, var) / sizeof(temp_variable));
 #endif
 #if PHP_VERSION_ID >= 70000
+# if ZEND_USE_ABS_CONST_ADDR
 			vld_dump_zval(*node.zv);
+# else
+            vld_dump_zval(*RT_CONSTANT(opa, node));
+# endif
 #else
 # if PHP_VERSION_ID >= 50399
 			vld_dump_zval(*node.zv);
@@ -380,7 +457,7 @@
 # endif
 #endif
 			break;
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 		case IS_TMP_VAR: /* 2 */
 			VLD_PRINT(3, " IS_TMP_VAR ");
 			len += vld_printf (stderr, "~%d", VAR_NUM(VLD_ZNODE_ELEM(node, var)));
@@ -393,7 +470,7 @@
 		case IS_CV:  /* 16 */
 			VLD_PRINT(3, " IS_CV ");
 #if PHP_VERSION_ID >= 70000
-			len += vld_printf (stderr, "!%d", (VLD_ZNODE_ELEM(node, var)-sizeof(zend_execute_data)) / sizeof(zval));
+			len += vld_printf (stderr, "!%d", VLD_ZNODE_ELEM(node, var));
 #else
 			len += vld_printf (stderr, "!%d", VLD_ZNODE_ELEM(node, var));
 #endif
@@ -401,14 +478,22 @@
 #endif
 		case VLD_IS_OPNUM:
 #if PHP_VERSION_ID >= 70000
-			len += vld_printf (stderr, "->%d", ((long) VLD_ZNODE_ELEM(node, jmp_addr) - base_address) / sizeof(zend_op));
+# if ZEND_USE_ABS_JMP_ADDR
+			len += vld_printf (stderr, "->%d", (int) ((long) VLD_ZNODE_ELEM(node, jmp_addr) - base_address) / sizeof(zend_op));
+# else
+            len += vld_printf(stderr, "->%d", (int) ((long) OP_JMP_ADDR(opa->opcodes, node) - base_address) / sizeof(zend_op));
+# endif
 #else
 			len += vld_printf (stderr, "->%d", VLD_ZNODE_ELEM(node, opline_num));
 #endif
 			break;
 		case VLD_IS_OPLINE:
 #if PHP_VERSION_ID >= 70000
-			len += vld_printf (stderr, "->%d", ((long) VLD_ZNODE_ELEM(node, jmp_addr) - base_address) / sizeof(zend_op));
+# if ZEND_USE_ABS_JMP_ADDR
+			len += vld_printf (stderr, "->%d", (int) ((long) VLD_ZNODE_ELEM(node, jmp_addr) - base_address) / sizeof(zend_op));
+# else
+            len += vld_printf(stderr, "->%d", (int) ((long) OP_JMP_ADDR(opa->opcodes, node) - base_address) / sizeof(zend_op));
+# endif
 #else
 			len += vld_printf (stderr, "->%d", (VLD_ZNODE_ELEM(node, opline_num) - base_address) / sizeof(zend_op));
 #endif
@@ -442,7 +527,12 @@
 	unsigned int flags = 0;
 
 	switch (op->opcode) {
+#ifdef ZEND_ENGINE_3
+        case ZEND_FE_RESET_R:
+        case ZEND_FE_RESET_RW:
+#else
 		case ZEND_FE_RESET:
+#endif
 			flags = ALL_USED;
 #if (PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 1)
 			flags |= OP2_OPNUM;
@@ -489,7 +579,7 @@
 			break;
 #endif
 
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 		case ZEND_FETCH_CLASS:
 			flags = EXT_VAL|RES_USED|OP2_USED|RES_CLASS;
 			break;
@@ -570,7 +660,7 @@
 	}
 
 	if (flags & OP_FETCH) {
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 		switch (op.VLD_EXTENDED_VALUE(op2)) {
 			case ZEND_FETCH_GLOBAL:
 				fetch_type = "global";
@@ -636,7 +726,7 @@
 
 	if ((flags & RES_USED) && !(op.VLD_EXTENDED_VALUE(result) & EXT_TYPE_UNUSED)) {
 		VLD_PRINT(3, " RES[ ");
-		len = vld_dump_znode (NULL, res_type, op.result, base_address TSRMLS_CC);
+		len = vld_dump_znode (NULL, res_type, op.result, base_address, opa TSRMLS_CC);
 		VLD_PRINT(3, " ]");
 		if (VLD_G(format)) {
 			if (len==0) {
@@ -651,7 +741,7 @@
 
 	if (flags & OP1_USED) {
 		VLD_PRINT(3, " OP1[ ");
-		vld_dump_znode (&print_sep, op1_type, op.op1, base_address TSRMLS_CC);
+		vld_dump_znode (&print_sep, op1_type, op.op1, base_address, opa TSRMLS_CC);
 		VLD_PRINT(3, " ]");
 	}		
 	if (flags & OP2_USED) {
@@ -685,7 +775,7 @@
 					break;
 			}
 		} else {
-			vld_dump_znode (&print_sep, op2_type, op.op2, base_address TSRMLS_CC);
+			vld_dump_znode (&print_sep, op2_type, op.op2, base_address, opa TSRMLS_CC);
 		}
 		VLD_PRINT(3, " ]");
 	}
@@ -695,7 +785,11 @@
 
 		VLD_PRINT(3, " BRK_CONT[ ");
 #if PHP_VERSION_ID >= 50399
+# if ZEND_USE_ABS_CONST_ADDR
 		el = vld_find_brk_cont(Z_LVAL_P(op.op2.zv), VLD_ZNODE_ELEM(op.op1, opline_num), opa);
+# else
+        el = vld_find_brk_cont(Z_LVAL_P(RT_CONSTANT(opa, op.op2)), VLD_ZNODE_ELEM(op.op1, opline_num), opa);
+# endif
 #else
 		el = vld_find_brk_cont(op.op2.u.constant.value.lval, VLD_ZNODE_ELEM(op.op1, opline_num), opa);
 #endif
@@ -705,7 +799,7 @@
 	}
 	if (flags & NOP2_OPNUM) {
 		zend_op next_op = op_ptr[nr+1];
-		vld_dump_znode (&print_sep, VLD_IS_OPNUM, next_op.op2, base_address TSRMLS_CC);
+		vld_dump_znode (&print_sep, VLD_IS_OPNUM, next_op.op2, base_address, opa TSRMLS_CC);
 	}
 	vld_printf (stderr, "\n");
 }
@@ -787,8 +881,12 @@
 
 	zend_op opcode = opa->opcodes[position];
 	if (opcode.opcode == ZEND_JMP) {
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
+# if ZEND_USE_ABS_JMP_ADDR
 		*jmp1 = ((long) VLD_ZNODE_ELEM(opcode.op1, jmp_addr) - (long) base_address) / sizeof(zend_op);
+# else
+		*jmp1 = ((long) OP_JMP_ADDR(opa->opcodes, opcode.op1) - (long) base_address) / sizeof(zend_op);
+# endif
 #else
 		*jmp1 = opcode.op1.u.opline_num;
 #endif
@@ -800,15 +898,23 @@
 		opcode.opcode == ZEND_JMPNZ_EX
 	) {
 		*jmp1 = position + 1;
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
+# if ZEND_USE_ABS_JMP_ADDR
 		*jmp2 = ((long) VLD_ZNODE_ELEM(opcode.op2, jmp_addr) - (long) base_address) / sizeof(zend_op);
+# else
+        *jmp2 = ((long) OP_JMP_ADDR(opa->opcodes, opcode.op2) - (long) base_address) / sizeof(zend_op);
+# endif
 #else
 		*jmp2 = opcode.op1.u.opline_num;
 #endif
 		return 1;
 	} else if (opcode.opcode == ZEND_JMPZNZ) {
 #if PHP_VERSION_ID >= 70000
+# if ZEND_USE_ABS_JMP_ADDR
 		*jmp1 = VLD_ZNODE_ELEM(opcode.op2, jmp_addr) - base_address;
+# else
+        *jmp1 = OP_JMP_ADDR(opa->opcodes, opcode.op2) - base_address;
+# endif
 #else
 		*jmp1 = VLD_ZNODE_ELEM(opcode.op2, opline_num);
 #endif
@@ -819,21 +925,37 @@
 
 		if (VLD_TYPE(opcode.op2) == IS_CONST
 #if PHP_MAJOR_VERSION >= 5
+# if ZEND_USE_ABS_JMP_ADDR
 		    && VLD_ZNODE_ELEM(opcode.op1, jmp_addr) != (zend_op*) 0xFFFFFFFF
+# else
+            && OP_JMP_ADDR(opa->opcodes, opcode.op2) != (zend_op*) 0xFFFFFFFF
+# endif
 #endif
 		) {
 #if PHP_VERSION_ID >= 50399
-			el = vld_find_brk_cont(Z_LVAL_P(opcode.op2.zv), VLD_ZNODE_ELEM(opcode.op1, opline_num), opa);
+# if ZEND_USE_ABS_CONST_ADDR
+		    el = vld_find_brk_cont(Z_LVAL_P(opcode.op2.zv), VLD_ZNODE_ELEM(opcode.op1, opline_num), opa);
+# else
+            el = vld_find_brk_cont(Z_LVAL_P(RT_CONSTANT(opa, opcode.op2)), VLD_ZNODE_ELEM(opcode.op1, opline_num), opa);
+# endif
 #else
 			el = vld_find_brk_cont(opcode.op2.u.constant.value.lval, VLD_ZNODE_ELEM(opcode.op1, opline_num), opa);
 #endif
 			*jmp1 = opcode.opcode == ZEND_BRK ? el->brk : el->cont;
 			return 1;
 		}
+#ifdef ZEND_ENGINE_3
+	} else if (opcode.opcode == ZEND_FE_RESET_R || opcode.opcode == ZEND_FE_RESET_RW || opcode.opcode == ZEND_FE_FETCH_R || opcode.opcode == ZEND_FE_FETCH_RW) {
+#else
 	} else if (opcode.opcode == ZEND_FE_RESET || opcode.opcode == ZEND_FE_FETCH) {
+#endif
 		*jmp1 = position + 1;
 #if PHP_VERSION_ID >= 70000
+# if ZEND_USE_ABS_JMP_ADDR
 		*jmp2 = VLD_ZNODE_ELEM(opcode.op2, jmp_addr) - base_address;
+# else
+        *jmp2 = OP_JMP_ADDR(opa->opcodes, opcode.op2) - base_address;
+# endif
 #else
 		*jmp2 = VLD_ZNODE_ELEM(opcode.op2, opline_num);
 #endif
@@ -855,7 +977,11 @@
 		return 1;
 #if (PHP_MAJOR_VERSION > 5) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION >= 3)
 	} else if (opcode.opcode == ZEND_GOTO) {
+# if ZEND_USE_ABS_JMP_ADDR
 		*jmp1 = ((long) VLD_ZNODE_ELEM(opcode.op1, jmp_addr) - (long) base_address) / sizeof(zend_op);
+# else
+        *jmp1 = ((long) OP_JMP_ADDR(opa->opcodes, opcode.op1) - (long) base_address) / sizeof(zend_op);
+# endif
 		return 1;
 #endif
 	} else if (opcode.opcode == ZEND_EXIT || opcode.opcode == ZEND_THROW || opcode.opcode == ZEND_RETURN) {
@@ -939,7 +1065,7 @@
 			}
 			break;
 		}
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 		/* See if we have a throw instruction */
 		if (opa->opcodes[position].opcode == ZEND_THROW) {
 			VLD_PRINT1(1, "Throw found at %d\n", position);
diff -ruN vld-0.13.0/vld.c vld-0.13.0_compatible_php7/vld.c
--- vld-0.13.0/vld.c	2014-11-14 19:29:32.000000000 +0800
+++ vld-0.13.0_compatible_php7/vld.c	2015-09-26 16:45:24.000000000 +0800
@@ -236,8 +236,17 @@
 	return len;
 }
 
+#if (defined(ZEND_ENGINE_3))
+static int vld_check_fe (zval *zval_fe, zend_bool *have_fe TSRMLS_DC)
+{
+    zend_op_array *fe;
+
+    fe = &(zval_fe->value.func->op_array);
+
+#else
 static int vld_check_fe (zend_op_array *fe, zend_bool *have_fe TSRMLS_DC)
 {
+#endif
 	if (fe->type == ZEND_USER_FUNCTION) {
 		*have_fe = 1;
 	}
@@ -245,8 +254,16 @@
 	return 0;
 }
 
+#if (defined(ZEND_ENGINE_3))
+static int vld_dump_fe (zval *zval_fe APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
+{
+    zend_op_array *fe;
+
+    fe = &(zval_fe->value.func->op_array);
+#else
 static int vld_dump_fe (zend_op_array *fe APPLY_TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key)
 {
+#endif
 #if PHP_VERSION_ID < 50300
 	TSRMLS_FETCH()
 #endif
@@ -254,7 +271,11 @@
 		ZVAL_VALUE_STRING_TYPE *new_str;
 		int new_len;
 
+#if (defined(ZEND_ENGINE_3))
+		new_str = php_url_encode(ZHASHKEYSTR(hash_key), ZHASHKEYLEN(hash_key));
+#else
 		new_str = php_url_encode(ZHASHKEYSTR(hash_key), ZHASHKEYLEN(hash_key) - 1 PHP_URLENCODE_NEW_LEN(new_len));
+#endif
 		vld_printf(stderr, "Function %s:\n", ZSTRING_VALUE(new_str));
 		vld_dump_oparray(fe TSRMLS_CC);
 		vld_printf(stderr, "End of function %s\n\n", ZSTRING_VALUE(new_str));
@@ -264,7 +285,7 @@
 	return ZEND_HASH_APPLY_KEEP;
 }
 
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 static int vld_dump_cle (zend_class_entry **class_entry TSRMLS_DC)
 #else
 static int vld_dump_cle (zend_class_entry *class_entry TSRMLS_DC)
@@ -273,7 +294,7 @@
 	zend_class_entry *ce;
 	zend_bool have_fe = 0;
 
-#ifdef ZEND_ENGINE_2
+#if (defined(ZEND_ENGINE_2) || defined(ZEND_ENGINE_3))
 	ce = *class_entry;
 #else
 	ce = class_entry;
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 09:01:29 2024 UTC