summaryrefslogtreecommitdiffstats
path: root/pthreads-upstream.patch
blob: 74826fb7794f7e4cef1dfb9143a0ab014a23b942 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
From 703e8968a30b11fa87161f69058b13bdfc3eebbb Mon Sep 17 00:00:00 2001
From: Joe Watkins <krakjoe@php.net>
Date: Wed, 2 Dec 2015 08:21:32 +0000
Subject: [PATCH] fix #523

---
 php_pthreads.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/php_pthreads.c b/php_pthreads.c
index 0f11eeb..e39fe4c 100644
--- a/php_pthreads.c
+++ b/php_pthreads.c
@@ -192,15 +192,22 @@ static inline zend_bool pthreads_verify_type(zend_execute_data *execute_data, zv
 static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) {
 	if (Z_TYPE(PTHREADS_ZG(this)) != IS_UNDEF) {
 		zend_execute_data *execute_data = EG(current_execute_data);
-		uint32_t arg_num = EX(opline)->op1.num;
+		uint32_t arg_num = EX(opline)->op1.num;	
+		zval *var = NULL;
 
 		if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
 			return ZEND_USER_OPCODE_DISPATCH;	
 		}
 
+#if ZEND_USE_ABS_CONST_ADDR
+		var = EX(opline)->result.var;
+#else
+		var = EX_VAR(EX(opline)->result.num);
+#endif
+
 		if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
 			if (pthreads_verify_type(execute_data, 
-				EX_VAR(EX(opline)->result.var), 
+				var, 
 				&EX(func)->common.arg_info[arg_num-1])) {
 				EX(opline)++;
 				return ZEND_USER_OPCODE_CONTINUE;
@@ -214,13 +221,20 @@ static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) {
 static inline int php_pthreads_verify_return_type(ZEND_OPCODE_HANDLER_ARGS) {
 	if (Z_TYPE(PTHREADS_ZG(this)) != IS_UNDEF) {
 		zend_execute_data *execute_data = EG(current_execute_data);
-
+		zval *var = NULL;
+		
 		if (EX(opline)->op1_type == IS_UNUSED) {
 			return ZEND_USER_OPCODE_DISPATCH;
 		}
 
+#if ZEND_USE_ABS_CONST_ADDR
+		var = EX(opline)->op1.var;
+#else
+		var = EX_VAR(EX(opline)->op1.num);
+#endif
+
 		if (pthreads_verify_type(execute_data, 
-			EX_VAR(EX(opline)->op1.num), 
+			var,
 			EX(func)->common.arg_info - 1)) {
 			EX(opline)++;
 			return ZEND_USER_OPCODE_CONTINUE;
From 7a86467968143eb3bf04eec1b9f1987f586cd0c3 Mon Sep 17 00:00:00 2001
From: Joe Watkins <krakjoe@php.net>
Date: Wed, 2 Dec 2015 08:27:12 +0000
Subject: [PATCH] fix for #523 was obviously wrong ... mornings ...

---
 php_pthreads.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/php_pthreads.c b/php_pthreads.c
index e39fe4c..4c984ae 100644
--- a/php_pthreads.c
+++ b/php_pthreads.c
@@ -200,7 +200,9 @@ static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) {
 		}
 
 #if ZEND_USE_ABS_CONST_ADDR
-		var = EX(opline)->result.var;
+		if (EX(opline)->result_type == IS_CONST) {
+				var = EX(opline)->result.var;	
+		} else var = EX_VAR(EX(opline)->result.num);
 #else
 		var = EX_VAR(EX(opline)->result.num);
 #endif
@@ -228,7 +230,9 @@ static inline int php_pthreads_verify_return_type(ZEND_OPCODE_HANDLER_ARGS) {
 		}
 
 #if ZEND_USE_ABS_CONST_ADDR
-		var = EX(opline)->op1.var;
+		if (EX(opline)->op1_type == IS_CONST) {
+			var = EX(opline)->op1.var;
+		} else EX_VAR(EX(opline)->op1.num);
 #else
 		var = EX_VAR(EX(opline)->op1.num);
 #endif
From c4fe122188c6ecb4b71060fb191d4b1258691af0 Mon Sep 17 00:00:00 2001
From: Joe Watkins <krakjoe@php.net>
Date: Wed, 2 Dec 2015 09:03:40 +0000
Subject: [PATCH] I miss the good old days, when things were simple ... #523

---
 php_pthreads.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/php_pthreads.c b/php_pthreads.c
index 4c984ae..e24d5e8 100644
--- a/php_pthreads.c
+++ b/php_pthreads.c
@@ -201,7 +201,7 @@ static inline int php_pthreads_recv(ZEND_OPCODE_HANDLER_ARGS) {
 
 #if ZEND_USE_ABS_CONST_ADDR
 		if (EX(opline)->result_type == IS_CONST) {
-				var = EX(opline)->result.var;	
+				var = (zval*) EX(opline)->result.var;	
 		} else var = EX_VAR(EX(opline)->result.num);
 #else
 		var = EX_VAR(EX(opline)->result.num);
@@ -225,14 +225,14 @@ static inline int php_pthreads_verify_return_type(ZEND_OPCODE_HANDLER_ARGS) {
 		zend_execute_data *execute_data = EG(current_execute_data);
 		zval *var = NULL;
 		
-		if (EX(opline)->op1_type == IS_UNUSED) {
+		if (EX(opline)->op1_type == IS_UNUSED) {	
 			return ZEND_USER_OPCODE_DISPATCH;
 		}
 
 #if ZEND_USE_ABS_CONST_ADDR
-		if (EX(opline)->op1_type == IS_CONST) {
-			var = EX(opline)->op1.var;
-		} else EX_VAR(EX(opline)->op1.num);
+		if (EX(opline)->op1_type & IS_CONST) {
+			var = (zval*) EX(opline)->op1.var;
+		} else var = EX_VAR(EX(opline)->op1.num);
 #else
 		var = EX_VAR(EX(opline)->op1.num);
 #endif