1 : /*
2 : +----------------------------------------------------------------------+
3 : | Zend Engine |
4 : +----------------------------------------------------------------------+
5 : | Copyright (c) 1998-2009 Zend Technologies Ltd. (http://www.zend.com) |
6 : +----------------------------------------------------------------------+
7 : | This source file is subject to version 2.00 of the Zend license, |
8 : | that is bundled with this package in the file LICENSE, and is |
9 : | available through the world-wide-web at the following url: |
10 : | http://www.zend.com/license/2_00.txt. |
11 : | If you did not receive a copy of the Zend license and are unable to |
12 : | obtain it through the world-wide-web, please send a note to |
13 : | license@zend.com so we can mail you a copy immediately. |
14 : +----------------------------------------------------------------------+
15 : | Authors: Andi Gutmans <andi@zend.com> |
16 : | Zeev Suraski <zeev@zend.com> |
17 : | Dmitry Stogov <dmitry@zend.com> |
18 : +----------------------------------------------------------------------+
19 : */
20 :
21 : static opcode_handler_t zend_user_opcode_handlers[256] = {(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL,(opcode_handler_t)NULL};
22 :
23 : static zend_uchar zend_user_opcodes[256] = {0,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,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255};
24 :
25 : static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, zend_op* op);
26 :
27 :
28 : #define ZEND_VM_CONTINUE() return 0
29 : #define ZEND_VM_RETURN() return 1
30 : #define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
31 :
32 : #define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC
33 :
34 : ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
35 1579171 : {
36 : zend_execute_data execute_data;
37 :
38 :
39 1579171 : if (EG(exception)) {
40 1 : return;
41 : }
42 :
43 : /* Initialize execute_data */
44 1579170 : EX(fbc) = NULL;
45 1579170 : EX(object) = NULL;
46 1579170 : EX(old_error_reporting) = NULL;
47 1579170 : if (op_array->T < TEMP_VAR_STACK_LIMIT) {
48 1579170 : EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
49 : } else {
50 0 : EX(Ts) = (temp_variable *) safe_emalloc(sizeof(temp_variable), op_array->T, 0);
51 : }
52 1579170 : EX(CVs) = (zval***)do_alloca(sizeof(zval**) * op_array->last_var);
53 1579170 : memset(EX(CVs), 0, sizeof(zval**) * op_array->last_var);
54 1579170 : EX(op_array) = op_array;
55 1579170 : EX(original_in_execution) = EG(in_execution);
56 1579170 : EX(symbol_table) = EG(active_symbol_table);
57 1579170 : EX(prev_execute_data) = EG(current_execute_data);
58 1579170 : EG(current_execute_data) = &execute_data;
59 :
60 1579170 : EG(in_execution) = 1;
61 1579170 : if (op_array->start_op) {
62 10 : ZEND_VM_SET_OPCODE(op_array->start_op);
63 : } else {
64 1579160 : ZEND_VM_SET_OPCODE(op_array->opcodes);
65 : }
66 :
67 1579170 : if (op_array->uses_this && EG(This)) {
68 401 : EG(This)->refcount++; /* For $this pointer */
69 401 : if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), NULL)==FAILURE) {
70 0 : EG(This)->refcount--;
71 : }
72 : }
73 :
74 1579170 : EG(opline_ptr) = &EX(opline);
75 :
76 1579170 : EX(function_state).function = (zend_function *) op_array;
77 1579170 : EG(function_state_ptr) = &EX(function_state);
78 : #if ZEND_DEBUG
79 : /* function_state.function_symbol_table is saved as-is to a stack,
80 : * which is an intentional UMR. Shut it up if we're in DEBUG.
81 : */
82 : EX(function_state).function_symbol_table = NULL;
83 : #endif
84 :
85 : while (1) {
86 : #ifdef ZEND_WIN32
87 : if (EG(timed_out)) {
88 : zend_timeout(0);
89 : }
90 : #endif
91 :
92 127303007 : if (EX(opline)->handler(&execute_data TSRMLS_CC) > 0) {
93 1578374 : return;
94 : }
95 :
96 125723837 : }
97 : zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen");
98 : }
99 :
100 : #undef EX
101 : #define EX(element) execute_data->element
102 :
103 : static int ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
104 10266809 : {
105 : #if DEBUG_ZEND>=2
106 : printf("Jumping to %d\n", EX(opline)->op1.u.opline_num);
107 : #endif
108 10266809 : ZEND_VM_SET_OPCODE(EX(opline)->op1.u.jmp_addr);
109 10266809 : ZEND_VM_CONTINUE(); /* CHECK_ME */
110 : }
111 :
112 : static int ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
113 866888 : {
114 866888 : zval *tmp = &EX_T(EX(opline)->result.u.var).tmp_var;
115 :
116 866888 : tmp->value.str.val = emalloc(1);
117 866888 : tmp->value.str.val[0] = 0;
118 866888 : tmp->value.str.len = 0;
119 866888 : tmp->refcount = 1;
120 866888 : tmp->type = IS_STRING;
121 866888 : tmp->is_ref = 0;
122 866888 : ZEND_VM_NEXT_OPCODE();
123 : }
124 :
125 : static int zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
126 13129259 : {
127 13129259 : zend_op *opline = EX(opline);
128 : zval **original_return_value;
129 13129259 : zend_class_entry *current_scope = NULL;
130 13129259 : zval *current_this = NULL;
131 13129259 : int return_value_used = RETURN_VALUE_USED(opline);
132 : zend_bool should_change_scope;
133 : zend_op *ctor_opline;
134 :
135 13129259 : if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
136 3 : if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
137 1 : zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
138 : ZEND_VM_NEXT_OPCODE(); /* Never reached */
139 : }
140 2 : if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
141 2 : zend_error(E_STRICT, "Function %s%s%s() is deprecated",
142 : EX(function_state).function->common.scope ? EX(function_state).function->common.scope->name : "",
143 : EX(function_state).function->common.scope ? "::" : "",
144 : EX(function_state).function->common.function_name);
145 : }
146 : }
147 :
148 13129258 : zend_ptr_stack_2_push(&EG(argument_stack), (void *)(zend_uintptr_t)opline->extended_value, NULL);
149 :
150 13129258 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
151 :
152 14628602 : if (EX(function_state).function->type == ZEND_USER_FUNCTION
153 : || EX(function_state).function->common.scope) {
154 1499344 : should_change_scope = 1;
155 1499344 : current_this = EG(This);
156 1499344 : EG(This) = EX(object);
157 1499344 : current_scope = EG(scope);
158 1499344 : EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL;
159 : } else {
160 11629914 : should_change_scope = 0;
161 : }
162 :
163 13129258 : EX_T(opline->result.u.var).var.fcall_returned_reference = 0;
164 :
165 13129258 : if (EX(function_state).function->common.scope) {
166 208146 : if (!EG(This) && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) {
167 : int severity;
168 : char *severity_word;
169 21 : if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
170 14 : severity = E_STRICT;
171 14 : severity_word = "should not";
172 : } else {
173 7 : severity = E_ERROR;
174 7 : severity_word = "cannot";
175 : }
176 21 : zend_error(severity, "Non-static method %s::%s() %s be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name, severity_word);
177 : }
178 : }
179 13129251 : if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
180 11834282 : unsigned char return_reference = EX(function_state).function->common.return_reference;
181 :
182 11834282 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
183 11834282 : INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
184 :
185 11834282 : if (EX(function_state).function->common.arg_info) {
186 9764497 : zend_uint i=0;
187 : zval **p;
188 : ulong arg_count;
189 :
190 9764497 : p = (zval **) EG(argument_stack).top_element-2;
191 9764497 : arg_count = (ulong)(zend_uintptr_t) *p;
192 :
193 36697742 : while (arg_count>0) {
194 17168752 : zend_verify_arg_type(EX(function_state).function, ++i, *(p-arg_count) TSRMLS_CC);
195 17168748 : arg_count--;
196 : }
197 : }
198 11834278 : if (!zend_execute_internal) {
199 : /* saves one function call if zend_execute_internal is not used */
200 11834278 : ((zend_internal_function *) EX(function_state).function)->handler(opline->extended_value, EX_T(opline->result.u.var).var.ptr, EX(function_state).function->common.return_reference?&EX_T(opline->result.u.var).var.ptr:NULL, EX(object), return_value_used TSRMLS_CC);
201 : } else {
202 0 : zend_execute_internal(execute_data, return_value_used TSRMLS_CC);
203 : }
204 :
205 11834228 : EG(current_execute_data) = execute_data;
206 :
207 : /* We shouldn't fix bad extensions here,
208 : because it can break proper ones (Bug #34045)
209 : if (!EX(function_state).function->common.return_reference) {
210 : EX_T(opline->result.u.var).var.ptr->is_ref = 0;
211 : EX_T(opline->result.u.var).var.ptr->refcount = 1;
212 : }
213 : */
214 11834228 : if (!return_value_used) {
215 1069625 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
216 : } else {
217 10764603 : EX_T(opline->result.u.var).var.fcall_returned_reference = return_reference;
218 : }
219 1294969 : } else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
220 1294969 : EX_T(opline->result.u.var).var.ptr = NULL;
221 1294969 : if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
222 : /*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
223 1291065 : EX(function_state).function_symbol_table = *(EG(symtable_cache_ptr)--);
224 : } else {
225 3904 : ALLOC_HASHTABLE(EX(function_state).function_symbol_table);
226 3904 : zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
227 : /*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/
228 : }
229 1294969 : EG(active_symbol_table) = EX(function_state).function_symbol_table;
230 1294969 : original_return_value = EG(return_value_ptr_ptr);
231 1294969 : EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr;
232 1294969 : EG(active_op_array) = (zend_op_array *) EX(function_state).function;
233 :
234 1294969 : zend_execute(EG(active_op_array) TSRMLS_CC);
235 1294929 : EX_T(opline->result.u.var).var.fcall_returned_reference = EG(active_op_array)->return_reference;
236 :
237 1294948 : if (return_value_used && !EX_T(opline->result.u.var).var.ptr) {
238 19 : if (!EG(exception)) {
239 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
240 0 : INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr);
241 : }
242 1294910 : } else if (!return_value_used && EX_T(opline->result.u.var).var.ptr) {
243 95295 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
244 : }
245 :
246 1294929 : EG(opline_ptr) = &EX(opline);
247 1294929 : EG(active_op_array) = EX(op_array);
248 1294929 : EG(return_value_ptr_ptr)=original_return_value;
249 1294929 : if (EG(symtable_cache_ptr)>=EG(symtable_cache_limit)) {
250 968 : zend_hash_destroy(EX(function_state).function_symbol_table);
251 968 : FREE_HASHTABLE(EX(function_state).function_symbol_table);
252 : } else {
253 : /* clean before putting into the cache, since clean
254 : could call dtors, which could use cached hash */
255 1293961 : zend_hash_clean(EX(function_state).function_symbol_table);
256 1293961 : *(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table;
257 : }
258 1294929 : EG(active_symbol_table) = EX(symbol_table);
259 : } else { /* ZEND_OVERLOADED_FUNCTION */
260 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
261 0 : INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
262 :
263 : /* Not sure what should be done here if it's a static method */
264 0 : if (EX(object)) {
265 0 : Z_OBJ_HT_P(EX(object))->call_method(EX(fbc)->common.function_name, opline->extended_value, EX_T(opline->result.u.var).var.ptr, &EX_T(opline->result.u.var).var.ptr, EX(object), return_value_used TSRMLS_CC);
266 : } else {
267 0 : zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
268 : }
269 :
270 0 : if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
271 0 : efree(EX(function_state).function->common.function_name);
272 : }
273 0 : efree(EX(fbc));
274 :
275 0 : if (!return_value_used) {
276 0 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
277 : } else {
278 0 : EX_T(opline->result.u.var).var.ptr->is_ref = 0;
279 0 : EX_T(opline->result.u.var).var.ptr->refcount = 1;
280 : }
281 : }
282 :
283 13129157 : EX(function_state).function = (zend_function *) EX(op_array);
284 13129157 : EG(function_state_ptr) = &EX(function_state);
285 13129157 : ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
286 :
287 13129157 : if (EG(This)) {
288 223641 : if (EG(exception) && ctor_opline) {
289 183 : if (RETURN_VALUE_USED(ctor_opline)) {
290 163 : EG(This)->refcount--;
291 : }
292 183 : if (EG(This)->refcount == 1) {
293 182 : zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
294 : }
295 : }
296 223641 : if (should_change_scope) {
297 206720 : zval_ptr_dtor(&EG(This));
298 : }
299 : }
300 :
301 13129157 : if (should_change_scope) {
302 1499239 : EG(This) = current_this;
303 1499239 : EG(scope) = current_scope;
304 : }
305 13129157 : zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc));
306 :
307 13129157 : zend_ptr_stack_clear_multiple(TSRMLS_C);
308 :
309 13129157 : if (EG(exception)) {
310 593 : zend_throw_exception_internal(NULL TSRMLS_CC);
311 593 : if (return_value_used && EX_T(opline->result.u.var).var.ptr) {
312 202 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
313 : }
314 : }
315 :
316 13129157 : ZEND_VM_NEXT_OPCODE();
317 : }
318 :
319 : static int ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
320 355070 : {
321 355070 : EX(function_state).function = EX(fbc);
322 355070 : return zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
323 : }
324 :
325 : static int ZEND_CATCH_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
326 558 : {
327 558 : zend_op *opline = EX(opline);
328 : zend_class_entry *ce;
329 :
330 : /* Check whether an exception has been thrown, if not, jump over code */
331 558 : if (EG(exception) == NULL) {
332 0 : ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]);
333 0 : ZEND_VM_CONTINUE(); /* CHECK_ME */
334 : }
335 558 : ce = Z_OBJCE_P(EG(exception));
336 558 : if (ce != EX_T(opline->op1.u.var).class_entry) {
337 236 : if (!instanceof_function(ce, EX_T(opline->op1.u.var).class_entry TSRMLS_CC)) {
338 2 : if (opline->op1.u.EA.type) {
339 0 : zend_throw_exception_internal(NULL TSRMLS_CC);
340 0 : ZEND_VM_NEXT_OPCODE();
341 : }
342 2 : ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]);
343 2 : ZEND_VM_CONTINUE(); /* CHECK_ME */
344 : }
345 : }
346 :
347 556 : zend_hash_update(EG(active_symbol_table), opline->op2.u.constant.value.str.val,
348 : opline->op2.u.constant.value.str.len+1, &EG(exception), sizeof(zval *), (void **) NULL);
349 555 : EG(exception) = NULL;
350 555 : ZEND_VM_NEXT_OPCODE();
351 : }
352 :
353 : static int ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
354 3946227 : {
355 3946227 : zend_op *opline = EX(opline);
356 : zval **param;
357 3946227 : zend_uint arg_num = Z_LVAL(opline->op1.u.constant);
358 :
359 3946227 : if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) {
360 : char *space;
361 57 : char *class_name = get_active_class_name(&space TSRMLS_CC);
362 57 : zend_execute_data *ptr = EX(prev_execute_data);
363 :
364 57 : zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, NULL TSRMLS_CC);
365 62 : if(ptr && ptr->op_array) {
366 8 : zend_error(E_WARNING, "Missing argument %ld for %s%s%s(), called in %s on line %d and defined", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C), ptr->op_array->filename, ptr->opline->lineno);
367 : } else {
368 46 : zend_error(E_WARNING, "Missing argument %ld for %s%s%s()", opline->op1.u.constant.value.lval, class_name, space, get_active_function_name(TSRMLS_C));
369 : }
370 54 : if (opline->result.op_type == IS_VAR) {
371 0 : PZVAL_UNLOCK_FREE(*EX_T(opline->result.u.var).var.ptr_ptr);
372 : }
373 : } else {
374 : zend_free_op free_res;
375 : zval **var_ptr;
376 :
377 3946170 : zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, *param TSRMLS_CC);
378 3946161 : var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
379 3946161 : if (PZVAL_IS_REF(*param)) {
380 20373 : zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC);
381 : } else {
382 3925788 : zend_receive(var_ptr, *param TSRMLS_CC);
383 : }
384 : }
385 :
386 3946215 : ZEND_VM_NEXT_OPCODE();
387 : }
388 :
389 : static int ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
390 109970 : {
391 109970 : zend_op *opline = EX(opline);
392 : zval *object_zval;
393 : zend_function *constructor;
394 :
395 109970 : if (EX_T(opline->op1.u.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
396 : char *class_type;
397 :
398 4 : if (EX_T(opline->op1.u.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) {
399 1 : class_type = "interface";
400 : } else {
401 3 : class_type = "abstract class";
402 : }
403 4 : zend_error_noreturn(E_ERROR, "Cannot instantiate %s %s", class_type, EX_T(opline->op1.u.var).class_entry->name);
404 : }
405 109966 : ALLOC_ZVAL(object_zval);
406 109966 : object_init_ex(object_zval, EX_T(opline->op1.u.var).class_entry);
407 109965 : INIT_PZVAL(object_zval);
408 :
409 109965 : constructor = Z_OBJ_HT_P(object_zval)->get_constructor(object_zval TSRMLS_CC);
410 :
411 109960 : if (constructor == NULL) {
412 105206 : if (RETURN_VALUE_USED(opline)) {
413 105201 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
414 105201 : EX_T(opline->result.u.var).var.ptr = object_zval;
415 : } else {
416 5 : zval_ptr_dtor(&object_zval);
417 : }
418 105206 : ZEND_VM_JMP(EX(op_array)->opcodes + opline->op2.u.opline_num);
419 : } else {
420 4754 : SELECTIVE_PZVAL_LOCK(object_zval, &opline->result);
421 4754 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
422 4754 : EX_T(opline->result.u.var).var.ptr = object_zval;
423 :
424 4754 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline);
425 :
426 : /* We are not handling overloaded classes right now */
427 4754 : EX(object) = object_zval;
428 4754 : EX(fbc) = constructor;
429 :
430 4754 : ZEND_VM_NEXT_OPCODE();
431 : }
432 : }
433 :
434 : static int ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
435 921423 : {
436 921423 : zend_op *opline = EX(opline);
437 :
438 921423 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = EG(error_reporting);
439 921423 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG; /* shouldn't be necessary */
440 921423 : if (EX(old_error_reporting) == NULL) {
441 921410 : EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var;
442 : }
443 :
444 921423 : if (EG(error_reporting)) {
445 842488 : zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1);
446 : }
447 921423 : ZEND_VM_NEXT_OPCODE();
448 : }
449 :
450 : static int ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
451 0 : {
452 0 : zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EG(scope)->name, EX(op_array)->function_name);
453 : ZEND_VM_NEXT_OPCODE(); /* Never reached */
454 : }
455 :
456 : static int ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
457 0 : {
458 0 : if (!EG(no_extensions)) {
459 0 : zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(op_array) TSRMLS_CC);
460 : }
461 0 : ZEND_VM_NEXT_OPCODE();
462 : }
463 :
464 : static int ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
465 0 : {
466 0 : if (!EG(no_extensions)) {
467 0 : zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(op_array) TSRMLS_CC);
468 : }
469 0 : ZEND_VM_NEXT_OPCODE();
470 : }
471 :
472 : static int ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
473 0 : {
474 0 : if (!EG(no_extensions)) {
475 0 : zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(op_array) TSRMLS_CC);
476 : }
477 0 : ZEND_VM_NEXT_OPCODE();
478 : }
479 :
480 : static int ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
481 184 : {
482 184 : zend_op *opline = EX(opline);
483 :
484 184 : EX_T(opline->result.u.var).class_entry = do_bind_class(opline, EG(class_table), 0 TSRMLS_CC);
485 183 : ZEND_VM_NEXT_OPCODE();
486 : }
487 :
488 : static int ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
489 67 : {
490 67 : zend_op *opline = EX(opline);
491 :
492 67 : EX_T(opline->result.u.var).class_entry = do_bind_inherited_class(opline, EG(class_table), EX_T(opline->extended_value).class_entry, 0 TSRMLS_CC);
493 65 : ZEND_VM_NEXT_OPCODE();
494 : }
495 :
496 : static int ZEND_DECLARE_FUNCTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
497 122 : {
498 122 : do_bind_function(EX(opline), EG(function_table), 0);
499 122 : ZEND_VM_NEXT_OPCODE();
500 : }
501 :
502 : static int ZEND_EXT_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
503 0 : {
504 0 : ZEND_VM_NEXT_OPCODE();
505 : }
506 :
507 : static int ZEND_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
508 9133 : {
509 9133 : ZEND_VM_NEXT_OPCODE();
510 : }
511 :
512 : static int ZEND_ADD_INTERFACE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
513 247 : {
514 247 : zend_op *opline = EX(opline);
515 247 : zend_class_entry *ce = EX_T(opline->op1.u.var).class_entry;
516 247 : zend_class_entry *iface = EX_T(opline->op2.u.var).class_entry;
517 :
518 247 : if (!(iface->ce_flags & ZEND_ACC_INTERFACE)) {
519 2 : zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name, iface->name);
520 : }
521 :
522 245 : zend_do_implement_interface(ce, iface TSRMLS_CC);
523 :
524 235 : ZEND_VM_NEXT_OPCODE();
525 : }
526 :
527 : static int ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
528 803 : {
529 803 : zend_uint op_num = EG(opline_before_exception)-EG(active_op_array)->opcodes;
530 : int i;
531 : zend_uint catch_op_num;
532 803 : int catched = 0;
533 : zval **stack_zval_pp;
534 : zval restored_error_reporting;
535 :
536 803 : stack_zval_pp = (zval **) EG(argument_stack).top_element - 1;
537 1668 : while (*stack_zval_pp != NULL) {
538 62 : zval_ptr_dtor(stack_zval_pp);
539 62 : EG(argument_stack).top_element--;
540 62 : EG(argument_stack).top--;
541 62 : stack_zval_pp--;
542 : }
543 :
544 2075 : for (i=0; i<EG(active_op_array)->last_try_catch; i++) {
545 1472 : if (EG(active_op_array)->try_catch_array[i].try_op > op_num) {
546 : /* further blocks will not be relevant... */
547 200 : break;
548 : }
549 1272 : if (op_num >= EG(active_op_array)->try_catch_array[i].try_op
550 : && op_num < EG(active_op_array)->try_catch_array[i].catch_op) {
551 556 : catch_op_num = EX(op_array)->try_catch_array[i].catch_op;
552 556 : catched = 1;
553 : }
554 : }
555 :
556 1622 : while (EX(fbc)) {
557 16 : zend_op *ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
558 :
559 16 : if (EX(object)) {
560 9 : if (ctor_opline && RETURN_VALUE_USED(ctor_opline)) {
561 1 : EX(object)->refcount--;
562 : }
563 9 : zval_ptr_dtor(&EX(object));
564 : }
565 16 : zend_arg_types_stack_2_pop(&EG(arg_types_stack), &EX(object), &EX(fbc));
566 : }
567 :
568 1132 : for (i=0; i<EX(op_array)->last_brk_cont; i++) {
569 375 : if (EX(op_array)->brk_cont_array[i].start < 0) {
570 39 : continue;
571 336 : } else if (EX(op_array)->brk_cont_array[i].start > op_num) {
572 : /* further blocks will not be relevant... */
573 46 : break;
574 290 : } else if (op_num < EX(op_array)->brk_cont_array[i].brk) {
575 213 : if (!catched ||
576 : catch_op_num >= EX(op_array)->brk_cont_array[i].brk) {
577 4 : zend_op *brk_opline = &EX(op_array)->opcodes[EX(op_array)->brk_cont_array[i].brk];
578 :
579 4 : switch (brk_opline->opcode) {
580 : case ZEND_SWITCH_FREE:
581 3 : zend_switch_free(brk_opline, EX(Ts) TSRMLS_CC);
582 3 : break;
583 : case ZEND_FREE:
584 0 : zendi_zval_dtor(EX_T(brk_opline->op1.u.var).tmp_var);
585 : break;
586 : }
587 : }
588 : }
589 : }
590 :
591 : /* restore previous error_reporting value */
592 803 : if (!EG(error_reporting) && EX(old_error_reporting) != NULL && Z_LVAL_P(EX(old_error_reporting)) != 0) {
593 8 : Z_TYPE(restored_error_reporting) = IS_LONG;
594 8 : Z_LVAL(restored_error_reporting) = Z_LVAL_P(EX(old_error_reporting));
595 8 : convert_to_string(&restored_error_reporting);
596 8 : zend_alter_ini_entry_ex("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1);
597 8 : zendi_zval_dtor(restored_error_reporting);
598 : }
599 803 : EX(old_error_reporting) = NULL;
600 :
601 803 : if (!catched) {
602 247 : ZEND_VM_RETURN_FROM_EXECUTE_LOOP();
603 : } else {
604 556 : ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[catch_op_num]);
605 556 : ZEND_VM_CONTINUE();
606 : }
607 : }
608 :
609 : static int ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
610 180 : {
611 180 : zend_verify_abstract_class(EX_T(EX(opline)->op1.u.var).class_entry TSRMLS_CC);
612 176 : ZEND_VM_NEXT_OPCODE();
613 : }
614 :
615 : static int ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
616 0 : {
617 0 : int ret = zend_user_opcode_handlers[EX(opline)->opcode](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL);
618 :
619 0 : switch (ret) {
620 : case ZEND_USER_OPCODE_CONTINUE:
621 0 : ZEND_VM_CONTINUE();
622 : case ZEND_USER_OPCODE_RETURN:
623 0 : ZEND_VM_RETURN();
624 : case ZEND_USER_OPCODE_DISPATCH:
625 0 : ZEND_VM_DISPATCH(EX(opline)->opcode, EX(opline));
626 : default:
627 0 : ZEND_VM_DISPATCH(ret & 0xff, EX(opline));
628 : }
629 : }
630 :
631 : static int ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
632 115995 : {
633 115995 : zend_op *opline = EX(opline);
634 : zval *class_name;
635 :
636 :
637 :
638 : if (IS_CONST == IS_UNUSED) {
639 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
640 : ZEND_VM_NEXT_OPCODE();
641 : }
642 :
643 115995 : class_name = &opline->op2.u.constant;
644 :
645 115995 : switch (Z_TYPE_P(class_name)) {
646 : case IS_OBJECT:
647 0 : EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
648 0 : break;
649 : case IS_STRING:
650 115995 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
651 115986 : break;
652 : default:
653 0 : zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
654 : break;
655 : }
656 :
657 115986 : ZEND_VM_NEXT_OPCODE();
658 : }
659 :
660 : static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
661 2340 : {
662 2340 : zend_op *opline = EX(opline);
663 : zval *function_name;
664 : zend_class_entry *ce;
665 :
666 2340 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
667 :
668 2340 : ce = EX_T(opline->op1.u.var).class_entry;
669 : if(IS_CONST != IS_UNUSED) {
670 2340 : char *function_name_strval = NULL;
671 : int function_name_strlen;
672 2340 : zend_bool is_const = (IS_CONST == IS_CONST);
673 :
674 :
675 2340 : if (is_const) {
676 2340 : function_name_strval = Z_STRVAL(opline->op2.u.constant);
677 2340 : function_name_strlen = Z_STRLEN(opline->op2.u.constant);
678 : } else {
679 0 : function_name = &opline->op2.u.constant;
680 :
681 0 : if (Z_TYPE_P(function_name) != IS_STRING) {
682 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
683 : } else {
684 0 : function_name_strval = Z_STRVAL_P(function_name);
685 0 : function_name_strlen = Z_STRLEN_P(function_name);
686 : }
687 : }
688 :
689 2340 : if (function_name_strval) {
690 2340 : EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
691 : }
692 :
693 : if (!is_const) {
694 :
695 : }
696 : } else {
697 : if(!ce->constructor) {
698 : zend_error_noreturn(E_ERROR, "Can not call constructor");
699 : }
700 : if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
701 : zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name);
702 : }
703 : EX(fbc) = ce->constructor;
704 : }
705 :
706 2331 : if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
707 1317 : EX(object) = NULL;
708 : } else {
709 1014 : if (IS_CONST != IS_UNUSED &&
710 : EG(This) &&
711 : Z_OBJ_HT_P(EG(This))->get_class_entry &&
712 : !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
713 : /* We are calling method of the other (incompatible) class,
714 : but passing $this. This is done for compatibility with php-4. */
715 : int severity;
716 : char *verb;
717 1 : if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
718 0 : severity = E_STRICT;
719 0 : verb = "should not";
720 : } else {
721 : /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
722 1 : severity = E_ERROR;
723 1 : verb = "cannot";
724 : }
725 1 : zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb);
726 :
727 : }
728 1013 : if ((EX(object) = EG(This))) {
729 994 : EX(object)->refcount++;
730 : }
731 : }
732 :
733 2330 : ZEND_VM_NEXT_OPCODE();
734 : }
735 :
736 : static int ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
737 133875 : {
738 133875 : zend_op *opline = EX(opline);
739 : zval *function_name;
740 : zend_function *function;
741 : char *function_name_strval, *lcname;
742 : int function_name_strlen;
743 :
744 :
745 133875 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
746 :
747 : if (IS_CONST == IS_CONST) {
748 133875 : function_name_strval = opline->op2.u.constant.value.str.val;
749 133875 : function_name_strlen = opline->op2.u.constant.value.str.len;
750 : } else {
751 : function_name = &opline->op2.u.constant;
752 :
753 : if (Z_TYPE_P(function_name) != IS_STRING) {
754 : zend_error_noreturn(E_ERROR, "Function name must be a string");
755 : }
756 : function_name_strval = function_name->value.str.val;
757 : function_name_strlen = function_name->value.str.len;
758 : }
759 :
760 133875 : lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
761 133875 : if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) {
762 7 : efree(lcname);
763 7 : zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
764 : }
765 :
766 133868 : efree(lcname);
767 : if (IS_CONST != IS_CONST) {
768 :
769 : }
770 :
771 133868 : EX(object) = NULL;
772 :
773 133868 : EX(fbc) = function;
774 :
775 133868 : ZEND_VM_NEXT_OPCODE();
776 : }
777 :
778 :
779 : static int ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
780 104637 : {
781 104637 : zend_op *opline = EX(opline);
782 : zval **param, *assignment_value;
783 104637 : zend_uint arg_num = Z_LVAL(opline->op1.u.constant);
784 : zend_free_op free_res;
785 :
786 104637 : if (zend_ptr_stack_get_arg(arg_num, (void **) ¶m TSRMLS_CC)==FAILURE) {
787 29545 : if (Z_TYPE(opline->op2.u.constant) == IS_CONSTANT || Z_TYPE(opline->op2.u.constant)==IS_CONSTANT_ARRAY) {
788 : zval *default_value;
789 :
790 60 : ALLOC_ZVAL(default_value);
791 60 : *default_value = opline->op2.u.constant;
792 60 : default_value->refcount=1;
793 60 : zval_update_constant(&default_value, 0 TSRMLS_CC);
794 59 : default_value->refcount=0;
795 59 : default_value->is_ref=0;
796 59 : param = &default_value;
797 59 : assignment_value = default_value;
798 : } else {
799 29426 : param = NULL;
800 29426 : assignment_value = &opline->op2.u.constant;
801 : }
802 29485 : zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
803 29485 : zend_assign_to_variable(NULL, &opline->result, NULL, assignment_value, IS_VAR, EX(Ts) TSRMLS_CC);
804 : } else {
805 75151 : zval **var_ptr = get_zval_ptr_ptr(&opline->result, EX(Ts), &free_res, BP_VAR_W);
806 :
807 75151 : assignment_value = *param;
808 75151 : zend_verify_arg_type((zend_function *) EG(active_op_array), arg_num, assignment_value TSRMLS_CC);
809 75151 : if (PZVAL_IS_REF(assignment_value)) {
810 26 : zend_assign_to_variable_reference(var_ptr, param TSRMLS_CC);
811 : } else {
812 75125 : zend_receive(var_ptr, assignment_value TSRMLS_CC);
813 : }
814 : }
815 :
816 104636 : ZEND_VM_NEXT_OPCODE();
817 : }
818 :
819 : static int ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
820 15180 : {
821 15180 : zend_op *opline = EX(opline);
822 :
823 : zend_brk_cont_element *el;
824 :
825 15180 : el = zend_brk_cont(&opline->op2.u.constant, opline->op1.u.opline_num,
826 : EX(op_array), EX(Ts) TSRMLS_CC);
827 :
828 15180 : ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
829 : }
830 :
831 : static int ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
832 30999 : {
833 30999 : zend_op *opline = EX(opline);
834 :
835 : zend_brk_cont_element *el;
836 :
837 30999 : el = zend_brk_cont(&opline->op2.u.constant, opline->op1.u.opline_num,
838 : EX(op_array), EX(Ts) TSRMLS_CC);
839 :
840 30999 : ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
841 : }
842 :
843 : static int ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
844 0 : {
845 0 : zend_op *opline = EX(opline);
846 : zval *class_name;
847 : zend_free_op free_op2;
848 :
849 :
850 : if (IS_TMP_VAR == IS_UNUSED) {
851 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
852 : ZEND_VM_NEXT_OPCODE();
853 : }
854 :
855 0 : class_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
856 :
857 0 : switch (Z_TYPE_P(class_name)) {
858 : case IS_OBJECT:
859 0 : EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
860 0 : break;
861 : case IS_STRING:
862 0 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
863 0 : break;
864 : default:
865 0 : zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
866 : break;
867 : }
868 :
869 0 : zval_dtor(free_op2.var);
870 0 : ZEND_VM_NEXT_OPCODE();
871 : }
872 :
873 : static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
874 0 : {
875 0 : zend_op *opline = EX(opline);
876 : zval *function_name;
877 : zend_class_entry *ce;
878 :
879 0 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
880 :
881 0 : ce = EX_T(opline->op1.u.var).class_entry;
882 : if(IS_TMP_VAR != IS_UNUSED) {
883 0 : char *function_name_strval = NULL;
884 : int function_name_strlen;
885 0 : zend_bool is_const = (IS_TMP_VAR == IS_CONST);
886 : zend_free_op free_op2;
887 :
888 0 : if (is_const) {
889 0 : function_name_strval = Z_STRVAL(opline->op2.u.constant);
890 0 : function_name_strlen = Z_STRLEN(opline->op2.u.constant);
891 : } else {
892 0 : function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
893 :
894 0 : if (Z_TYPE_P(function_name) != IS_STRING) {
895 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
896 : } else {
897 0 : function_name_strval = Z_STRVAL_P(function_name);
898 0 : function_name_strlen = Z_STRLEN_P(function_name);
899 : }
900 : }
901 :
902 0 : if (function_name_strval) {
903 0 : EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
904 : }
905 :
906 0 : if (!is_const) {
907 0 : zval_dtor(free_op2.var);
908 : }
909 : } else {
910 : if(!ce->constructor) {
911 : zend_error_noreturn(E_ERROR, "Can not call constructor");
912 : }
913 : if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
914 : zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name);
915 : }
916 : EX(fbc) = ce->constructor;
917 : }
918 :
919 0 : if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
920 0 : EX(object) = NULL;
921 : } else {
922 0 : if (IS_TMP_VAR != IS_UNUSED &&
923 : EG(This) &&
924 : Z_OBJ_HT_P(EG(This))->get_class_entry &&
925 : !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
926 : /* We are calling method of the other (incompatible) class,
927 : but passing $this. This is done for compatibility with php-4. */
928 : int severity;
929 : char *verb;
930 0 : if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
931 0 : severity = E_STRICT;
932 0 : verb = "should not";
933 : } else {
934 : /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
935 0 : severity = E_ERROR;
936 0 : verb = "cannot";
937 : }
938 0 : zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb);
939 :
940 : }
941 0 : if ((EX(object) = EG(This))) {
942 0 : EX(object)->refcount++;
943 : }
944 : }
945 :
946 0 : ZEND_VM_NEXT_OPCODE();
947 : }
948 :
949 : static int ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
950 0 : {
951 0 : zend_op *opline = EX(opline);
952 : zval *function_name;
953 : zend_function *function;
954 : char *function_name_strval, *lcname;
955 : int function_name_strlen;
956 : zend_free_op free_op2;
957 :
958 0 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
959 :
960 : if (IS_TMP_VAR == IS_CONST) {
961 : function_name_strval = opline->op2.u.constant.value.str.val;
962 : function_name_strlen = opline->op2.u.constant.value.str.len;
963 : } else {
964 0 : function_name = _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
965 :
966 0 : if (Z_TYPE_P(function_name) != IS_STRING) {
967 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
968 : }
969 0 : function_name_strval = function_name->value.str.val;
970 0 : function_name_strlen = function_name->value.str.len;
971 : }
972 :
973 0 : lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
974 0 : if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) {
975 0 : efree(lcname);
976 0 : zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
977 : }
978 :
979 0 : efree(lcname);
980 : if (IS_TMP_VAR != IS_CONST) {
981 0 : zval_dtor(free_op2.var);
982 : }
983 :
984 0 : EX(object) = NULL;
985 :
986 0 : EX(fbc) = function;
987 :
988 0 : ZEND_VM_NEXT_OPCODE();
989 : }
990 :
991 :
992 : static int ZEND_BRK_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
993 0 : {
994 0 : zend_op *opline = EX(opline);
995 : zend_free_op free_op2;
996 : zend_brk_cont_element *el;
997 :
998 0 : el = zend_brk_cont(_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num,
999 : EX(op_array), EX(Ts) TSRMLS_CC);
1000 0 : zval_dtor(free_op2.var);
1001 0 : ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
1002 : }
1003 :
1004 : static int ZEND_CONT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1005 0 : {
1006 0 : zend_op *opline = EX(opline);
1007 : zend_free_op free_op2;
1008 : zend_brk_cont_element *el;
1009 :
1010 0 : el = zend_brk_cont(_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num,
1011 : EX(op_array), EX(Ts) TSRMLS_CC);
1012 0 : zval_dtor(free_op2.var);
1013 0 : ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
1014 : }
1015 :
1016 : static int ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1017 4 : {
1018 4 : zend_op *opline = EX(opline);
1019 : zval *class_name;
1020 : zend_free_op free_op2;
1021 :
1022 :
1023 : if (IS_VAR == IS_UNUSED) {
1024 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
1025 : ZEND_VM_NEXT_OPCODE();
1026 : }
1027 :
1028 4 : class_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
1029 :
1030 4 : switch (Z_TYPE_P(class_name)) {
1031 : case IS_OBJECT:
1032 0 : EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
1033 0 : break;
1034 : case IS_STRING:
1035 4 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
1036 4 : break;
1037 : default:
1038 0 : zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
1039 : break;
1040 : }
1041 :
1042 4 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
1043 4 : ZEND_VM_NEXT_OPCODE();
1044 : }
1045 :
1046 : static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1047 1 : {
1048 1 : zend_op *opline = EX(opline);
1049 : zval *function_name;
1050 : zend_class_entry *ce;
1051 :
1052 1 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
1053 :
1054 1 : ce = EX_T(opline->op1.u.var).class_entry;
1055 : if(IS_VAR != IS_UNUSED) {
1056 1 : char *function_name_strval = NULL;
1057 : int function_name_strlen;
1058 1 : zend_bool is_const = (IS_VAR == IS_CONST);
1059 : zend_free_op free_op2;
1060 :
1061 1 : if (is_const) {
1062 0 : function_name_strval = Z_STRVAL(opline->op2.u.constant);
1063 0 : function_name_strlen = Z_STRLEN(opline->op2.u.constant);
1064 : } else {
1065 1 : function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
1066 :
1067 1 : if (Z_TYPE_P(function_name) != IS_STRING) {
1068 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
1069 : } else {
1070 1 : function_name_strval = Z_STRVAL_P(function_name);
1071 1 : function_name_strlen = Z_STRLEN_P(function_name);
1072 : }
1073 : }
1074 :
1075 1 : if (function_name_strval) {
1076 1 : EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
1077 : }
1078 :
1079 1 : if (!is_const) {
1080 1 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
1081 : }
1082 : } else {
1083 : if(!ce->constructor) {
1084 : zend_error_noreturn(E_ERROR, "Can not call constructor");
1085 : }
1086 : if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
1087 : zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name);
1088 : }
1089 : EX(fbc) = ce->constructor;
1090 : }
1091 :
1092 1 : if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
1093 0 : EX(object) = NULL;
1094 : } else {
1095 1 : if (IS_VAR != IS_UNUSED &&
1096 : EG(This) &&
1097 : Z_OBJ_HT_P(EG(This))->get_class_entry &&
1098 : !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
1099 : /* We are calling method of the other (incompatible) class,
1100 : but passing $this. This is done for compatibility with php-4. */
1101 : int severity;
1102 : char *verb;
1103 0 : if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
1104 0 : severity = E_STRICT;
1105 0 : verb = "should not";
1106 : } else {
1107 : /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
1108 0 : severity = E_ERROR;
1109 0 : verb = "cannot";
1110 : }
1111 0 : zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb);
1112 :
1113 : }
1114 1 : if ((EX(object) = EG(This))) {
1115 0 : EX(object)->refcount++;
1116 : }
1117 : }
1118 :
1119 1 : ZEND_VM_NEXT_OPCODE();
1120 : }
1121 :
1122 : static int ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1123 5 : {
1124 5 : zend_op *opline = EX(opline);
1125 : zval *function_name;
1126 : zend_function *function;
1127 : char *function_name_strval, *lcname;
1128 : int function_name_strlen;
1129 : zend_free_op free_op2;
1130 :
1131 5 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
1132 :
1133 : if (IS_VAR == IS_CONST) {
1134 : function_name_strval = opline->op2.u.constant.value.str.val;
1135 : function_name_strlen = opline->op2.u.constant.value.str.len;
1136 : } else {
1137 5 : function_name = _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
1138 :
1139 5 : if (Z_TYPE_P(function_name) != IS_STRING) {
1140 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
1141 : }
1142 5 : function_name_strval = function_name->value.str.val;
1143 5 : function_name_strlen = function_name->value.str.len;
1144 : }
1145 :
1146 5 : lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
1147 5 : if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) {
1148 0 : efree(lcname);
1149 0 : zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
1150 : }
1151 :
1152 5 : efree(lcname);
1153 : if (IS_VAR != IS_CONST) {
1154 5 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
1155 : }
1156 :
1157 5 : EX(object) = NULL;
1158 :
1159 5 : EX(fbc) = function;
1160 :
1161 5 : ZEND_VM_NEXT_OPCODE();
1162 : }
1163 :
1164 :
1165 : static int ZEND_BRK_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1166 0 : {
1167 0 : zend_op *opline = EX(opline);
1168 : zend_free_op free_op2;
1169 : zend_brk_cont_element *el;
1170 :
1171 0 : el = zend_brk_cont(_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num,
1172 : EX(op_array), EX(Ts) TSRMLS_CC);
1173 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
1174 0 : ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
1175 : }
1176 :
1177 : static int ZEND_CONT_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1178 0 : {
1179 0 : zend_op *opline = EX(opline);
1180 : zend_free_op free_op2;
1181 : zend_brk_cont_element *el;
1182 :
1183 0 : el = zend_brk_cont(_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC), opline->op1.u.opline_num,
1184 : EX(op_array), EX(Ts) TSRMLS_CC);
1185 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
1186 0 : ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
1187 : }
1188 :
1189 : static int ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1190 1958 : {
1191 1958 : zend_op *opline = EX(opline);
1192 : zval *class_name;
1193 :
1194 :
1195 :
1196 : if (IS_UNUSED == IS_UNUSED) {
1197 1958 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
1198 1958 : ZEND_VM_NEXT_OPCODE();
1199 : }
1200 :
1201 : class_name = NULL;
1202 :
1203 : switch (Z_TYPE_P(class_name)) {
1204 : case IS_OBJECT:
1205 : EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
1206 : break;
1207 : case IS_STRING:
1208 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
1209 : break;
1210 : default:
1211 : zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
1212 : break;
1213 : }
1214 :
1215 : ZEND_VM_NEXT_OPCODE();
1216 : }
1217 :
1218 : static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1219 153 : {
1220 153 : zend_op *opline = EX(opline);
1221 : zval *function_name;
1222 : zend_class_entry *ce;
1223 :
1224 153 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
1225 :
1226 153 : ce = EX_T(opline->op1.u.var).class_entry;
1227 : if(IS_UNUSED != IS_UNUSED) {
1228 : char *function_name_strval = NULL;
1229 : int function_name_strlen;
1230 : zend_bool is_const = (IS_UNUSED == IS_CONST);
1231 :
1232 :
1233 : if (is_const) {
1234 : function_name_strval = Z_STRVAL(opline->op2.u.constant);
1235 : function_name_strlen = Z_STRLEN(opline->op2.u.constant);
1236 : } else {
1237 : function_name = NULL;
1238 :
1239 : if (Z_TYPE_P(function_name) != IS_STRING) {
1240 : zend_error_noreturn(E_ERROR, "Function name must be a string");
1241 : } else {
1242 : function_name_strval = Z_STRVAL_P(function_name);
1243 : function_name_strlen = Z_STRLEN_P(function_name);
1244 : }
1245 : }
1246 :
1247 : if (function_name_strval) {
1248 : EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
1249 : }
1250 :
1251 : if (!is_const) {
1252 :
1253 : }
1254 : } else {
1255 153 : if(!ce->constructor) {
1256 0 : zend_error_noreturn(E_ERROR, "Can not call constructor");
1257 : }
1258 153 : if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
1259 1 : zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name);
1260 : }
1261 152 : EX(fbc) = ce->constructor;
1262 : }
1263 :
1264 152 : if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
1265 0 : EX(object) = NULL;
1266 : } else {
1267 : if (IS_UNUSED != IS_UNUSED &&
1268 : EG(This) &&
1269 : Z_OBJ_HT_P(EG(This))->get_class_entry &&
1270 : !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
1271 : /* We are calling method of the other (incompatible) class,
1272 : but passing $this. This is done for compatibility with php-4. */
1273 : int severity;
1274 : char *verb;
1275 : if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
1276 : severity = E_STRICT;
1277 : verb = "should not";
1278 : } else {
1279 : /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
1280 : severity = E_ERROR;
1281 : verb = "cannot";
1282 : }
1283 : zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb);
1284 :
1285 : }
1286 152 : if ((EX(object) = EG(This))) {
1287 151 : EX(object)->refcount++;
1288 : }
1289 : }
1290 :
1291 152 : ZEND_VM_NEXT_OPCODE();
1292 : }
1293 :
1294 : static int ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1295 692 : {
1296 692 : zend_op *opline = EX(opline);
1297 : zval *class_name;
1298 :
1299 :
1300 :
1301 : if (IS_CV == IS_UNUSED) {
1302 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(NULL, 0, opline->extended_value TSRMLS_CC);
1303 : ZEND_VM_NEXT_OPCODE();
1304 : }
1305 :
1306 692 : class_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
1307 :
1308 692 : switch (Z_TYPE_P(class_name)) {
1309 : case IS_OBJECT:
1310 0 : EX_T(opline->result.u.var).class_entry = Z_OBJCE_P(class_name);
1311 0 : break;
1312 : case IS_STRING:
1313 692 : EX_T(opline->result.u.var).class_entry = zend_fetch_class(Z_STRVAL_P(class_name), Z_STRLEN_P(class_name), opline->extended_value TSRMLS_CC);
1314 692 : break;
1315 : default:
1316 0 : zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
1317 : break;
1318 : }
1319 :
1320 692 : ZEND_VM_NEXT_OPCODE();
1321 : }
1322 :
1323 : static int ZEND_INIT_STATIC_METHOD_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1324 4 : {
1325 4 : zend_op *opline = EX(opline);
1326 : zval *function_name;
1327 : zend_class_entry *ce;
1328 :
1329 4 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
1330 :
1331 4 : ce = EX_T(opline->op1.u.var).class_entry;
1332 : if(IS_CV != IS_UNUSED) {
1333 4 : char *function_name_strval = NULL;
1334 : int function_name_strlen;
1335 4 : zend_bool is_const = (IS_CV == IS_CONST);
1336 :
1337 :
1338 4 : if (is_const) {
1339 0 : function_name_strval = Z_STRVAL(opline->op2.u.constant);
1340 0 : function_name_strlen = Z_STRLEN(opline->op2.u.constant);
1341 : } else {
1342 4 : function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
1343 :
1344 4 : if (Z_TYPE_P(function_name) != IS_STRING) {
1345 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
1346 : } else {
1347 4 : function_name_strval = Z_STRVAL_P(function_name);
1348 4 : function_name_strlen = Z_STRLEN_P(function_name);
1349 : }
1350 : }
1351 :
1352 4 : if (function_name_strval) {
1353 4 : EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
1354 : }
1355 :
1356 : if (!is_const) {
1357 :
1358 : }
1359 : } else {
1360 : if(!ce->constructor) {
1361 : zend_error_noreturn(E_ERROR, "Can not call constructor");
1362 : }
1363 : if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
1364 : zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name);
1365 : }
1366 : EX(fbc) = ce->constructor;
1367 : }
1368 :
1369 4 : if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
1370 4 : EX(object) = NULL;
1371 : } else {
1372 0 : if (IS_CV != IS_UNUSED &&
1373 : EG(This) &&
1374 : Z_OBJ_HT_P(EG(This))->get_class_entry &&
1375 : !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
1376 : /* We are calling method of the other (incompatible) class,
1377 : but passing $this. This is done for compatibility with php-4. */
1378 : int severity;
1379 : char *verb;
1380 0 : if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
1381 0 : severity = E_STRICT;
1382 0 : verb = "should not";
1383 : } else {
1384 : /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
1385 0 : severity = E_ERROR;
1386 0 : verb = "cannot";
1387 : }
1388 0 : zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb);
1389 :
1390 : }
1391 0 : if ((EX(object) = EG(This))) {
1392 0 : EX(object)->refcount++;
1393 : }
1394 : }
1395 :
1396 4 : ZEND_VM_NEXT_OPCODE();
1397 : }
1398 :
1399 : static int ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1400 13057 : {
1401 13057 : zend_op *opline = EX(opline);
1402 : zval *function_name;
1403 : zend_function *function;
1404 : char *function_name_strval, *lcname;
1405 : int function_name_strlen;
1406 :
1407 :
1408 13057 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
1409 :
1410 : if (IS_CV == IS_CONST) {
1411 : function_name_strval = opline->op2.u.constant.value.str.val;
1412 : function_name_strlen = opline->op2.u.constant.value.str.len;
1413 : } else {
1414 13057 : function_name = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
1415 :
1416 13057 : if (Z_TYPE_P(function_name) != IS_STRING) {
1417 0 : zend_error_noreturn(E_ERROR, "Function name must be a string");
1418 : }
1419 13057 : function_name_strval = function_name->value.str.val;
1420 13057 : function_name_strlen = function_name->value.str.len;
1421 : }
1422 :
1423 13057 : lcname = zend_str_tolower_dup(function_name_strval, function_name_strlen);
1424 13057 : if (zend_hash_find(EG(function_table), lcname, function_name_strlen+1, (void **) &function)==FAILURE) {
1425 0 : efree(lcname);
1426 0 : zend_error_noreturn(E_ERROR, "Call to undefined function %s()", function_name_strval);
1427 : }
1428 :
1429 13057 : efree(lcname);
1430 : if (IS_CV != IS_CONST) {
1431 :
1432 : }
1433 :
1434 13057 : EX(object) = NULL;
1435 :
1436 13057 : EX(fbc) = function;
1437 :
1438 13057 : ZEND_VM_NEXT_OPCODE();
1439 : }
1440 :
1441 :
1442 : static int ZEND_BRK_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1443 0 : {
1444 0 : zend_op *opline = EX(opline);
1445 :
1446 : zend_brk_cont_element *el;
1447 :
1448 0 : el = zend_brk_cont(_get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC), opline->op1.u.opline_num,
1449 : EX(op_array), EX(Ts) TSRMLS_CC);
1450 :
1451 0 : ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
1452 : }
1453 :
1454 : static int ZEND_CONT_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1455 0 : {
1456 0 : zend_op *opline = EX(opline);
1457 :
1458 : zend_brk_cont_element *el;
1459 :
1460 0 : el = zend_brk_cont(_get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC), opline->op1.u.opline_num,
1461 : EX(op_array), EX(Ts) TSRMLS_CC);
1462 :
1463 0 : ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
1464 : }
1465 :
1466 : static int ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1467 2 : {
1468 2 : zend_op *opline = EX(opline);
1469 :
1470 :
1471 2 : bitwise_not_function(&EX_T(opline->result.u.var).tmp_var,
1472 : &opline->op1.u.constant TSRMLS_CC);
1473 :
1474 2 : ZEND_VM_NEXT_OPCODE();
1475 : }
1476 :
1477 : static int ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1478 1 : {
1479 1 : zend_op *opline = EX(opline);
1480 :
1481 :
1482 1 : boolean_not_function(&EX_T(opline->result.u.var).tmp_var,
1483 : &opline->op1.u.constant TSRMLS_CC);
1484 :
1485 1 : ZEND_VM_NEXT_OPCODE();
1486 : }
1487 :
1488 : static int ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1489 37263 : {
1490 37263 : zend_op *opline = EX(opline);
1491 :
1492 : zval z_copy;
1493 37263 : zval *z = &opline->op1.u.constant;
1494 :
1495 37263 : if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL &&
1496 : zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
1497 0 : zend_print_variable(&z_copy);
1498 0 : zval_dtor(&z_copy);
1499 : } else {
1500 37263 : zend_print_variable(z);
1501 : }
1502 :
1503 37262 : ZEND_VM_NEXT_OPCODE();
1504 : }
1505 :
1506 : static int ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1507 800 : {
1508 800 : zend_op *opline = EX(opline);
1509 :
1510 800 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1;
1511 800 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG;
1512 :
1513 800 : return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1514 : }
1515 :
1516 : static int zend_fetch_var_address_helper_SPEC_CONST(int type, ZEND_OPCODE_HANDLER_ARGS)
1517 1273497 : {
1518 1273497 : zend_op *opline = EX(opline);
1519 : zend_free_op free_op1;
1520 1273497 : zval *varname = &opline->op1.u.constant;
1521 : zval **retval;
1522 : zval tmp_varname;
1523 : HashTable *target_symbol_table;
1524 :
1525 1273497 : if (Z_TYPE_P(varname) != IS_STRING) {
1526 0 : tmp_varname = *varname;
1527 0 : zval_copy_ctor(&tmp_varname);
1528 0 : convert_to_string(&tmp_varname);
1529 0 : varname = &tmp_varname;
1530 : }
1531 :
1532 1273497 : if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
1533 527 : retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
1534 :
1535 : } else {
1536 1272970 : target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
1537 : /*
1538 : if (!target_symbol_table) {
1539 : ZEND_VM_NEXT_OPCODE();
1540 : }
1541 : */
1542 1272970 : if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) {
1543 1627 : switch (type) {
1544 : case BP_VAR_R:
1545 : case BP_VAR_UNSET:
1546 1363 : zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
1547 : /* break missing intentionally */
1548 : case BP_VAR_IS:
1549 1363 : retval = &EG(uninitialized_zval_ptr);
1550 1363 : break;
1551 : case BP_VAR_RW:
1552 0 : zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
1553 : /* break missing intentionally */
1554 : case BP_VAR_W: {
1555 264 : zval *new_zval = &EG(uninitialized_zval);
1556 :
1557 264 : new_zval->refcount++;
1558 264 : zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
1559 : }
1560 : break;
1561 : EMPTY_SWITCH_DEFAULT_CASE()
1562 : }
1563 : }
1564 1272970 : switch (opline->op2.u.EA.type) {
1565 : case ZEND_FETCH_GLOBAL:
1566 : if (IS_CONST != IS_TMP_VAR) {
1567 :
1568 : }
1569 5418 : break;
1570 : case ZEND_FETCH_LOCAL:
1571 :
1572 842604 : break;
1573 : case ZEND_FETCH_STATIC:
1574 995 : zval_update_constant(retval, (void*) 1 TSRMLS_CC);
1575 : break;
1576 : case ZEND_FETCH_GLOBAL_LOCK:
1577 : if (IS_CONST == IS_VAR && !free_op1.var) {
1578 : PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
1579 : }
1580 : break;
1581 : }
1582 : }
1583 :
1584 :
1585 1273490 : if (varname == &tmp_varname) {
1586 0 : zval_dtor(varname);
1587 : }
1588 1273490 : if (!RETURN_VALUE_UNUSED(&opline->result)) {
1589 1273487 : EX_T(opline->result.u.var).var.ptr_ptr = retval;
1590 1273487 : PZVAL_LOCK(*retval);
1591 1273487 : switch (type) {
1592 : case BP_VAR_R:
1593 : case BP_VAR_IS:
1594 234613 : AI_USE_PTR(EX_T(opline->result.u.var).var);
1595 234613 : break;
1596 : case BP_VAR_UNSET: {
1597 : zend_free_op free_res;
1598 :
1599 25 : PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res);
1600 25 : if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
1601 25 : SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr);
1602 : }
1603 25 : PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr);
1604 25 : FREE_OP_VAR_PTR(free_res);
1605 : break;
1606 : }
1607 : }
1608 : }
1609 1273490 : ZEND_VM_NEXT_OPCODE();
1610 : }
1611 :
1612 : static int ZEND_FETCH_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1613 234497 : {
1614 234497 : return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1615 : }
1616 :
1617 : static int ZEND_FETCH_W_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1618 1038807 : {
1619 1038807 : return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1620 : }
1621 :
1622 : static int ZEND_FETCH_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1623 45 : {
1624 45 : return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1625 : }
1626 :
1627 : static int ZEND_FETCH_FUNC_ARG_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1628 121 : {
1629 121 : return zend_fetch_var_address_helper_SPEC_CONST(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1630 : }
1631 :
1632 : static int ZEND_FETCH_UNSET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1633 25 : {
1634 25 : return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1635 : }
1636 :
1637 : static int ZEND_FETCH_IS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1638 2 : {
1639 2 : return zend_fetch_var_address_helper_SPEC_CONST(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1640 : }
1641 :
1642 : static int ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1643 613698 : {
1644 613698 : zend_op *opline = EX(opline);
1645 :
1646 613698 : int ret = i_zend_is_true(&opline->op1.u.constant);
1647 :
1648 613698 : if (!ret) {
1649 : #if DEBUG_ZEND>=2
1650 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
1651 : #endif
1652 102 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
1653 : }
1654 :
1655 613596 : ZEND_VM_NEXT_OPCODE();
1656 : }
1657 :
1658 : static int ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1659 5 : {
1660 5 : zend_op *opline = EX(opline);
1661 :
1662 5 : int ret = i_zend_is_true(&opline->op1.u.constant);
1663 :
1664 5 : if (ret) {
1665 : #if DEBUG_ZEND>=2
1666 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
1667 : #endif
1668 5 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
1669 : }
1670 :
1671 0 : ZEND_VM_NEXT_OPCODE();
1672 : }
1673 :
1674 : static int ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1675 599876 : {
1676 599876 : zend_op *opline = EX(opline);
1677 :
1678 599876 : int retval = i_zend_is_true(&opline->op1.u.constant);
1679 :
1680 599876 : if (retval) {
1681 : #if DEBUG_ZEND>=2
1682 : printf("Conditional jmp on true to %d\n", opline->extended_value);
1683 : #endif
1684 599876 : ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]);
1685 : } else {
1686 : #if DEBUG_ZEND>=2
1687 : printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num);
1688 : #endif
1689 0 : ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]);
1690 : }
1691 : }
1692 :
1693 : static int ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1694 0 : {
1695 0 : zend_op *opline = EX(opline);
1696 :
1697 0 : int retval = i_zend_is_true(&opline->op1.u.constant);
1698 :
1699 0 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval;
1700 0 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
1701 0 : if (!retval) {
1702 : #if DEBUG_ZEND>=2
1703 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
1704 : #endif
1705 0 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
1706 : }
1707 0 : ZEND_VM_NEXT_OPCODE();
1708 : }
1709 :
1710 : static int ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1711 0 : {
1712 0 : zend_op *opline = EX(opline);
1713 :
1714 0 : int retval = i_zend_is_true(&opline->op1.u.constant);
1715 :
1716 0 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval;
1717 0 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
1718 0 : if (retval) {
1719 : #if DEBUG_ZEND>=2
1720 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
1721 : #endif
1722 0 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
1723 : }
1724 0 : ZEND_VM_NEXT_OPCODE();
1725 : }
1726 :
1727 : static int ZEND_DO_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1728 12774189 : {
1729 12774189 : zend_op *opline = EX(opline);
1730 :
1731 12774189 : zval *fname = &opline->op1.u.constant;
1732 :
1733 12774189 : zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
1734 :
1735 12774189 : if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
1736 0 : zend_error_noreturn(E_ERROR, "Call to undefined function %s()", fname->value.str.val);
1737 : }
1738 12774189 : EX(object) = NULL;
1739 :
1740 12774189 : return zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1741 : }
1742 :
1743 : static int ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1744 231783 : {
1745 231783 : zend_op *opline = EX(opline);
1746 : zval *retval_ptr;
1747 : zval **retval_ptr_ptr;
1748 :
1749 :
1750 231783 : if (EG(active_op_array)->return_reference == ZEND_RETURN_REF) {
1751 :
1752 : if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
1753 : /* Not supposed to happen, but we'll allow it */
1754 6 : zend_error(E_NOTICE, "Only variable references should be returned by reference");
1755 6 : goto return_by_value;
1756 : }
1757 :
1758 : retval_ptr_ptr = NULL;
1759 :
1760 : if (!retval_ptr_ptr) {
1761 : zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
1762 : }
1763 :
1764 : if (IS_CONST == IS_VAR && !(*retval_ptr_ptr)->is_ref) {
1765 : if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
1766 : EX_T(opline->op1.u.var).var.fcall_returned_reference) {
1767 : } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) {
1768 : if (IS_CONST == IS_VAR && !0) {
1769 : PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
1770 : }
1771 : zend_error(E_NOTICE, "Only variable references should be returned by reference");
1772 : goto return_by_value;
1773 : }
1774 : }
1775 :
1776 : SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr);
1777 : (*retval_ptr_ptr)->refcount++;
1778 :
1779 : (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr);
1780 : } else {
1781 231783 : return_by_value:
1782 :
1783 231783 : retval_ptr = &opline->op1.u.constant;
1784 :
1785 231783 : if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
1786 : zval *ret;
1787 : char *class_name;
1788 : zend_uint class_name_len;
1789 : int dup;
1790 :
1791 0 : ALLOC_ZVAL(ret);
1792 0 : INIT_PZVAL_COPY(ret, retval_ptr);
1793 0 : dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
1794 0 : if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
1795 0 : zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name);
1796 : }
1797 0 : zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
1798 0 : ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
1799 0 : *EG(return_value_ptr_ptr) = ret;
1800 0 : if (!dup) {
1801 0 : efree(class_name);
1802 : }
1803 : } else if (!0) { /* Not a temp var */
1804 463566 : if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
1805 : (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) {
1806 : zval *ret;
1807 :
1808 231783 : ALLOC_ZVAL(ret);
1809 231783 : INIT_PZVAL_COPY(ret, retval_ptr);
1810 231783 : zval_copy_ctor(ret);
1811 231783 : *EG(return_value_ptr_ptr) = ret;
1812 : } else {
1813 0 : *EG(return_value_ptr_ptr) = retval_ptr;
1814 0 : retval_ptr->refcount++;
1815 : }
1816 : } else {
1817 : zval *ret;
1818 :
1819 : ALLOC_ZVAL(ret);
1820 : INIT_PZVAL_COPY(ret, retval_ptr);
1821 : *EG(return_value_ptr_ptr) = ret;
1822 : }
1823 : }
1824 :
1825 231783 : ZEND_VM_RETURN_FROM_EXECUTE_LOOP();
1826 : }
1827 :
1828 : static int ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1829 1 : {
1830 1 : zend_op *opline = EX(opline);
1831 : zval *value;
1832 : zval *exception;
1833 :
1834 :
1835 1 : value = &opline->op1.u.constant;
1836 :
1837 1 : if (Z_TYPE_P(value) != IS_OBJECT) {
1838 1 : zend_error_noreturn(E_ERROR, "Can only throw objects");
1839 : }
1840 : /* Not sure if a complete copy is what we want here */
1841 0 : ALLOC_ZVAL(exception);
1842 0 : INIT_PZVAL_COPY(exception, value);
1843 : if (!0) {
1844 0 : zval_copy_ctor(exception);
1845 : }
1846 :
1847 0 : zend_throw_exception_object(exception TSRMLS_CC);
1848 :
1849 0 : ZEND_VM_NEXT_OPCODE();
1850 : }
1851 :
1852 : static int ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1853 3911941 : {
1854 3911941 : zend_op *opline = EX(opline);
1855 3911941 : if (opline->extended_value==ZEND_DO_FCALL_BY_NAME
1856 : && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
1857 1 : zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num);
1858 : }
1859 : {
1860 : zval *valptr;
1861 : zval *value;
1862 :
1863 :
1864 3911940 : value = &opline->op1.u.constant;
1865 :
1866 3911940 : ALLOC_ZVAL(valptr);
1867 3911940 : INIT_PZVAL_COPY(valptr, value);
1868 : if (!0) {
1869 3911940 : zval_copy_ctor(valptr);
1870 : }
1871 3911940 : zend_ptr_stack_push(&EG(argument_stack), valptr);
1872 :
1873 : }
1874 3911940 : ZEND_VM_NEXT_OPCODE();
1875 : }
1876 :
1877 : static int ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1878 0 : {
1879 0 : zend_op *opline = EX(opline);
1880 :
1881 :
1882 : /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
1883 0 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(&opline->op1.u.constant);
1884 0 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
1885 :
1886 0 : ZEND_VM_NEXT_OPCODE();
1887 : }
1888 :
1889 : static int ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1890 2 : {
1891 2 : zend_op *opline = EX(opline);
1892 :
1893 2 : zval *obj = &opline->op1.u.constant;
1894 : zend_class_entry *ce;
1895 : zend_function *clone;
1896 : zend_object_clone_obj_t clone_call;
1897 :
1898 2 : if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
1899 2 : zend_error_noreturn(E_ERROR, "__clone method called on non-object");
1900 : EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
1901 : EX_T(opline->result.u.var).var.ptr->refcount++;
1902 :
1903 : ZEND_VM_NEXT_OPCODE();
1904 : }
1905 :
1906 0 : ce = Z_OBJCE_P(obj);
1907 0 : clone = ce ? ce->clone : NULL;
1908 0 : clone_call = Z_OBJ_HT_P(obj)->clone_obj;
1909 0 : if (!clone_call) {
1910 0 : if (ce) {
1911 0 : zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name);
1912 : } else {
1913 0 : zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object");
1914 : }
1915 : EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
1916 : EX_T(opline->result.u.var).var.ptr->refcount++;
1917 : }
1918 :
1919 0 : if (ce && clone) {
1920 0 : if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
1921 : /* Ensure that if we're calling a private function, we're allowed to do so.
1922 : */
1923 0 : if (ce != EG(scope)) {
1924 0 : zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
1925 : }
1926 0 : } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
1927 : /* Ensure that if we're calling a protected function, we're allowed to do so.
1928 : */
1929 0 : if (!zend_check_protected(clone->common.scope, EG(scope))) {
1930 0 : zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
1931 : }
1932 : }
1933 : }
1934 :
1935 0 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
1936 0 : if (!EG(exception)) {
1937 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
1938 0 : Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC);
1939 0 : Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT;
1940 0 : EX_T(opline->result.u.var).var.ptr->refcount=1;
1941 0 : EX_T(opline->result.u.var).var.ptr->is_ref=1;
1942 0 : if (!RETURN_VALUE_USED(opline) || EG(exception)) {
1943 0 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
1944 : }
1945 : }
1946 :
1947 0 : ZEND_VM_NEXT_OPCODE();
1948 : }
1949 :
1950 : static int ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1951 18 : {
1952 18 : zend_op *opline = EX(opline);
1953 :
1954 18 : zval *expr = &opline->op1.u.constant;
1955 18 : zval *result = &EX_T(opline->result.u.var).tmp_var;
1956 :
1957 18 : if (opline->extended_value != IS_STRING) {
1958 8 : *result = *expr;
1959 : if (!0) {
1960 8 : zendi_zval_copy_ctor(*result);
1961 : }
1962 : }
1963 18 : switch (opline->extended_value) {
1964 : case IS_NULL:
1965 0 : convert_to_null(result);
1966 0 : break;
1967 : case IS_BOOL:
1968 2 : convert_to_boolean(result);
1969 2 : break;
1970 : case IS_LONG:
1971 2 : convert_to_long(result);
1972 2 : break;
1973 : case IS_DOUBLE:
1974 2 : convert_to_double(result);
1975 2 : break;
1976 : case IS_STRING: {
1977 : zval var_copy;
1978 : int use_copy;
1979 :
1980 10 : zend_make_printable_zval(expr, &var_copy, &use_copy);
1981 10 : if (use_copy) {
1982 0 : *result = var_copy;
1983 : if (0) {
1984 :
1985 : }
1986 : } else {
1987 10 : *result = *expr;
1988 : if (!0) {
1989 10 : zendi_zval_copy_ctor(*result);
1990 : }
1991 : }
1992 10 : break;
1993 : }
1994 : case IS_ARRAY:
1995 0 : convert_to_array(result);
1996 0 : break;
1997 : case IS_OBJECT:
1998 2 : convert_to_object(result);
1999 : break;
2000 : }
2001 :
2002 18 : ZEND_VM_NEXT_OPCODE();
2003 : }
2004 :
2005 : static int ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2006 2619 : {
2007 2619 : zend_op *opline = EX(opline);
2008 2619 : zend_op_array *new_op_array=NULL;
2009 2619 : zval **original_return_value = EG(return_value_ptr_ptr);
2010 : int return_value_used;
2011 :
2012 2619 : zval *inc_filename = &opline->op1.u.constant;
2013 : zval tmp_inc_filename;
2014 2619 : zend_bool failure_retval=0;
2015 :
2016 2619 : if (inc_filename->type!=IS_STRING) {
2017 0 : tmp_inc_filename = *inc_filename;
2018 0 : zval_copy_ctor(&tmp_inc_filename);
2019 0 : convert_to_string(&tmp_inc_filename);
2020 0 : inc_filename = &tmp_inc_filename;
2021 : }
2022 :
2023 2619 : return_value_used = RETURN_VALUE_USED(opline);
2024 :
2025 2619 : switch (Z_LVAL(opline->op2.u.constant)) {
2026 : case ZEND_INCLUDE_ONCE:
2027 : case ZEND_REQUIRE_ONCE: {
2028 : zend_file_handle file_handle;
2029 :
2030 1091 : if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
2031 : cwd_state state;
2032 :
2033 0 : state.cwd_length = 0;
2034 0 : state.cwd = malloc(1);
2035 0 : state.cwd[0] = 0;
2036 :
2037 0 : failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
2038 : zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
2039 :
2040 0 : free(state.cwd);
2041 : }
2042 :
2043 1091 : if (failure_retval) {
2044 : /* do nothing */
2045 1091 : } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
2046 :
2047 1088 : if (!file_handle.opened_path) {
2048 0 : file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
2049 : }
2050 :
2051 1088 : if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
2052 1088 : new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
2053 1088 : zend_destroy_file_handle(&file_handle TSRMLS_CC);
2054 : } else {
2055 0 : zend_file_handle_dtor(&file_handle);
2056 0 : failure_retval=1;
2057 : }
2058 : } else {
2059 3 : if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) {
2060 0 : zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename));
2061 : } else {
2062 3 : zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
2063 : }
2064 : }
2065 : }
2066 1088 : break;
2067 : case ZEND_INCLUDE:
2068 : case ZEND_REQUIRE:
2069 1493 : new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC);
2070 1491 : break;
2071 : case ZEND_EVAL: {
2072 35 : char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
2073 :
2074 35 : new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
2075 34 : efree(eval_desc);
2076 : }
2077 : break;
2078 : EMPTY_SWITCH_DEFAULT_CASE()
2079 : }
2080 2613 : if (inc_filename==&tmp_inc_filename) {
2081 0 : zval_dtor(&tmp_inc_filename);
2082 : }
2083 2613 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
2084 2613 : if (new_op_array) {
2085 : zval *saved_object;
2086 : zend_function *saved_function;
2087 :
2088 2609 : EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr;
2089 2609 : EG(active_op_array) = new_op_array;
2090 2609 : EX_T(opline->result.u.var).var.ptr = NULL;
2091 :
2092 2609 : saved_object = EX(object);
2093 2609 : saved_function = EX(function_state).function;
2094 :
2095 2609 : EX(function_state).function = (zend_function *) new_op_array;
2096 2609 : EX(object) = NULL;
2097 :
2098 2609 : zend_execute(new_op_array TSRMLS_CC);
2099 :
2100 2581 : EX(function_state).function = saved_function;
2101 2581 : EX(object) = saved_object;
2102 :
2103 2581 : if (!return_value_used) {
2104 2581 : if (EX_T(opline->result.u.var).var.ptr) {
2105 2580 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
2106 : }
2107 : } else { /* return value is used */
2108 0 : if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */
2109 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
2110 0 : INIT_PZVAL(EX_T(opline->result.u.var).var.ptr);
2111 0 : Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1;
2112 0 : Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL;
2113 : }
2114 : }
2115 :
2116 2581 : EG(opline_ptr) = &EX(opline);
2117 2581 : EG(active_op_array) = EX(op_array);
2118 2581 : EG(function_state_ptr) = &EX(function_state);
2119 2581 : destroy_op_array(new_op_array TSRMLS_CC);
2120 2581 : efree(new_op_array);
2121 2581 : if (EG(exception)) {
2122 1 : zend_throw_exception_internal(NULL TSRMLS_CC);
2123 : }
2124 : } else {
2125 4 : if (return_value_used) {
2126 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
2127 0 : INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr);
2128 0 : Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval;
2129 0 : Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL;
2130 : }
2131 : }
2132 :
2133 2585 : EG(return_value_ptr_ptr) = original_return_value;
2134 2585 : ZEND_VM_NEXT_OPCODE();
2135 : }
2136 :
2137 : static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2138 2225 : {
2139 2225 : zend_op *opline = EX(opline);
2140 : zval tmp, *varname;
2141 : HashTable *target_symbol_table;
2142 :
2143 :
2144 2225 : varname = &opline->op1.u.constant;
2145 :
2146 2225 : if (Z_TYPE_P(varname) != IS_STRING) {
2147 0 : tmp = *varname;
2148 0 : zval_copy_ctor(&tmp);
2149 0 : convert_to_string(&tmp);
2150 0 : varname = &tmp;
2151 : } else if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
2152 : varname->refcount++;
2153 : }
2154 :
2155 2225 : if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
2156 0 : zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC);
2157 : } else {
2158 2225 : target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
2159 2225 : if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) {
2160 2178 : zend_execute_data *ex = execute_data;
2161 2178 : ulong hash_value = zend_inline_hash_func(varname->value.str.val, varname->value.str.len+1);
2162 :
2163 : do {
2164 : int i;
2165 :
2166 2182 : if (ex->op_array) {
2167 11052 : for (i = 0; i < ex->op_array->last_var; i++) {
2168 11046 : if (ex->op_array->vars[i].hash_value == hash_value &&
2169 : ex->op_array->vars[i].name_len == varname->value.str.len &&
2170 : !memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
2171 2176 : ex->CVs[i] = NULL;
2172 2176 : break;
2173 : }
2174 : }
2175 : }
2176 2182 : ex = ex->prev_execute_data;
2177 2182 : } while (ex && ex->symbol_table == target_symbol_table);
2178 : }
2179 : }
2180 :
2181 2224 : if (varname == &tmp) {
2182 0 : zval_dtor(&tmp);
2183 : } else if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
2184 : zval_ptr_dtor(&varname);
2185 : }
2186 :
2187 2224 : ZEND_VM_NEXT_OPCODE();
2188 : }
2189 :
2190 : static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2191 0 : {
2192 0 : zend_op *opline = EX(opline);
2193 :
2194 : zval *array_ptr, **array_ptr_ptr;
2195 : HashTable *fe_ht;
2196 0 : zend_object_iterator *iter = NULL;
2197 0 : zend_class_entry *ce = NULL;
2198 0 : zend_bool is_empty = 0;
2199 :
2200 0 : if (opline->extended_value & ZEND_FE_RESET_VARIABLE) {
2201 0 : array_ptr_ptr = NULL;
2202 0 : if (array_ptr_ptr == NULL || array_ptr_ptr == &EG(uninitialized_zval_ptr)) {
2203 0 : ALLOC_INIT_ZVAL(array_ptr);
2204 0 : } else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
2205 0 : if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
2206 0 : zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class");
2207 0 : ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
2208 : }
2209 :
2210 0 : ce = Z_OBJCE_PP(array_ptr_ptr);
2211 0 : if (!ce || ce->get_iterator == NULL) {
2212 0 : SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
2213 0 : (*array_ptr_ptr)->refcount++;
2214 : }
2215 0 : array_ptr = *array_ptr_ptr;
2216 : } else {
2217 0 : if (Z_TYPE_PP(array_ptr_ptr) == IS_ARRAY) {
2218 0 : SEPARATE_ZVAL_IF_NOT_REF(array_ptr_ptr);
2219 0 : if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
2220 0 : (*array_ptr_ptr)->is_ref = 1;
2221 : }
2222 : }
2223 0 : array_ptr = *array_ptr_ptr;
2224 0 : array_ptr->refcount++;
2225 : }
2226 : } else {
2227 0 : array_ptr = &opline->op1.u.constant;
2228 : if (0) { /* IS_TMP_VAR */
2229 : zval *tmp;
2230 :
2231 : ALLOC_ZVAL(tmp);
2232 : INIT_PZVAL_COPY(tmp, array_ptr);
2233 : array_ptr = tmp;
2234 : if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
2235 : ce = Z_OBJCE_P(array_ptr);
2236 : if (ce && ce->get_iterator) {
2237 : array_ptr->refcount--;
2238 : }
2239 : }
2240 0 : } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
2241 0 : ce = Z_OBJCE_P(array_ptr);
2242 0 : if (!ce || !ce->get_iterator) {
2243 0 : array_ptr->refcount++;
2244 : }
2245 : } else {
2246 : if (IS_CONST == IS_CONST ||
2247 : ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
2248 : !array_ptr->is_ref &&
2249 : array_ptr->refcount > 1)) {
2250 : zval *tmp;
2251 :
2252 0 : ALLOC_ZVAL(tmp);
2253 0 : INIT_PZVAL_COPY(tmp, array_ptr);
2254 0 : zval_copy_ctor(tmp);
2255 0 : array_ptr = tmp;
2256 : } else {
2257 : array_ptr->refcount++;
2258 : }
2259 : }
2260 : }
2261 :
2262 0 : if (ce && ce->get_iterator) {
2263 0 : iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
2264 :
2265 0 : if (iter && !EG(exception)) {
2266 0 : array_ptr = zend_iterator_wrap(iter TSRMLS_CC);
2267 : } else {
2268 0 : if (opline->extended_value & ZEND_FE_RESET_VARIABLE) {
2269 :
2270 : } else {
2271 :
2272 : }
2273 0 : if (!EG(exception)) {
2274 0 : zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name);
2275 : }
2276 0 : zend_throw_exception_internal(NULL TSRMLS_CC);
2277 0 : ZEND_VM_NEXT_OPCODE();
2278 : }
2279 : }
2280 :
2281 0 : PZVAL_LOCK(array_ptr);
2282 0 : EX_T(opline->result.u.var).var.ptr = array_ptr;
2283 0 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
2284 :
2285 0 : if (iter) {
2286 0 : iter->index = 0;
2287 0 : if (iter->funcs->rewind) {
2288 0 : iter->funcs->rewind(iter TSRMLS_CC);
2289 0 : if (EG(exception)) {
2290 0 : array_ptr->refcount--;
2291 0 : zval_ptr_dtor(&array_ptr);
2292 0 : if (opline->extended_value & ZEND_FE_RESET_VARIABLE) {
2293 :
2294 : } else {
2295 :
2296 : }
2297 0 : ZEND_VM_NEXT_OPCODE();
2298 : }
2299 : }
2300 0 : is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
2301 0 : if (EG(exception)) {
2302 0 : array_ptr->refcount--;
2303 0 : zval_ptr_dtor(&array_ptr);
2304 0 : if (opline->extended_value & ZEND_FE_RESET_VARIABLE) {
2305 :
2306 : } else {
2307 :
2308 : }
2309 0 : ZEND_VM_NEXT_OPCODE();
2310 : }
2311 0 : iter->index = -1; /* will be set to 0 before using next handler */
2312 0 : } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
2313 0 : zend_hash_internal_pointer_reset(fe_ht);
2314 0 : if (ce) {
2315 0 : zend_object *zobj = zend_objects_get_address(array_ptr TSRMLS_CC);
2316 0 : while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
2317 : char *str_key;
2318 : uint str_key_len;
2319 : ulong int_key;
2320 : zend_uchar key_type;
2321 :
2322 0 : key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
2323 0 : if (key_type != HASH_KEY_NON_EXISTANT &&
2324 : (key_type == HASH_KEY_IS_LONG ||
2325 : zend_check_property_access(zobj, str_key, str_key_len-1 TSRMLS_CC) == SUCCESS)) {
2326 : break;
2327 : }
2328 0 : zend_hash_move_forward(fe_ht);
2329 : }
2330 : }
2331 0 : is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
2332 0 : zend_hash_get_pointer(fe_ht, &EX_T(opline->result.u.var).fe.fe_pos);
2333 : } else {
2334 0 : zend_error(E_WARNING, "Invalid argument supplied for foreach()");
2335 0 : is_empty = 1;
2336 : }
2337 :
2338 0 : if (opline->extended_value & ZEND_FE_RESET_VARIABLE) {
2339 :
2340 : } else {
2341 :
2342 : }
2343 0 : if (is_empty) {
2344 0 : ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
2345 : } else {
2346 0 : ZEND_VM_NEXT_OPCODE();
2347 : }
2348 : }
2349 :
2350 : static int ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2351 18586 : {
2352 18586 : zend_op *opline = EX(opline);
2353 :
2354 18586 : zval tmp, *varname = &opline->op1.u.constant;
2355 : zval **value;
2356 18586 : zend_bool isset = 1;
2357 : HashTable *target_symbol_table;
2358 :
2359 18586 : if (Z_TYPE_P(varname) != IS_STRING) {
2360 0 : tmp = *varname;
2361 0 : zval_copy_ctor(&tmp);
2362 0 : convert_to_string(&tmp);
2363 0 : varname = &tmp;
2364 : }
2365 :
2366 18586 : if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
2367 5 : value = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 1 TSRMLS_CC);
2368 5 : if (!value) {
2369 1 : isset = 0;
2370 : }
2371 : } else {
2372 18581 : target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
2373 18581 : if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &value) == FAILURE) {
2374 17876 : isset = 0;
2375 : }
2376 : }
2377 :
2378 18586 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
2379 :
2380 18586 : switch (opline->extended_value) {
2381 : case ZEND_ISSET:
2382 17811 : if (isset && Z_TYPE_PP(value) == IS_NULL) {
2383 6 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0;
2384 : } else {
2385 17799 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = isset;
2386 : }
2387 17805 : break;
2388 : case ZEND_ISEMPTY:
2389 1257 : if (!isset || !i_zend_is_true(*value)) {
2390 476 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1;
2391 : } else {
2392 305 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 0;
2393 : }
2394 : break;
2395 : }
2396 :
2397 18586 : if (varname == &tmp) {
2398 0 : zval_dtor(&tmp);
2399 : }
2400 :
2401 18586 : ZEND_VM_NEXT_OPCODE();
2402 : }
2403 :
2404 : static int ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2405 433 : {
2406 : #if 0 || (IS_CONST != IS_UNUSED)
2407 433 : zend_op *opline = EX(opline);
2408 : if (IS_CONST != IS_UNUSED) {
2409 :
2410 433 : zval *ptr = &opline->op1.u.constant;
2411 :
2412 433 : if (Z_TYPE_P(ptr) == IS_LONG) {
2413 20 : EG(exit_status) = Z_LVAL_P(ptr);
2414 : } else {
2415 413 : zend_print_variable(ptr);
2416 : }
2417 :
2418 : }
2419 : #endif
2420 433 : zend_bailout();
2421 0 : ZEND_VM_NEXT_OPCODE();
2422 : }
2423 :
2424 : static int ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2425 352225 : {
2426 352225 : zend_op *opline = EX(opline);
2427 :
2428 352225 : zval *value = &opline->op1.u.constant;
2429 :
2430 352225 : EX_T(opline->result.u.var).tmp_var = *value;
2431 : if (!0) {
2432 352225 : zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
2433 : }
2434 :
2435 352225 : ZEND_VM_NEXT_OPCODE();
2436 : }
2437 :
2438 : static int ZEND_TICKS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2439 5 : {
2440 5 : zend_op *opline = EX(opline);
2441 :
2442 5 : if (++EG(ticks_count)>=Z_LVAL(opline->op1.u.constant)) {
2443 5 : EG(ticks_count)=0;
2444 5 : if (zend_ticks_function) {
2445 5 : zend_ticks_function(Z_LVAL(opline->op1.u.constant));
2446 : }
2447 : }
2448 5 : ZEND_VM_NEXT_OPCODE();
2449 : }
2450 :
2451 : static int ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2452 394 : {
2453 394 : zend_op *opline = EX(opline);
2454 :
2455 :
2456 394 : add_function(&EX_T(opline->result.u.var).tmp_var,
2457 : &opline->op1.u.constant,
2458 : &opline->op2.u.constant TSRMLS_CC);
2459 :
2460 :
2461 394 : ZEND_VM_NEXT_OPCODE();
2462 : }
2463 :
2464 : static int ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2465 119773 : {
2466 119773 : zend_op *opline = EX(opline);
2467 :
2468 :
2469 119773 : sub_function(&EX_T(opline->result.u.var).tmp_var,
2470 : &opline->op1.u.constant,
2471 : &opline->op2.u.constant TSRMLS_CC);
2472 :
2473 :
2474 119773 : ZEND_VM_NEXT_OPCODE();
2475 : }
2476 :
2477 : static int ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2478 12 : {
2479 12 : zend_op *opline = EX(opline);
2480 :
2481 :
2482 12 : mul_function(&EX_T(opline->result.u.var).tmp_var,
2483 : &opline->op1.u.constant,
2484 : &opline->op2.u.constant TSRMLS_CC);
2485 :
2486 :
2487 12 : ZEND_VM_NEXT_OPCODE();
2488 : }
2489 :
2490 : static int ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2491 22 : {
2492 22 : zend_op *opline = EX(opline);
2493 :
2494 :
2495 22 : div_function(&EX_T(opline->result.u.var).tmp_var,
2496 : &opline->op1.u.constant,
2497 : &opline->op2.u.constant TSRMLS_CC);
2498 :
2499 :
2500 22 : ZEND_VM_NEXT_OPCODE();
2501 : }
2502 :
2503 : static int ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2504 0 : {
2505 0 : zend_op *opline = EX(opline);
2506 :
2507 :
2508 0 : mod_function(&EX_T(opline->result.u.var).tmp_var,
2509 : &opline->op1.u.constant,
2510 : &opline->op2.u.constant TSRMLS_CC);
2511 :
2512 :
2513 0 : ZEND_VM_NEXT_OPCODE();
2514 : }
2515 :
2516 : static int ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2517 0 : {
2518 0 : zend_op *opline = EX(opline);
2519 :
2520 :
2521 0 : shift_left_function(&EX_T(opline->result.u.var).tmp_var,
2522 : &opline->op1.u.constant,
2523 : &opline->op2.u.constant TSRMLS_CC);
2524 :
2525 :
2526 0 : ZEND_VM_NEXT_OPCODE();
2527 : }
2528 :
2529 : static int ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2530 0 : {
2531 0 : zend_op *opline = EX(opline);
2532 :
2533 :
2534 0 : shift_right_function(&EX_T(opline->result.u.var).tmp_var,
2535 : &opline->op1.u.constant,
2536 : &opline->op2.u.constant TSRMLS_CC);
2537 :
2538 :
2539 0 : ZEND_VM_NEXT_OPCODE();
2540 : }
2541 :
2542 : static int ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2543 1592 : {
2544 1592 : zend_op *opline = EX(opline);
2545 :
2546 :
2547 1592 : concat_function(&EX_T(opline->result.u.var).tmp_var,
2548 : &opline->op1.u.constant,
2549 : &opline->op2.u.constant TSRMLS_CC);
2550 :
2551 :
2552 1592 : ZEND_VM_NEXT_OPCODE();
2553 : }
2554 :
2555 : static int ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2556 0 : {
2557 0 : zend_op *opline = EX(opline);
2558 :
2559 :
2560 0 : is_identical_function(&EX_T(opline->result.u.var).tmp_var,
2561 : &opline->op1.u.constant,
2562 : &opline->op2.u.constant TSRMLS_CC);
2563 :
2564 :
2565 0 : ZEND_VM_NEXT_OPCODE();
2566 : }
2567 :
2568 : static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2569 0 : {
2570 0 : zend_op *opline = EX(opline);
2571 :
2572 :
2573 0 : is_not_identical_function(&EX_T(opline->result.u.var).tmp_var,
2574 : &opline->op1.u.constant,
2575 : &opline->op2.u.constant TSRMLS_CC);
2576 :
2577 :
2578 0 : ZEND_VM_NEXT_OPCODE();
2579 : }
2580 :
2581 : static int ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2582 54 : {
2583 54 : zend_op *opline = EX(opline);
2584 :
2585 :
2586 54 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
2587 : &opline->op1.u.constant,
2588 : &opline->op2.u.constant TSRMLS_CC);
2589 :
2590 :
2591 54 : ZEND_VM_NEXT_OPCODE();
2592 : }
2593 :
2594 : static int ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2595 9 : {
2596 9 : zend_op *opline = EX(opline);
2597 :
2598 :
2599 9 : is_not_equal_function(&EX_T(opline->result.u.var).tmp_var,
2600 : &opline->op1.u.constant,
2601 : &opline->op2.u.constant TSRMLS_CC);
2602 :
2603 :
2604 9 : ZEND_VM_NEXT_OPCODE();
2605 : }
2606 :
2607 : static int ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2608 0 : {
2609 0 : zend_op *opline = EX(opline);
2610 :
2611 :
2612 0 : is_smaller_function(&EX_T(opline->result.u.var).tmp_var,
2613 : &opline->op1.u.constant,
2614 : &opline->op2.u.constant TSRMLS_CC);
2615 :
2616 :
2617 0 : ZEND_VM_NEXT_OPCODE();
2618 : }
2619 :
2620 : static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2621 0 : {
2622 0 : zend_op *opline = EX(opline);
2623 :
2624 :
2625 0 : is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var,
2626 : &opline->op1.u.constant,
2627 : &opline->op2.u.constant TSRMLS_CC);
2628 :
2629 :
2630 0 : ZEND_VM_NEXT_OPCODE();
2631 : }
2632 :
2633 : static int ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2634 0 : {
2635 0 : zend_op *opline = EX(opline);
2636 :
2637 :
2638 0 : bitwise_or_function(&EX_T(opline->result.u.var).tmp_var,
2639 : &opline->op1.u.constant,
2640 : &opline->op2.u.constant TSRMLS_CC);
2641 :
2642 :
2643 0 : ZEND_VM_NEXT_OPCODE();
2644 : }
2645 :
2646 : static int ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2647 0 : {
2648 0 : zend_op *opline = EX(opline);
2649 :
2650 :
2651 0 : bitwise_and_function(&EX_T(opline->result.u.var).tmp_var,
2652 : &opline->op1.u.constant,
2653 : &opline->op2.u.constant TSRMLS_CC);
2654 :
2655 :
2656 0 : ZEND_VM_NEXT_OPCODE();
2657 : }
2658 :
2659 : static int ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2660 0 : {
2661 0 : zend_op *opline = EX(opline);
2662 :
2663 :
2664 0 : bitwise_xor_function(&EX_T(opline->result.u.var).tmp_var,
2665 : &opline->op1.u.constant,
2666 : &opline->op2.u.constant TSRMLS_CC);
2667 :
2668 :
2669 0 : ZEND_VM_NEXT_OPCODE();
2670 : }
2671 :
2672 : static int ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2673 0 : {
2674 0 : zend_op *opline = EX(opline);
2675 :
2676 :
2677 0 : boolean_xor_function(&EX_T(opline->result.u.var).tmp_var,
2678 : &opline->op1.u.constant,
2679 : &opline->op2.u.constant TSRMLS_CC);
2680 :
2681 :
2682 0 : ZEND_VM_NEXT_OPCODE();
2683 : }
2684 :
2685 : static int ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2686 2 : {
2687 2 : zend_op *opline = EX(opline);
2688 :
2689 2 : zval *container = &opline->op1.u.constant;
2690 :
2691 2 : if (Z_TYPE_P(container) != IS_ARRAY) {
2692 2 : if (!RETURN_VALUE_UNUSED(&opline->result)) {
2693 2 : EX_T(opline->result.u.var).var.ptr_ptr = &EG(uninitialized_zval_ptr);
2694 2 : PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr);
2695 : }
2696 : } else {
2697 :
2698 0 : zval *dim = &opline->op2.u.constant;
2699 :
2700 0 : EX_T(opline->result.u.var).var.ptr_ptr = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, BP_VAR_R TSRMLS_CC);
2701 0 : SELECTIVE_PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &opline->result);
2702 :
2703 : }
2704 2 : AI_USE_PTR(EX_T(opline->result.u.var).var);
2705 2 : ZEND_VM_NEXT_OPCODE();
2706 : }
2707 :
2708 : static int ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2709 10 : {
2710 10 : zend_op *opline = EX(opline);
2711 10 : int switch_expr_is_overloaded=0;
2712 :
2713 :
2714 : if (IS_CONST==IS_VAR) {
2715 : if (EX_T(opline->op1.u.var).var.ptr_ptr) {
2716 : PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr);
2717 : } else {
2718 : switch_expr_is_overloaded = 1;
2719 : EX_T(opline->op1.u.var).str_offset.str->refcount++;
2720 : }
2721 : }
2722 10 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
2723 : &opline->op1.u.constant,
2724 : &opline->op2.u.constant TSRMLS_CC);
2725 :
2726 10 : if (switch_expr_is_overloaded) {
2727 : /* We only free op1 if this is a string offset,
2728 : * Since if it is a TMP_VAR, it'll be reused by
2729 : * other CASE opcodes (whereas string offsets
2730 : * are allocated at each get_zval_ptr())
2731 : */
2732 :
2733 0 : EX_T(opline->op1.u.var).var.ptr_ptr = NULL;
2734 0 : AI_USE_PTR(EX_T(opline->op1.u.var).var);
2735 : }
2736 10 : ZEND_VM_NEXT_OPCODE();
2737 : }
2738 :
2739 : static int ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2740 4628 : {
2741 4628 : zend_op *opline = EX(opline);
2742 4628 : zend_class_entry *ce = NULL;
2743 : zval **value;
2744 :
2745 : if (IS_CONST == IS_UNUSED) {
2746 : /* This seems to be a reminant of namespaces
2747 : if (EG(scope)) {
2748 : ce = EG(scope);
2749 : if (zend_hash_find(&ce->constants_table, Z_STRVAL(opline->op2.u.constant), Z_STRLEN(opline->op2.u.constant)+1, (void **) &value) == SUCCESS) {
2750 : zval_update_constant(value, (void *) 1 TSRMLS_CC);
2751 : EX_T(opline->result.u.var).tmp_var = **value;
2752 : zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
2753 : ZEND_VM_NEXT_OPCODE();
2754 : }
2755 : }
2756 : */
2757 : if (!zend_get_constant(opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len, &EX_T(opline->result.u.var).tmp_var TSRMLS_CC)) {
2758 : zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'",
2759 : opline->op2.u.constant.value.str.val,
2760 : opline->op2.u.constant.value.str.val);
2761 : EX_T(opline->result.u.var).tmp_var = opline->op2.u.constant;
2762 : zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
2763 : }
2764 : ZEND_VM_NEXT_OPCODE();
2765 : }
2766 :
2767 4628 : ce = EX_T(opline->op1.u.var).class_entry;
2768 :
2769 4628 : if (zend_hash_find(&ce->constants_table, opline->op2.u.constant.value.str.val, opline->op2.u.constant.value.str.len+1, (void **) &value) == SUCCESS) {
2770 4626 : zend_class_entry *old_scope = EG(scope);
2771 :
2772 4626 : EG(scope) = ce;
2773 4626 : zval_update_constant(value, (void *) 1 TSRMLS_CC);
2774 4624 : EG(scope) = old_scope;
2775 4624 : EX_T(opline->result.u.var).tmp_var = **value;
2776 4624 : zval_copy_ctor(&EX_T(opline->result.u.var).tmp_var);
2777 : } else {
2778 2 : zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", opline->op2.u.constant.value.str.val);
2779 : }
2780 :
2781 4624 : ZEND_VM_NEXT_OPCODE();
2782 : }
2783 :
2784 : static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2785 50997 : {
2786 50997 : zend_op *opline = EX(opline);
2787 :
2788 50997 : zval *array_ptr = &EX_T(opline->result.u.var).tmp_var;
2789 : zval *expr_ptr;
2790 50997 : zval *offset=&opline->op2.u.constant;
2791 :
2792 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
2793 : zval **expr_ptr_ptr = NULL;
2794 :
2795 : if (opline->extended_value) {
2796 : expr_ptr_ptr=NULL;
2797 : expr_ptr = *expr_ptr_ptr;
2798 : } else {
2799 : expr_ptr=&opline->op1.u.constant;
2800 : }
2801 : #else
2802 50997 : expr_ptr=&opline->op1.u.constant;
2803 : #endif
2804 :
2805 : if (0) { /* temporary variable */
2806 : zval *new_expr;
2807 :
2808 : ALLOC_ZVAL(new_expr);
2809 : INIT_PZVAL_COPY(new_expr, expr_ptr);
2810 : expr_ptr = new_expr;
2811 : } else {
2812 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
2813 : if (opline->extended_value) {
2814 : SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
2815 : expr_ptr = *expr_ptr_ptr;
2816 : expr_ptr->refcount++;
2817 : } else
2818 : #endif
2819 50997 : if (PZVAL_IS_REF(expr_ptr)) {
2820 : zval *new_expr;
2821 :
2822 50997 : ALLOC_ZVAL(new_expr);
2823 50997 : INIT_PZVAL_COPY(new_expr, expr_ptr);
2824 50997 : expr_ptr = new_expr;
2825 50997 : zendi_zval_copy_ctor(*expr_ptr);
2826 : } else {
2827 0 : expr_ptr->refcount++;
2828 : }
2829 : }
2830 50997 : if (offset) {
2831 50997 : switch (Z_TYPE_P(offset)) {
2832 : case IS_DOUBLE:
2833 228 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
2834 228 : break;
2835 : case IS_LONG:
2836 : case IS_BOOL:
2837 2206 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
2838 2206 : break;
2839 : case IS_STRING:
2840 48444 : zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL);
2841 48444 : break;
2842 : case IS_NULL:
2843 119 : zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
2844 119 : break;
2845 : default:
2846 0 : zend_error(E_WARNING, "Illegal offset type");
2847 0 : zval_ptr_dtor(&expr_ptr);
2848 : /* do nothing */
2849 : break;
2850 : }
2851 :
2852 : } else {
2853 0 : zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL);
2854 : }
2855 50997 : if (opline->extended_value) {
2856 :
2857 : } else {
2858 :
2859 : }
2860 50997 : ZEND_VM_NEXT_OPCODE();
2861 : }
2862 :
2863 : static int ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2864 26363 : {
2865 26363 : zend_op *opline = EX(opline);
2866 :
2867 26363 : array_init(&EX_T(opline->result.u.var).tmp_var);
2868 : if (IS_CONST == IS_UNUSED) {
2869 : ZEND_VM_NEXT_OPCODE();
2870 : #if 0 || IS_CONST != IS_UNUSED
2871 : } else {
2872 26363 : return ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
2873 : #endif
2874 : }
2875 : }
2876 :
2877 : static int ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2878 62168 : {
2879 62168 : zend_op *opline = EX(opline);
2880 : zend_free_op free_op2;
2881 :
2882 62168 : add_function(&EX_T(opline->result.u.var).tmp_var,
2883 : &opline->op1.u.constant,
2884 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2885 :
2886 62168 : zval_dtor(free_op2.var);
2887 62168 : ZEND_VM_NEXT_OPCODE();
2888 : }
2889 :
2890 : static int ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2891 48 : {
2892 48 : zend_op *opline = EX(opline);
2893 : zend_free_op free_op2;
2894 :
2895 48 : sub_function(&EX_T(opline->result.u.var).tmp_var,
2896 : &opline->op1.u.constant,
2897 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2898 :
2899 48 : zval_dtor(free_op2.var);
2900 48 : ZEND_VM_NEXT_OPCODE();
2901 : }
2902 :
2903 : static int ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2904 10 : {
2905 10 : zend_op *opline = EX(opline);
2906 : zend_free_op free_op2;
2907 :
2908 10 : mul_function(&EX_T(opline->result.u.var).tmp_var,
2909 : &opline->op1.u.constant,
2910 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2911 :
2912 10 : zval_dtor(free_op2.var);
2913 10 : ZEND_VM_NEXT_OPCODE();
2914 : }
2915 :
2916 : static int ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2917 2 : {
2918 2 : zend_op *opline = EX(opline);
2919 : zend_free_op free_op2;
2920 :
2921 2 : div_function(&EX_T(opline->result.u.var).tmp_var,
2922 : &opline->op1.u.constant,
2923 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2924 :
2925 2 : zval_dtor(free_op2.var);
2926 2 : ZEND_VM_NEXT_OPCODE();
2927 : }
2928 :
2929 : static int ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2930 0 : {
2931 0 : zend_op *opline = EX(opline);
2932 : zend_free_op free_op2;
2933 :
2934 0 : mod_function(&EX_T(opline->result.u.var).tmp_var,
2935 : &opline->op1.u.constant,
2936 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2937 :
2938 0 : zval_dtor(free_op2.var);
2939 0 : ZEND_VM_NEXT_OPCODE();
2940 : }
2941 :
2942 : static int ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2943 0 : {
2944 0 : zend_op *opline = EX(opline);
2945 : zend_free_op free_op2;
2946 :
2947 0 : shift_left_function(&EX_T(opline->result.u.var).tmp_var,
2948 : &opline->op1.u.constant,
2949 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2950 :
2951 0 : zval_dtor(free_op2.var);
2952 0 : ZEND_VM_NEXT_OPCODE();
2953 : }
2954 :
2955 : static int ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2956 0 : {
2957 0 : zend_op *opline = EX(opline);
2958 : zend_free_op free_op2;
2959 :
2960 0 : shift_right_function(&EX_T(opline->result.u.var).tmp_var,
2961 : &opline->op1.u.constant,
2962 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2963 :
2964 0 : zval_dtor(free_op2.var);
2965 0 : ZEND_VM_NEXT_OPCODE();
2966 : }
2967 :
2968 : static int ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2969 7034 : {
2970 7034 : zend_op *opline = EX(opline);
2971 : zend_free_op free_op2;
2972 :
2973 7034 : concat_function(&EX_T(opline->result.u.var).tmp_var,
2974 : &opline->op1.u.constant,
2975 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2976 :
2977 7034 : zval_dtor(free_op2.var);
2978 7034 : ZEND_VM_NEXT_OPCODE();
2979 : }
2980 :
2981 : static int ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2982 0 : {
2983 0 : zend_op *opline = EX(opline);
2984 : zend_free_op free_op2;
2985 :
2986 0 : is_identical_function(&EX_T(opline->result.u.var).tmp_var,
2987 : &opline->op1.u.constant,
2988 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
2989 :
2990 0 : zval_dtor(free_op2.var);
2991 0 : ZEND_VM_NEXT_OPCODE();
2992 : }
2993 :
2994 : static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2995 0 : {
2996 0 : zend_op *opline = EX(opline);
2997 : zend_free_op free_op2;
2998 :
2999 0 : is_not_identical_function(&EX_T(opline->result.u.var).tmp_var,
3000 : &opline->op1.u.constant,
3001 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3002 :
3003 0 : zval_dtor(free_op2.var);
3004 0 : ZEND_VM_NEXT_OPCODE();
3005 : }
3006 :
3007 : static int ZEND_IS_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3008 0 : {
3009 0 : zend_op *opline = EX(opline);
3010 : zend_free_op free_op2;
3011 :
3012 0 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
3013 : &opline->op1.u.constant,
3014 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3015 :
3016 0 : zval_dtor(free_op2.var);
3017 0 : ZEND_VM_NEXT_OPCODE();
3018 : }
3019 :
3020 : static int ZEND_IS_NOT_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3021 0 : {
3022 0 : zend_op *opline = EX(opline);
3023 : zend_free_op free_op2;
3024 :
3025 0 : is_not_equal_function(&EX_T(opline->result.u.var).tmp_var,
3026 : &opline->op1.u.constant,
3027 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3028 :
3029 0 : zval_dtor(free_op2.var);
3030 0 : ZEND_VM_NEXT_OPCODE();
3031 : }
3032 :
3033 : static int ZEND_IS_SMALLER_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3034 118375 : {
3035 118375 : zend_op *opline = EX(opline);
3036 : zend_free_op free_op2;
3037 :
3038 118375 : is_smaller_function(&EX_T(opline->result.u.var).tmp_var,
3039 : &opline->op1.u.constant,
3040 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3041 :
3042 118375 : zval_dtor(free_op2.var);
3043 118375 : ZEND_VM_NEXT_OPCODE();
3044 : }
3045 :
3046 : static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3047 376 : {
3048 376 : zend_op *opline = EX(opline);
3049 : zend_free_op free_op2;
3050 :
3051 376 : is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var,
3052 : &opline->op1.u.constant,
3053 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3054 :
3055 376 : zval_dtor(free_op2.var);
3056 376 : ZEND_VM_NEXT_OPCODE();
3057 : }
3058 :
3059 : static int ZEND_BW_OR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3060 39 : {
3061 39 : zend_op *opline = EX(opline);
3062 : zend_free_op free_op2;
3063 :
3064 39 : bitwise_or_function(&EX_T(opline->result.u.var).tmp_var,
3065 : &opline->op1.u.constant,
3066 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3067 :
3068 39 : zval_dtor(free_op2.var);
3069 39 : ZEND_VM_NEXT_OPCODE();
3070 : }
3071 :
3072 : static int ZEND_BW_AND_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3073 0 : {
3074 0 : zend_op *opline = EX(opline);
3075 : zend_free_op free_op2;
3076 :
3077 0 : bitwise_and_function(&EX_T(opline->result.u.var).tmp_var,
3078 : &opline->op1.u.constant,
3079 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3080 :
3081 0 : zval_dtor(free_op2.var);
3082 0 : ZEND_VM_NEXT_OPCODE();
3083 : }
3084 :
3085 : static int ZEND_BW_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3086 0 : {
3087 0 : zend_op *opline = EX(opline);
3088 : zend_free_op free_op2;
3089 :
3090 0 : bitwise_xor_function(&EX_T(opline->result.u.var).tmp_var,
3091 : &opline->op1.u.constant,
3092 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3093 :
3094 0 : zval_dtor(free_op2.var);
3095 0 : ZEND_VM_NEXT_OPCODE();
3096 : }
3097 :
3098 : static int ZEND_BOOL_XOR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3099 0 : {
3100 0 : zend_op *opline = EX(opline);
3101 : zend_free_op free_op2;
3102 :
3103 0 : boolean_xor_function(&EX_T(opline->result.u.var).tmp_var,
3104 : &opline->op1.u.constant,
3105 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3106 :
3107 0 : zval_dtor(free_op2.var);
3108 0 : ZEND_VM_NEXT_OPCODE();
3109 : }
3110 :
3111 : static int ZEND_CASE_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3112 0 : {
3113 0 : zend_op *opline = EX(opline);
3114 0 : int switch_expr_is_overloaded=0;
3115 : zend_free_op free_op2;
3116 :
3117 : if (IS_CONST==IS_VAR) {
3118 : if (EX_T(opline->op1.u.var).var.ptr_ptr) {
3119 : PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr);
3120 : } else {
3121 : switch_expr_is_overloaded = 1;
3122 : EX_T(opline->op1.u.var).str_offset.str->refcount++;
3123 : }
3124 : }
3125 0 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
3126 : &opline->op1.u.constant,
3127 : _get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3128 :
3129 0 : zval_dtor(free_op2.var);
3130 0 : if (switch_expr_is_overloaded) {
3131 : /* We only free op1 if this is a string offset,
3132 : * Since if it is a TMP_VAR, it'll be reused by
3133 : * other CASE opcodes (whereas string offsets
3134 : * are allocated at each get_zval_ptr())
3135 : */
3136 :
3137 0 : EX_T(opline->op1.u.var).var.ptr_ptr = NULL;
3138 0 : AI_USE_PTR(EX_T(opline->op1.u.var).var);
3139 : }
3140 0 : ZEND_VM_NEXT_OPCODE();
3141 : }
3142 :
3143 : static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3144 110 : {
3145 110 : zend_op *opline = EX(opline);
3146 : zend_free_op free_op2;
3147 110 : zval *array_ptr = &EX_T(opline->result.u.var).tmp_var;
3148 : zval *expr_ptr;
3149 110 : zval *offset=_get_zval_ptr_tmp(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
3150 :
3151 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3152 : zval **expr_ptr_ptr = NULL;
3153 :
3154 : if (opline->extended_value) {
3155 : expr_ptr_ptr=NULL;
3156 : expr_ptr = *expr_ptr_ptr;
3157 : } else {
3158 : expr_ptr=&opline->op1.u.constant;
3159 : }
3160 : #else
3161 110 : expr_ptr=&opline->op1.u.constant;
3162 : #endif
3163 :
3164 : if (0) { /* temporary variable */
3165 : zval *new_expr;
3166 :
3167 : ALLOC_ZVAL(new_expr);
3168 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3169 : expr_ptr = new_expr;
3170 : } else {
3171 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3172 : if (opline->extended_value) {
3173 : SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
3174 : expr_ptr = *expr_ptr_ptr;
3175 : expr_ptr->refcount++;
3176 : } else
3177 : #endif
3178 110 : if (PZVAL_IS_REF(expr_ptr)) {
3179 : zval *new_expr;
3180 :
3181 110 : ALLOC_ZVAL(new_expr);
3182 110 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3183 110 : expr_ptr = new_expr;
3184 110 : zendi_zval_copy_ctor(*expr_ptr);
3185 : } else {
3186 0 : expr_ptr->refcount++;
3187 : }
3188 : }
3189 110 : if (offset) {
3190 110 : switch (Z_TYPE_P(offset)) {
3191 : case IS_DOUBLE:
3192 20 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
3193 20 : break;
3194 : case IS_LONG:
3195 : case IS_BOOL:
3196 81 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
3197 81 : break;
3198 : case IS_STRING:
3199 9 : zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL);
3200 9 : break;
3201 : case IS_NULL:
3202 0 : zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
3203 0 : break;
3204 : default:
3205 0 : zend_error(E_WARNING, "Illegal offset type");
3206 0 : zval_ptr_dtor(&expr_ptr);
3207 : /* do nothing */
3208 : break;
3209 : }
3210 110 : zval_dtor(free_op2.var);
3211 : } else {
3212 0 : zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL);
3213 : }
3214 110 : if (opline->extended_value) {
3215 :
3216 : } else {
3217 :
3218 : }
3219 110 : ZEND_VM_NEXT_OPCODE();
3220 : }
3221 :
3222 : static int ZEND_INIT_ARRAY_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3223 37 : {
3224 37 : zend_op *opline = EX(opline);
3225 :
3226 37 : array_init(&EX_T(opline->result.u.var).tmp_var);
3227 : if (IS_CONST == IS_UNUSED) {
3228 : ZEND_VM_NEXT_OPCODE();
3229 : #if 0 || IS_CONST != IS_UNUSED
3230 : } else {
3231 37 : return ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3232 : #endif
3233 : }
3234 : }
3235 :
3236 : static int ZEND_ADD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3237 1 : {
3238 1 : zend_op *opline = EX(opline);
3239 : zend_free_op free_op2;
3240 :
3241 1 : add_function(&EX_T(opline->result.u.var).tmp_var,
3242 : &opline->op1.u.constant,
3243 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3244 :
3245 1 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3246 1 : ZEND_VM_NEXT_OPCODE();
3247 : }
3248 :
3249 : static int ZEND_SUB_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3250 2186 : {
3251 2186 : zend_op *opline = EX(opline);
3252 : zend_free_op free_op2;
3253 :
3254 2186 : sub_function(&EX_T(opline->result.u.var).tmp_var,
3255 : &opline->op1.u.constant,
3256 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3257 :
3258 2186 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3259 2186 : ZEND_VM_NEXT_OPCODE();
3260 : }
3261 :
3262 : static int ZEND_MUL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3263 15 : {
3264 15 : zend_op *opline = EX(opline);
3265 : zend_free_op free_op2;
3266 :
3267 15 : mul_function(&EX_T(opline->result.u.var).tmp_var,
3268 : &opline->op1.u.constant,
3269 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3270 :
3271 15 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3272 15 : ZEND_VM_NEXT_OPCODE();
3273 : }
3274 :
3275 : static int ZEND_DIV_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3276 0 : {
3277 0 : zend_op *opline = EX(opline);
3278 : zend_free_op free_op2;
3279 :
3280 0 : div_function(&EX_T(opline->result.u.var).tmp_var,
3281 : &opline->op1.u.constant,
3282 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3283 :
3284 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3285 0 : ZEND_VM_NEXT_OPCODE();
3286 : }
3287 :
3288 : static int ZEND_MOD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3289 0 : {
3290 0 : zend_op *opline = EX(opline);
3291 : zend_free_op free_op2;
3292 :
3293 0 : mod_function(&EX_T(opline->result.u.var).tmp_var,
3294 : &opline->op1.u.constant,
3295 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3296 :
3297 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3298 0 : ZEND_VM_NEXT_OPCODE();
3299 : }
3300 :
3301 : static int ZEND_SL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3302 0 : {
3303 0 : zend_op *opline = EX(opline);
3304 : zend_free_op free_op2;
3305 :
3306 0 : shift_left_function(&EX_T(opline->result.u.var).tmp_var,
3307 : &opline->op1.u.constant,
3308 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3309 :
3310 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3311 0 : ZEND_VM_NEXT_OPCODE();
3312 : }
3313 :
3314 : static int ZEND_SR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3315 0 : {
3316 0 : zend_op *opline = EX(opline);
3317 : zend_free_op free_op2;
3318 :
3319 0 : shift_right_function(&EX_T(opline->result.u.var).tmp_var,
3320 : &opline->op1.u.constant,
3321 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3322 :
3323 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3324 0 : ZEND_VM_NEXT_OPCODE();
3325 : }
3326 :
3327 : static int ZEND_CONCAT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3328 3365 : {
3329 3365 : zend_op *opline = EX(opline);
3330 : zend_free_op free_op2;
3331 :
3332 3365 : concat_function(&EX_T(opline->result.u.var).tmp_var,
3333 : &opline->op1.u.constant,
3334 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3335 :
3336 3365 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3337 3365 : ZEND_VM_NEXT_OPCODE();
3338 : }
3339 :
3340 : static int ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3341 33 : {
3342 33 : zend_op *opline = EX(opline);
3343 : zend_free_op free_op2;
3344 :
3345 33 : is_identical_function(&EX_T(opline->result.u.var).tmp_var,
3346 : &opline->op1.u.constant,
3347 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3348 :
3349 33 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3350 33 : ZEND_VM_NEXT_OPCODE();
3351 : }
3352 :
3353 : static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3354 1038 : {
3355 1038 : zend_op *opline = EX(opline);
3356 : zend_free_op free_op2;
3357 :
3358 1038 : is_not_identical_function(&EX_T(opline->result.u.var).tmp_var,
3359 : &opline->op1.u.constant,
3360 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3361 :
3362 1038 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3363 1038 : ZEND_VM_NEXT_OPCODE();
3364 : }
3365 :
3366 : static int ZEND_IS_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3367 443 : {
3368 443 : zend_op *opline = EX(opline);
3369 : zend_free_op free_op2;
3370 :
3371 443 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
3372 : &opline->op1.u.constant,
3373 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3374 :
3375 443 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3376 443 : ZEND_VM_NEXT_OPCODE();
3377 : }
3378 :
3379 : static int ZEND_IS_NOT_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3380 0 : {
3381 0 : zend_op *opline = EX(opline);
3382 : zend_free_op free_op2;
3383 :
3384 0 : is_not_equal_function(&EX_T(opline->result.u.var).tmp_var,
3385 : &opline->op1.u.constant,
3386 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3387 :
3388 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3389 0 : ZEND_VM_NEXT_OPCODE();
3390 : }
3391 :
3392 : static int ZEND_IS_SMALLER_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3393 90902 : {
3394 90902 : zend_op *opline = EX(opline);
3395 : zend_free_op free_op2;
3396 :
3397 90902 : is_smaller_function(&EX_T(opline->result.u.var).tmp_var,
3398 : &opline->op1.u.constant,
3399 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3400 :
3401 90902 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3402 90902 : ZEND_VM_NEXT_OPCODE();
3403 : }
3404 :
3405 : static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3406 23 : {
3407 23 : zend_op *opline = EX(opline);
3408 : zend_free_op free_op2;
3409 :
3410 23 : is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var,
3411 : &opline->op1.u.constant,
3412 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3413 :
3414 23 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3415 23 : ZEND_VM_NEXT_OPCODE();
3416 : }
3417 :
3418 : static int ZEND_BW_OR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3419 0 : {
3420 0 : zend_op *opline = EX(opline);
3421 : zend_free_op free_op2;
3422 :
3423 0 : bitwise_or_function(&EX_T(opline->result.u.var).tmp_var,
3424 : &opline->op1.u.constant,
3425 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3426 :
3427 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3428 0 : ZEND_VM_NEXT_OPCODE();
3429 : }
3430 :
3431 : static int ZEND_BW_AND_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3432 1 : {
3433 1 : zend_op *opline = EX(opline);
3434 : zend_free_op free_op2;
3435 :
3436 1 : bitwise_and_function(&EX_T(opline->result.u.var).tmp_var,
3437 : &opline->op1.u.constant,
3438 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3439 :
3440 1 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3441 1 : ZEND_VM_NEXT_OPCODE();
3442 : }
3443 :
3444 : static int ZEND_BW_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3445 0 : {
3446 0 : zend_op *opline = EX(opline);
3447 : zend_free_op free_op2;
3448 :
3449 0 : bitwise_xor_function(&EX_T(opline->result.u.var).tmp_var,
3450 : &opline->op1.u.constant,
3451 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3452 :
3453 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3454 0 : ZEND_VM_NEXT_OPCODE();
3455 : }
3456 :
3457 : static int ZEND_BOOL_XOR_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3458 0 : {
3459 0 : zend_op *opline = EX(opline);
3460 : zend_free_op free_op2;
3461 :
3462 0 : boolean_xor_function(&EX_T(opline->result.u.var).tmp_var,
3463 : &opline->op1.u.constant,
3464 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3465 :
3466 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3467 0 : ZEND_VM_NEXT_OPCODE();
3468 : }
3469 :
3470 : static int ZEND_CASE_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3471 0 : {
3472 0 : zend_op *opline = EX(opline);
3473 0 : int switch_expr_is_overloaded=0;
3474 : zend_free_op free_op2;
3475 :
3476 : if (IS_CONST==IS_VAR) {
3477 : if (EX_T(opline->op1.u.var).var.ptr_ptr) {
3478 : PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr);
3479 : } else {
3480 : switch_expr_is_overloaded = 1;
3481 : EX_T(opline->op1.u.var).str_offset.str->refcount++;
3482 : }
3483 : }
3484 0 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
3485 : &opline->op1.u.constant,
3486 : _get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC) TSRMLS_CC);
3487 :
3488 0 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3489 0 : if (switch_expr_is_overloaded) {
3490 : /* We only free op1 if this is a string offset,
3491 : * Since if it is a TMP_VAR, it'll be reused by
3492 : * other CASE opcodes (whereas string offsets
3493 : * are allocated at each get_zval_ptr())
3494 : */
3495 :
3496 0 : EX_T(opline->op1.u.var).var.ptr_ptr = NULL;
3497 0 : AI_USE_PTR(EX_T(opline->op1.u.var).var);
3498 : }
3499 0 : ZEND_VM_NEXT_OPCODE();
3500 : }
3501 :
3502 : static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3503 56 : {
3504 56 : zend_op *opline = EX(opline);
3505 : zend_free_op free_op2;
3506 56 : zval *array_ptr = &EX_T(opline->result.u.var).tmp_var;
3507 : zval *expr_ptr;
3508 56 : zval *offset=_get_zval_ptr_var(&opline->op2, EX(Ts), &free_op2 TSRMLS_CC);
3509 :
3510 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3511 : zval **expr_ptr_ptr = NULL;
3512 :
3513 : if (opline->extended_value) {
3514 : expr_ptr_ptr=NULL;
3515 : expr_ptr = *expr_ptr_ptr;
3516 : } else {
3517 : expr_ptr=&opline->op1.u.constant;
3518 : }
3519 : #else
3520 56 : expr_ptr=&opline->op1.u.constant;
3521 : #endif
3522 :
3523 : if (0) { /* temporary variable */
3524 : zval *new_expr;
3525 :
3526 : ALLOC_ZVAL(new_expr);
3527 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3528 : expr_ptr = new_expr;
3529 : } else {
3530 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3531 : if (opline->extended_value) {
3532 : SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
3533 : expr_ptr = *expr_ptr_ptr;
3534 : expr_ptr->refcount++;
3535 : } else
3536 : #endif
3537 56 : if (PZVAL_IS_REF(expr_ptr)) {
3538 : zval *new_expr;
3539 :
3540 56 : ALLOC_ZVAL(new_expr);
3541 56 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3542 56 : expr_ptr = new_expr;
3543 56 : zendi_zval_copy_ctor(*expr_ptr);
3544 : } else {
3545 0 : expr_ptr->refcount++;
3546 : }
3547 : }
3548 56 : if (offset) {
3549 56 : switch (Z_TYPE_P(offset)) {
3550 : case IS_DOUBLE:
3551 0 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
3552 0 : break;
3553 : case IS_LONG:
3554 : case IS_BOOL:
3555 0 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
3556 0 : break;
3557 : case IS_STRING:
3558 0 : zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL);
3559 0 : break;
3560 : case IS_NULL:
3561 45 : zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
3562 45 : break;
3563 : default:
3564 11 : zend_error(E_WARNING, "Illegal offset type");
3565 11 : zval_ptr_dtor(&expr_ptr);
3566 : /* do nothing */
3567 : break;
3568 : }
3569 56 : if (free_op2.var) {zval_ptr_dtor(&free_op2.var);};
3570 : } else {
3571 0 : zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL);
3572 : }
3573 56 : if (opline->extended_value) {
3574 :
3575 : } else {
3576 :
3577 : }
3578 56 : ZEND_VM_NEXT_OPCODE();
3579 : }
3580 :
3581 : static int ZEND_INIT_ARRAY_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3582 38 : {
3583 38 : zend_op *opline = EX(opline);
3584 :
3585 38 : array_init(&EX_T(opline->result.u.var).tmp_var);
3586 : if (IS_CONST == IS_UNUSED) {
3587 : ZEND_VM_NEXT_OPCODE();
3588 : #if 0 || IS_CONST != IS_UNUSED
3589 : } else {
3590 38 : return ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3591 : #endif
3592 : }
3593 : }
3594 :
3595 : static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3596 278296 : {
3597 278296 : zend_op *opline = EX(opline);
3598 :
3599 278296 : zval *array_ptr = &EX_T(opline->result.u.var).tmp_var;
3600 : zval *expr_ptr;
3601 278296 : zval *offset=NULL;
3602 :
3603 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3604 : zval **expr_ptr_ptr = NULL;
3605 :
3606 : if (opline->extended_value) {
3607 : expr_ptr_ptr=NULL;
3608 : expr_ptr = *expr_ptr_ptr;
3609 : } else {
3610 : expr_ptr=&opline->op1.u.constant;
3611 : }
3612 : #else
3613 278296 : expr_ptr=&opline->op1.u.constant;
3614 : #endif
3615 :
3616 : if (0) { /* temporary variable */
3617 : zval *new_expr;
3618 :
3619 : ALLOC_ZVAL(new_expr);
3620 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3621 : expr_ptr = new_expr;
3622 : } else {
3623 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3624 : if (opline->extended_value) {
3625 : SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
3626 : expr_ptr = *expr_ptr_ptr;
3627 : expr_ptr->refcount++;
3628 : } else
3629 : #endif
3630 278296 : if (PZVAL_IS_REF(expr_ptr)) {
3631 : zval *new_expr;
3632 :
3633 278296 : ALLOC_ZVAL(new_expr);
3634 278296 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3635 278296 : expr_ptr = new_expr;
3636 278296 : zendi_zval_copy_ctor(*expr_ptr);
3637 : } else {
3638 0 : expr_ptr->refcount++;
3639 : }
3640 : }
3641 278296 : if (offset) {
3642 0 : switch (Z_TYPE_P(offset)) {
3643 : case IS_DOUBLE:
3644 0 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
3645 0 : break;
3646 : case IS_LONG:
3647 : case IS_BOOL:
3648 0 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
3649 0 : break;
3650 : case IS_STRING:
3651 0 : zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL);
3652 0 : break;
3653 : case IS_NULL:
3654 0 : zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
3655 0 : break;
3656 : default:
3657 0 : zend_error(E_WARNING, "Illegal offset type");
3658 0 : zval_ptr_dtor(&expr_ptr);
3659 : /* do nothing */
3660 : break;
3661 : }
3662 :
3663 : } else {
3664 278296 : zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL);
3665 : }
3666 278296 : if (opline->extended_value) {
3667 :
3668 : } else {
3669 :
3670 : }
3671 278296 : ZEND_VM_NEXT_OPCODE();
3672 : }
3673 :
3674 : static int ZEND_INIT_ARRAY_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3675 182437 : {
3676 182437 : zend_op *opline = EX(opline);
3677 :
3678 182437 : array_init(&EX_T(opline->result.u.var).tmp_var);
3679 : if (IS_CONST == IS_UNUSED) {
3680 : ZEND_VM_NEXT_OPCODE();
3681 : #if 0 || IS_CONST != IS_UNUSED
3682 : } else {
3683 182437 : return ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3684 : #endif
3685 : }
3686 : }
3687 :
3688 : static int ZEND_ADD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3689 52 : {
3690 52 : zend_op *opline = EX(opline);
3691 :
3692 :
3693 52 : add_function(&EX_T(opline->result.u.var).tmp_var,
3694 : &opline->op1.u.constant,
3695 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3696 :
3697 :
3698 52 : ZEND_VM_NEXT_OPCODE();
3699 : }
3700 :
3701 : static int ZEND_SUB_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3702 104 : {
3703 104 : zend_op *opline = EX(opline);
3704 :
3705 :
3706 104 : sub_function(&EX_T(opline->result.u.var).tmp_var,
3707 : &opline->op1.u.constant,
3708 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3709 :
3710 :
3711 104 : ZEND_VM_NEXT_OPCODE();
3712 : }
3713 :
3714 : static int ZEND_MUL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3715 2111 : {
3716 2111 : zend_op *opline = EX(opline);
3717 :
3718 :
3719 2111 : mul_function(&EX_T(opline->result.u.var).tmp_var,
3720 : &opline->op1.u.constant,
3721 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3722 :
3723 :
3724 2111 : ZEND_VM_NEXT_OPCODE();
3725 : }
3726 :
3727 : static int ZEND_DIV_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3728 0 : {
3729 0 : zend_op *opline = EX(opline);
3730 :
3731 :
3732 0 : div_function(&EX_T(opline->result.u.var).tmp_var,
3733 : &opline->op1.u.constant,
3734 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3735 :
3736 :
3737 0 : ZEND_VM_NEXT_OPCODE();
3738 : }
3739 :
3740 : static int ZEND_MOD_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3741 0 : {
3742 0 : zend_op *opline = EX(opline);
3743 :
3744 :
3745 0 : mod_function(&EX_T(opline->result.u.var).tmp_var,
3746 : &opline->op1.u.constant,
3747 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3748 :
3749 :
3750 0 : ZEND_VM_NEXT_OPCODE();
3751 : }
3752 :
3753 : static int ZEND_SL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3754 0 : {
3755 0 : zend_op *opline = EX(opline);
3756 :
3757 :
3758 0 : shift_left_function(&EX_T(opline->result.u.var).tmp_var,
3759 : &opline->op1.u.constant,
3760 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3761 :
3762 :
3763 0 : ZEND_VM_NEXT_OPCODE();
3764 : }
3765 :
3766 : static int ZEND_SR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3767 0 : {
3768 0 : zend_op *opline = EX(opline);
3769 :
3770 :
3771 0 : shift_right_function(&EX_T(opline->result.u.var).tmp_var,
3772 : &opline->op1.u.constant,
3773 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3774 :
3775 :
3776 0 : ZEND_VM_NEXT_OPCODE();
3777 : }
3778 :
3779 : static int ZEND_CONCAT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3780 4329 : {
3781 4329 : zend_op *opline = EX(opline);
3782 :
3783 :
3784 4329 : concat_function(&EX_T(opline->result.u.var).tmp_var,
3785 : &opline->op1.u.constant,
3786 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3787 :
3788 :
3789 4329 : ZEND_VM_NEXT_OPCODE();
3790 : }
3791 :
3792 : static int ZEND_IS_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3793 31 : {
3794 31 : zend_op *opline = EX(opline);
3795 :
3796 :
3797 31 : is_identical_function(&EX_T(opline->result.u.var).tmp_var,
3798 : &opline->op1.u.constant,
3799 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3800 :
3801 :
3802 31 : ZEND_VM_NEXT_OPCODE();
3803 : }
3804 :
3805 : static int ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3806 226 : {
3807 226 : zend_op *opline = EX(opline);
3808 :
3809 :
3810 226 : is_not_identical_function(&EX_T(opline->result.u.var).tmp_var,
3811 : &opline->op1.u.constant,
3812 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3813 :
3814 :
3815 226 : ZEND_VM_NEXT_OPCODE();
3816 : }
3817 :
3818 : static int ZEND_IS_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3819 301 : {
3820 301 : zend_op *opline = EX(opline);
3821 :
3822 :
3823 301 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
3824 : &opline->op1.u.constant,
3825 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3826 :
3827 :
3828 301 : ZEND_VM_NEXT_OPCODE();
3829 : }
3830 :
3831 : static int ZEND_IS_NOT_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3832 13 : {
3833 13 : zend_op *opline = EX(opline);
3834 :
3835 :
3836 13 : is_not_equal_function(&EX_T(opline->result.u.var).tmp_var,
3837 : &opline->op1.u.constant,
3838 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3839 :
3840 :
3841 13 : ZEND_VM_NEXT_OPCODE();
3842 : }
3843 :
3844 : static int ZEND_IS_SMALLER_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3845 696168 : {
3846 696168 : zend_op *opline = EX(opline);
3847 :
3848 :
3849 696168 : is_smaller_function(&EX_T(opline->result.u.var).tmp_var,
3850 : &opline->op1.u.constant,
3851 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3852 :
3853 :
3854 696168 : ZEND_VM_NEXT_OPCODE();
3855 : }
3856 :
3857 : static int ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3858 15162 : {
3859 15162 : zend_op *opline = EX(opline);
3860 :
3861 :
3862 15162 : is_smaller_or_equal_function(&EX_T(opline->result.u.var).tmp_var,
3863 : &opline->op1.u.constant,
3864 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3865 :
3866 :
3867 15162 : ZEND_VM_NEXT_OPCODE();
3868 : }
3869 :
3870 : static int ZEND_BW_OR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3871 0 : {
3872 0 : zend_op *opline = EX(opline);
3873 :
3874 :
3875 0 : bitwise_or_function(&EX_T(opline->result.u.var).tmp_var,
3876 : &opline->op1.u.constant,
3877 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3878 :
3879 :
3880 0 : ZEND_VM_NEXT_OPCODE();
3881 : }
3882 :
3883 : static int ZEND_BW_AND_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3884 0 : {
3885 0 : zend_op *opline = EX(opline);
3886 :
3887 :
3888 0 : bitwise_and_function(&EX_T(opline->result.u.var).tmp_var,
3889 : &opline->op1.u.constant,
3890 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3891 :
3892 :
3893 0 : ZEND_VM_NEXT_OPCODE();
3894 : }
3895 :
3896 : static int ZEND_BW_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3897 0 : {
3898 0 : zend_op *opline = EX(opline);
3899 :
3900 :
3901 0 : bitwise_xor_function(&EX_T(opline->result.u.var).tmp_var,
3902 : &opline->op1.u.constant,
3903 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3904 :
3905 :
3906 0 : ZEND_VM_NEXT_OPCODE();
3907 : }
3908 :
3909 : static int ZEND_BOOL_XOR_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3910 0 : {
3911 0 : zend_op *opline = EX(opline);
3912 :
3913 :
3914 0 : boolean_xor_function(&EX_T(opline->result.u.var).tmp_var,
3915 : &opline->op1.u.constant,
3916 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3917 :
3918 :
3919 0 : ZEND_VM_NEXT_OPCODE();
3920 : }
3921 :
3922 : static int ZEND_CASE_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3923 0 : {
3924 0 : zend_op *opline = EX(opline);
3925 0 : int switch_expr_is_overloaded=0;
3926 :
3927 :
3928 : if (IS_CONST==IS_VAR) {
3929 : if (EX_T(opline->op1.u.var).var.ptr_ptr) {
3930 : PZVAL_LOCK(EX_T(opline->op1.u.var).var.ptr);
3931 : } else {
3932 : switch_expr_is_overloaded = 1;
3933 : EX_T(opline->op1.u.var).str_offset.str->refcount++;
3934 : }
3935 : }
3936 0 : is_equal_function(&EX_T(opline->result.u.var).tmp_var,
3937 : &opline->op1.u.constant,
3938 : _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC) TSRMLS_CC);
3939 :
3940 0 : if (switch_expr_is_overloaded) {
3941 : /* We only free op1 if this is a string offset,
3942 : * Since if it is a TMP_VAR, it'll be reused by
3943 : * other CASE opcodes (whereas string offsets
3944 : * are allocated at each get_zval_ptr())
3945 : */
3946 :
3947 0 : EX_T(opline->op1.u.var).var.ptr_ptr = NULL;
3948 0 : AI_USE_PTR(EX_T(opline->op1.u.var).var);
3949 : }
3950 0 : ZEND_VM_NEXT_OPCODE();
3951 : }
3952 :
3953 : static int ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3954 65 : {
3955 65 : zend_op *opline = EX(opline);
3956 :
3957 65 : zval *array_ptr = &EX_T(opline->result.u.var).tmp_var;
3958 : zval *expr_ptr;
3959 65 : zval *offset=_get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC);
3960 :
3961 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3962 : zval **expr_ptr_ptr = NULL;
3963 :
3964 : if (opline->extended_value) {
3965 : expr_ptr_ptr=NULL;
3966 : expr_ptr = *expr_ptr_ptr;
3967 : } else {
3968 : expr_ptr=&opline->op1.u.constant;
3969 : }
3970 : #else
3971 65 : expr_ptr=&opline->op1.u.constant;
3972 : #endif
3973 :
3974 : if (0) { /* temporary variable */
3975 : zval *new_expr;
3976 :
3977 : ALLOC_ZVAL(new_expr);
3978 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3979 : expr_ptr = new_expr;
3980 : } else {
3981 : #if 0 || IS_CONST == IS_VAR || IS_CONST == IS_CV
3982 : if (opline->extended_value) {
3983 : SEPARATE_ZVAL_TO_MAKE_IS_REF(expr_ptr_ptr);
3984 : expr_ptr = *expr_ptr_ptr;
3985 : expr_ptr->refcount++;
3986 : } else
3987 : #endif
3988 65 : if (PZVAL_IS_REF(expr_ptr)) {
3989 : zval *new_expr;
3990 :
3991 65 : ALLOC_ZVAL(new_expr);
3992 65 : INIT_PZVAL_COPY(new_expr, expr_ptr);
3993 65 : expr_ptr = new_expr;
3994 65 : zendi_zval_copy_ctor(*expr_ptr);
3995 : } else {
3996 0 : expr_ptr->refcount++;
3997 : }
3998 : }
3999 65 : if (offset) {
4000 65 : switch (Z_TYPE_P(offset)) {
4001 : case IS_DOUBLE:
4002 0 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), (long) Z_DVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
4003 0 : break;
4004 : case IS_LONG:
4005 : case IS_BOOL:
4006 0 : zend_hash_index_update(Z_ARRVAL_P(array_ptr), Z_LVAL_P(offset), &expr_ptr, sizeof(zval *), NULL);
4007 0 : break;
4008 : case IS_STRING:
4009 55 : zend_symtable_update(Z_ARRVAL_P(array_ptr), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, &expr_ptr, sizeof(zval *), NULL);
4010 55 : break;
4011 : case IS_NULL:
4012 0 : zend_hash_update(Z_ARRVAL_P(array_ptr), "", sizeof(""), &expr_ptr, sizeof(zval *), NULL);
4013 0 : break;
4014 : default:
4015 10 : zend_error(E_WARNING, "Illegal offset type");
4016 10 : zval_ptr_dtor(&expr_ptr);
4017 : /* do nothing */
4018 : break;
4019 : }
4020 :
4021 : } else {
4022 0 : zend_hash_next_index_insert(Z_ARRVAL_P(array_ptr), &expr_ptr, sizeof(zval *), NULL);
4023 : }
4024 65 : if (opline->extended_value) {
4025 :
4026 : } else {
4027 :
4028 : }
4029 65 : ZEND_VM_NEXT_OPCODE();
4030 : }
4031 :
4032 : static int ZEND_INIT_ARRAY_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4033 5 : {
4034 5 : zend_op *opline = EX(opline);
4035 :
4036 5 : array_init(&EX_T(opline->result.u.var).tmp_var);
4037 : if (IS_CONST == IS_UNUSED) {
4038 : ZEND_VM_NEXT_OPCODE();
4039 : #if 0 || IS_CONST != IS_UNUSED
4040 : } else {
4041 5 : return ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4042 : #endif
4043 : }
4044 : }
4045 :
4046 : static int ZEND_BW_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4047 76 : {
4048 76 : zend_op *opline = EX(opline);
4049 : zend_free_op free_op1;
4050 :
4051 76 : bitwise_not_function(&EX_T(opline->result.u.var).tmp_var,
4052 : _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC) TSRMLS_CC);
4053 76 : zval_dtor(free_op1.var);
4054 76 : ZEND_VM_NEXT_OPCODE();
4055 : }
4056 :
4057 : static int ZEND_BOOL_NOT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4058 56955 : {
4059 56955 : zend_op *opline = EX(opline);
4060 : zend_free_op free_op1;
4061 :
4062 56955 : boolean_not_function(&EX_T(opline->result.u.var).tmp_var,
4063 : _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC) TSRMLS_CC);
4064 56955 : zval_dtor(free_op1.var);
4065 56955 : ZEND_VM_NEXT_OPCODE();
4066 : }
4067 :
4068 : static int ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4069 98406 : {
4070 98406 : zend_op *opline = EX(opline);
4071 : zend_free_op free_op1;
4072 : zval z_copy;
4073 98406 : zval *z = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4074 :
4075 98406 : if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get_method != NULL &&
4076 : zend_std_cast_object_tostring(z, &z_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
4077 0 : zend_print_variable(&z_copy);
4078 0 : zval_dtor(&z_copy);
4079 : } else {
4080 98406 : zend_print_variable(z);
4081 : }
4082 :
4083 98405 : zval_dtor(free_op1.var);
4084 98405 : ZEND_VM_NEXT_OPCODE();
4085 : }
4086 :
4087 : static int ZEND_PRINT_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4088 7732 : {
4089 7732 : zend_op *opline = EX(opline);
4090 :
4091 7732 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = 1;
4092 7732 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_LONG;
4093 :
4094 7732 : return ZEND_ECHO_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4095 : }
4096 :
4097 : static int zend_fetch_var_address_helper_SPEC_TMP(int type, ZEND_OPCODE_HANDLER_ARGS)
4098 2754 : {
4099 2754 : zend_op *opline = EX(opline);
4100 : zend_free_op free_op1;
4101 2754 : zval *varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4102 : zval **retval;
4103 : zval tmp_varname;
4104 : HashTable *target_symbol_table;
4105 :
4106 2754 : if (Z_TYPE_P(varname) != IS_STRING) {
4107 0 : tmp_varname = *varname;
4108 0 : zval_copy_ctor(&tmp_varname);
4109 0 : convert_to_string(&tmp_varname);
4110 0 : varname = &tmp_varname;
4111 : }
4112 :
4113 2754 : if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
4114 0 : retval = zend_std_get_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname), 0 TSRMLS_CC);
4115 0 : zval_dtor(free_op1.var);
4116 : } else {
4117 2754 : target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), type, varname TSRMLS_CC);
4118 : /*
4119 : if (!target_symbol_table) {
4120 : ZEND_VM_NEXT_OPCODE();
4121 : }
4122 : */
4123 2754 : if (zend_hash_find(target_symbol_table, varname->value.str.val, varname->value.str.len+1, (void **) &retval) == FAILURE) {
4124 18 : switch (type) {
4125 : case BP_VAR_R:
4126 : case BP_VAR_UNSET:
4127 0 : zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
4128 : /* break missing intentionally */
4129 : case BP_VAR_IS:
4130 0 : retval = &EG(uninitialized_zval_ptr);
4131 0 : break;
4132 : case BP_VAR_RW:
4133 0 : zend_error(E_NOTICE,"Undefined variable: %s", Z_STRVAL_P(varname));
4134 : /* break missing intentionally */
4135 : case BP_VAR_W: {
4136 18 : zval *new_zval = &EG(uninitialized_zval);
4137 :
4138 18 : new_zval->refcount++;
4139 18 : zend_hash_update(target_symbol_table, varname->value.str.val, varname->value.str.len+1, &new_zval, sizeof(zval *), (void **) &retval);
4140 : }
4141 : break;
4142 : EMPTY_SWITCH_DEFAULT_CASE()
4143 : }
4144 : }
4145 2754 : switch (opline->op2.u.EA.type) {
4146 : case ZEND_FETCH_GLOBAL:
4147 : if (IS_TMP_VAR != IS_TMP_VAR) {
4148 : zval_dtor(free_op1.var);
4149 : }
4150 0 : break;
4151 : case ZEND_FETCH_LOCAL:
4152 2754 : zval_dtor(free_op1.var);
4153 2754 : break;
4154 : case ZEND_FETCH_STATIC:
4155 0 : zval_update_constant(retval, (void*) 1 TSRMLS_CC);
4156 : break;
4157 : case ZEND_FETCH_GLOBAL_LOCK:
4158 : if (IS_TMP_VAR == IS_VAR && !free_op1.var) {
4159 : PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
4160 : }
4161 : break;
4162 : }
4163 : }
4164 :
4165 :
4166 2754 : if (varname == &tmp_varname) {
4167 0 : zval_dtor(varname);
4168 : }
4169 2754 : if (!RETURN_VALUE_UNUSED(&opline->result)) {
4170 2754 : EX_T(opline->result.u.var).var.ptr_ptr = retval;
4171 2754 : PZVAL_LOCK(*retval);
4172 2754 : switch (type) {
4173 : case BP_VAR_R:
4174 : case BP_VAR_IS:
4175 1377 : AI_USE_PTR(EX_T(opline->result.u.var).var);
4176 1377 : break;
4177 : case BP_VAR_UNSET: {
4178 : zend_free_op free_res;
4179 :
4180 0 : PZVAL_UNLOCK(*EX_T(opline->result.u.var).var.ptr_ptr, &free_res);
4181 0 : if (EX_T(opline->result.u.var).var.ptr_ptr != &EG(uninitialized_zval_ptr)) {
4182 0 : SEPARATE_ZVAL_IF_NOT_REF(EX_T(opline->result.u.var).var.ptr_ptr);
4183 : }
4184 0 : PZVAL_LOCK(*EX_T(opline->result.u.var).var.ptr_ptr);
4185 0 : FREE_OP_VAR_PTR(free_res);
4186 : break;
4187 : }
4188 : }
4189 : }
4190 2754 : ZEND_VM_NEXT_OPCODE();
4191 : }
4192 :
4193 : static int ZEND_FETCH_R_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4194 1377 : {
4195 1377 : return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4196 : }
4197 :
4198 : static int ZEND_FETCH_W_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4199 1377 : {
4200 1377 : return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4201 : }
4202 :
4203 : static int ZEND_FETCH_RW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4204 0 : {
4205 0 : return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4206 : }
4207 :
4208 : static int ZEND_FETCH_FUNC_ARG_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4209 0 : {
4210 0 : return zend_fetch_var_address_helper_SPEC_TMP(ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), EX(opline)->extended_value)?BP_VAR_W:BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4211 : }
4212 :
4213 : static int ZEND_FETCH_UNSET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4214 0 : {
4215 0 : return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4216 : }
4217 :
4218 : static int ZEND_FETCH_IS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4219 0 : {
4220 0 : return zend_fetch_var_address_helper_SPEC_TMP(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4221 : }
4222 :
4223 : static int ZEND_JMPZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4224 8489041 : {
4225 8489041 : zend_op *opline = EX(opline);
4226 : zend_free_op free_op1;
4227 8489041 : int ret = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC));
4228 :
4229 8489041 : zval_dtor(free_op1.var);
4230 8489041 : if (!ret) {
4231 : #if DEBUG_ZEND>=2
4232 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
4233 : #endif
4234 4414108 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
4235 : }
4236 :
4237 4074933 : ZEND_VM_NEXT_OPCODE();
4238 : }
4239 :
4240 : static int ZEND_JMPNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4241 95467 : {
4242 95467 : zend_op *opline = EX(opline);
4243 : zend_free_op free_op1;
4244 95467 : int ret = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC));
4245 :
4246 95467 : zval_dtor(free_op1.var);
4247 95467 : if (ret) {
4248 : #if DEBUG_ZEND>=2
4249 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
4250 : #endif
4251 95409 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
4252 : }
4253 :
4254 58 : ZEND_VM_NEXT_OPCODE();
4255 : }
4256 :
4257 : static int ZEND_JMPZNZ_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4258 1576640 : {
4259 1576640 : zend_op *opline = EX(opline);
4260 : zend_free_op free_op1;
4261 1576640 : int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC));
4262 :
4263 1576640 : zval_dtor(free_op1.var);
4264 1576640 : if (retval) {
4265 : #if DEBUG_ZEND>=2
4266 : printf("Conditional jmp on true to %d\n", opline->extended_value);
4267 : #endif
4268 1526795 : ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]);
4269 : } else {
4270 : #if DEBUG_ZEND>=2
4271 : printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num);
4272 : #endif
4273 49845 : ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]);
4274 : }
4275 : }
4276 :
4277 : static int ZEND_JMPZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4278 1836857 : {
4279 1836857 : zend_op *opline = EX(opline);
4280 : zend_free_op free_op1;
4281 1836857 : int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC));
4282 :
4283 1836857 : zval_dtor(free_op1.var);
4284 1836857 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval;
4285 1836857 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
4286 1836857 : if (!retval) {
4287 : #if DEBUG_ZEND>=2
4288 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
4289 : #endif
4290 12933 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
4291 : }
4292 1823924 : ZEND_VM_NEXT_OPCODE();
4293 : }
4294 :
4295 : static int ZEND_JMPNZ_EX_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4296 206487 : {
4297 206487 : zend_op *opline = EX(opline);
4298 : zend_free_op free_op1;
4299 206487 : int retval = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC));
4300 :
4301 206487 : zval_dtor(free_op1.var);
4302 206487 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = retval;
4303 206487 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
4304 206487 : if (retval) {
4305 : #if DEBUG_ZEND>=2
4306 : printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
4307 : #endif
4308 24686 : ZEND_VM_JMP(opline->op2.u.jmp_addr);
4309 : }
4310 181801 : ZEND_VM_NEXT_OPCODE();
4311 : }
4312 :
4313 : static int ZEND_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4314 4646755 : {
4315 4646755 : zendi_zval_dtor(EX_T(EX(opline)->op1.u.var).tmp_var);
4316 4646755 : ZEND_VM_NEXT_OPCODE();
4317 : }
4318 :
4319 : static int ZEND_RETURN_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4320 736267 : {
4321 736267 : zend_op *opline = EX(opline);
4322 : zval *retval_ptr;
4323 : zval **retval_ptr_ptr;
4324 : zend_free_op free_op1;
4325 :
4326 736267 : if (EG(active_op_array)->return_reference == ZEND_RETURN_REF) {
4327 :
4328 : if (IS_TMP_VAR == IS_CONST || IS_TMP_VAR == IS_TMP_VAR) {
4329 : /* Not supposed to happen, but we'll allow it */
4330 0 : zend_error(E_NOTICE, "Only variable references should be returned by reference");
4331 0 : goto return_by_value;
4332 : }
4333 :
4334 : retval_ptr_ptr = NULL;
4335 :
4336 : if (!retval_ptr_ptr) {
4337 : zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
4338 : }
4339 :
4340 : if (IS_TMP_VAR == IS_VAR && !(*retval_ptr_ptr)->is_ref) {
4341 : if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
4342 : EX_T(opline->op1.u.var).var.fcall_returned_reference) {
4343 : } else if (EX_T(opline->op1.u.var).var.ptr_ptr == &EX_T(opline->op1.u.var).var.ptr) {
4344 : if (IS_TMP_VAR == IS_VAR && !1) {
4345 : PZVAL_LOCK(*retval_ptr_ptr); /* undo the effect of get_zval_ptr_ptr() */
4346 : }
4347 : zend_error(E_NOTICE, "Only variable references should be returned by reference");
4348 : goto return_by_value;
4349 : }
4350 : }
4351 :
4352 : SEPARATE_ZVAL_TO_MAKE_IS_REF(retval_ptr_ptr);
4353 : (*retval_ptr_ptr)->refcount++;
4354 :
4355 : (*EG(return_value_ptr_ptr)) = (*retval_ptr_ptr);
4356 : } else {
4357 736267 : return_by_value:
4358 :
4359 736267 : retval_ptr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4360 :
4361 736267 : if (EG(ze1_compatibility_mode) && Z_TYPE_P(retval_ptr) == IS_OBJECT) {
4362 : zval *ret;
4363 : char *class_name;
4364 : zend_uint class_name_len;
4365 : int dup;
4366 :
4367 0 : ALLOC_ZVAL(ret);
4368 0 : INIT_PZVAL_COPY(ret, retval_ptr);
4369 0 : dup = zend_get_object_classname(retval_ptr, &class_name, &class_name_len TSRMLS_CC);
4370 0 : if (Z_OBJ_HT_P(retval_ptr)->clone_obj == NULL) {
4371 0 : zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", class_name);
4372 : }
4373 0 : zend_error(E_STRICT, "Implicit cloning object of class '%s' because of 'zend.ze1_compatibility_mode'", class_name);
4374 0 : ret->value.obj = Z_OBJ_HT_P(retval_ptr)->clone_obj(retval_ptr TSRMLS_CC);
4375 0 : *EG(return_value_ptr_ptr) = ret;
4376 0 : if (!dup) {
4377 0 : efree(class_name);
4378 : }
4379 : } else if (!1) { /* Not a temp var */
4380 : if (EG(active_op_array)->return_reference == ZEND_RETURN_REF ||
4381 : (PZVAL_IS_REF(retval_ptr) && retval_ptr->refcount > 0)) {
4382 : zval *ret;
4383 :
4384 : ALLOC_ZVAL(ret);
4385 : INIT_PZVAL_COPY(ret, retval_ptr);
4386 : zval_copy_ctor(ret);
4387 : *EG(return_value_ptr_ptr) = ret;
4388 : } else {
4389 : *EG(return_value_ptr_ptr) = retval_ptr;
4390 : retval_ptr->refcount++;
4391 : }
4392 : } else {
4393 : zval *ret;
4394 :
4395 736267 : ALLOC_ZVAL(ret);
4396 736267 : INIT_PZVAL_COPY(ret, retval_ptr);
4397 736267 : *EG(return_value_ptr_ptr) = ret;
4398 : }
4399 : }
4400 :
4401 736267 : ZEND_VM_RETURN_FROM_EXECUTE_LOOP();
4402 : }
4403 :
4404 : static int ZEND_THROW_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4405 0 : {
4406 0 : zend_op *opline = EX(opline);
4407 : zval *value;
4408 : zval *exception;
4409 : zend_free_op free_op1;
4410 :
4411 0 : value = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4412 :
4413 0 : if (Z_TYPE_P(value) != IS_OBJECT) {
4414 0 : zend_error_noreturn(E_ERROR, "Can only throw objects");
4415 : }
4416 : /* Not sure if a complete copy is what we want here */
4417 0 : ALLOC_ZVAL(exception);
4418 0 : INIT_PZVAL_COPY(exception, value);
4419 : if (!1) {
4420 : zval_copy_ctor(exception);
4421 : }
4422 :
4423 0 : zend_throw_exception_object(exception TSRMLS_CC);
4424 :
4425 0 : ZEND_VM_NEXT_OPCODE();
4426 : }
4427 :
4428 : static int ZEND_SEND_VAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4429 2399487 : {
4430 2399487 : zend_op *opline = EX(opline);
4431 2399487 : if (opline->extended_value==ZEND_DO_FCALL_BY_NAME
4432 : && ARG_MUST_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
4433 0 : zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.u.opline_num);
4434 : }
4435 : {
4436 : zval *valptr;
4437 : zval *value;
4438 : zend_free_op free_op1;
4439 :
4440 2399487 : value = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4441 :
4442 2399487 : ALLOC_ZVAL(valptr);
4443 2399487 : INIT_PZVAL_COPY(valptr, value);
4444 : if (!1) {
4445 : zval_copy_ctor(valptr);
4446 : }
4447 2399487 : zend_ptr_stack_push(&EG(argument_stack), valptr);
4448 :
4449 : }
4450 2399487 : ZEND_VM_NEXT_OPCODE();
4451 : }
4452 :
4453 : static int ZEND_BOOL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4454 1240811 : {
4455 1240811 : zend_op *opline = EX(opline);
4456 : zend_free_op free_op1;
4457 :
4458 : /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
4459 1240811 : Z_LVAL(EX_T(opline->result.u.var).tmp_var) = i_zend_is_true(_get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC));
4460 1240811 : Z_TYPE(EX_T(opline->result.u.var).tmp_var) = IS_BOOL;
4461 1240811 : zval_dtor(free_op1.var);
4462 :
4463 1240811 : ZEND_VM_NEXT_OPCODE();
4464 : }
4465 :
4466 : static int ZEND_SWITCH_FREE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4467 31 : {
4468 31 : zend_switch_free(EX(opline), EX(Ts) TSRMLS_CC);
4469 31 : ZEND_VM_NEXT_OPCODE();
4470 : }
4471 :
4472 : static int ZEND_CLONE_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4473 1 : {
4474 1 : zend_op *opline = EX(opline);
4475 : zend_free_op free_op1;
4476 1 : zval *obj = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4477 : zend_class_entry *ce;
4478 : zend_function *clone;
4479 : zend_object_clone_obj_t clone_call;
4480 :
4481 1 : if (!obj || Z_TYPE_P(obj) != IS_OBJECT) {
4482 1 : zend_error_noreturn(E_ERROR, "__clone method called on non-object");
4483 : EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
4484 : EX_T(opline->result.u.var).var.ptr->refcount++;
4485 :
4486 : ZEND_VM_NEXT_OPCODE();
4487 : }
4488 :
4489 0 : ce = Z_OBJCE_P(obj);
4490 0 : clone = ce ? ce->clone : NULL;
4491 0 : clone_call = Z_OBJ_HT_P(obj)->clone_obj;
4492 0 : if (!clone_call) {
4493 0 : if (ce) {
4494 0 : zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name);
4495 : } else {
4496 0 : zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object");
4497 : }
4498 : EX_T(opline->result.u.var).var.ptr = EG(error_zval_ptr);
4499 : EX_T(opline->result.u.var).var.ptr->refcount++;
4500 : }
4501 :
4502 0 : if (ce && clone) {
4503 0 : if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
4504 : /* Ensure that if we're calling a private function, we're allowed to do so.
4505 : */
4506 0 : if (ce != EG(scope)) {
4507 0 : zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
4508 : }
4509 0 : } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
4510 : /* Ensure that if we're calling a protected function, we're allowed to do so.
4511 : */
4512 0 : if (!zend_check_protected(clone->common.scope, EG(scope))) {
4513 0 : zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name, EG(scope) ? EG(scope)->name : "");
4514 : }
4515 : }
4516 : }
4517 :
4518 0 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
4519 0 : if (!EG(exception)) {
4520 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
4521 0 : Z_OBJVAL_P(EX_T(opline->result.u.var).var.ptr) = clone_call(obj TSRMLS_CC);
4522 0 : Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_OBJECT;
4523 0 : EX_T(opline->result.u.var).var.ptr->refcount=1;
4524 0 : EX_T(opline->result.u.var).var.ptr->is_ref=1;
4525 0 : if (!RETURN_VALUE_USED(opline) || EG(exception)) {
4526 0 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
4527 : }
4528 : }
4529 :
4530 0 : ZEND_VM_NEXT_OPCODE();
4531 : }
4532 :
4533 : static int ZEND_CAST_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4534 78899 : {
4535 78899 : zend_op *opline = EX(opline);
4536 : zend_free_op free_op1;
4537 78899 : zval *expr = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4538 78899 : zval *result = &EX_T(opline->result.u.var).tmp_var;
4539 :
4540 78899 : if (opline->extended_value != IS_STRING) {
4541 82 : *result = *expr;
4542 : if (!1) {
4543 : zendi_zval_copy_ctor(*result);
4544 : }
4545 : }
4546 78899 : switch (opline->extended_value) {
4547 : case IS_NULL:
4548 0 : convert_to_null(result);
4549 0 : break;
4550 : case IS_BOOL:
4551 0 : convert_to_boolean(result);
4552 0 : break;
4553 : case IS_LONG:
4554 23 : convert_to_long(result);
4555 23 : break;
4556 : case IS_DOUBLE:
4557 6 : convert_to_double(result);
4558 6 : break;
4559 : case IS_STRING: {
4560 : zval var_copy;
4561 : int use_copy;
4562 :
4563 78817 : zend_make_printable_zval(expr, &var_copy, &use_copy);
4564 78817 : if (use_copy) {
4565 39 : *result = var_copy;
4566 : if (1) {
4567 39 : zval_dtor(free_op1.var);
4568 : }
4569 : } else {
4570 78778 : *result = *expr;
4571 : if (!1) {
4572 : zendi_zval_copy_ctor(*result);
4573 : }
4574 : }
4575 78817 : break;
4576 : }
4577 : case IS_ARRAY:
4578 0 : convert_to_array(result);
4579 0 : break;
4580 : case IS_OBJECT:
4581 53 : convert_to_object(result);
4582 : break;
4583 : }
4584 :
4585 78899 : ZEND_VM_NEXT_OPCODE();
4586 : }
4587 :
4588 : static int ZEND_INCLUDE_OR_EVAL_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4589 1881 : {
4590 1881 : zend_op *opline = EX(opline);
4591 1881 : zend_op_array *new_op_array=NULL;
4592 1881 : zval **original_return_value = EG(return_value_ptr_ptr);
4593 : int return_value_used;
4594 : zend_free_op free_op1;
4595 1881 : zval *inc_filename = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4596 : zval tmp_inc_filename;
4597 1881 : zend_bool failure_retval=0;
4598 :
4599 1881 : if (inc_filename->type!=IS_STRING) {
4600 0 : tmp_inc_filename = *inc_filename;
4601 0 : zval_copy_ctor(&tmp_inc_filename);
4602 0 : convert_to_string(&tmp_inc_filename);
4603 0 : inc_filename = &tmp_inc_filename;
4604 : }
4605 :
4606 1881 : return_value_used = RETURN_VALUE_USED(opline);
4607 :
4608 1881 : switch (Z_LVAL(opline->op2.u.constant)) {
4609 : case ZEND_INCLUDE_ONCE:
4610 : case ZEND_REQUIRE_ONCE: {
4611 : zend_file_handle file_handle;
4612 :
4613 725 : if (IS_ABSOLUTE_PATH(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename))) {
4614 : cwd_state state;
4615 :
4616 719 : state.cwd_length = 0;
4617 719 : state.cwd = malloc(1);
4618 719 : state.cwd[0] = 0;
4619 :
4620 719 : failure_retval = (!virtual_file_ex(&state, Z_STRVAL_P(inc_filename), NULL, 1) &&
4621 : zend_hash_exists(&EG(included_files), state.cwd, state.cwd_length+1));
4622 :
4623 719 : free(state.cwd);
4624 : }
4625 :
4626 725 : if (failure_retval) {
4627 : /* do nothing */
4628 722 : } else if (SUCCESS == zend_stream_open(Z_STRVAL_P(inc_filename), &file_handle TSRMLS_CC)) {
4629 :
4630 722 : if (!file_handle.opened_path) {
4631 0 : file_handle.opened_path = estrndup(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename));
4632 : }
4633 :
4634 722 : if (zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path)+1)==SUCCESS) {
4635 722 : new_op_array = zend_compile_file(&file_handle, (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
4636 722 : zend_destroy_file_handle(&file_handle TSRMLS_CC);
4637 : } else {
4638 0 : zend_file_handle_dtor(&file_handle);
4639 0 : failure_retval=1;
4640 : }
4641 : } else {
4642 0 : if (Z_LVAL(opline->op2.u.constant)==ZEND_INCLUDE_ONCE) {
4643 0 : zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename));
4644 : } else {
4645 0 : zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename));
4646 : }
4647 : }
4648 : }
4649 725 : break;
4650 : case ZEND_INCLUDE:
4651 : case ZEND_REQUIRE:
4652 697 : new_op_array = compile_filename(Z_LVAL(opline->op2.u.constant), inc_filename TSRMLS_CC);
4653 697 : break;
4654 : case ZEND_EVAL: {
4655 459 : char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
4656 :
4657 459 : new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
4658 459 : efree(eval_desc);
4659 : }
4660 : break;
4661 : EMPTY_SWITCH_DEFAULT_CASE()
4662 : }
4663 1881 : if (inc_filename==&tmp_inc_filename) {
4664 0 : zval_dtor(&tmp_inc_filename);
4665 : }
4666 1881 : EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
4667 1881 : if (new_op_array) {
4668 : zval *saved_object;
4669 : zend_function *saved_function;
4670 :
4671 1878 : EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr;
4672 1878 : EG(active_op_array) = new_op_array;
4673 1878 : EX_T(opline->result.u.var).var.ptr = NULL;
4674 :
4675 1878 : saved_object = EX(object);
4676 1878 : saved_function = EX(function_state).function;
4677 :
4678 1878 : EX(function_state).function = (zend_function *) new_op_array;
4679 1878 : EX(object) = NULL;
4680 :
4681 1878 : zend_execute(new_op_array TSRMLS_CC);
4682 :
4683 1871 : EX(function_state).function = saved_function;
4684 1871 : EX(object) = saved_object;
4685 :
4686 1871 : if (!return_value_used) {
4687 1483 : if (EX_T(opline->result.u.var).var.ptr) {
4688 1481 : zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
4689 : }
4690 : } else { /* return value is used */
4691 388 : if (!EX_T(opline->result.u.var).var.ptr) { /* there was no return statement */
4692 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
4693 0 : INIT_PZVAL(EX_T(opline->result.u.var).var.ptr);
4694 0 : Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = 1;
4695 0 : Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL;
4696 : }
4697 : }
4698 :
4699 1871 : EG(opline_ptr) = &EX(opline);
4700 1871 : EG(active_op_array) = EX(op_array);
4701 1871 : EG(function_state_ptr) = &EX(function_state);
4702 1871 : destroy_op_array(new_op_array TSRMLS_CC);
4703 1871 : efree(new_op_array);
4704 1871 : if (EG(exception)) {
4705 2 : zend_throw_exception_internal(NULL TSRMLS_CC);
4706 : }
4707 : } else {
4708 3 : if (return_value_used) {
4709 0 : ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
4710 0 : INIT_ZVAL(*EX_T(opline->result.u.var).var.ptr);
4711 0 : Z_LVAL_P(EX_T(opline->result.u.var).var.ptr) = failure_retval;
4712 0 : Z_TYPE_P(EX_T(opline->result.u.var).var.ptr) = IS_BOOL;
4713 : }
4714 : }
4715 1874 : zval_dtor(free_op1.var);
4716 1874 : EG(return_value_ptr_ptr) = original_return_value;
4717 1874 : ZEND_VM_NEXT_OPCODE();
4718 : }
4719 :
4720 : static int ZEND_UNSET_VAR_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4721 0 : {
4722 0 : zend_op *opline = EX(opline);
4723 : zval tmp, *varname;
4724 : HashTable *target_symbol_table;
4725 : zend_free_op free_op1;
4726 :
4727 0 : varname = _get_zval_ptr_tmp(&opline->op1, EX(Ts), &free_op1 TSRMLS_CC);
4728 :
4729 0 : if (Z_TYPE_P(varname) != IS_STRING) {
4730 0 : tmp = *varname;
4731 0 : zval_copy_ctor(&tmp);
4732 0 : convert_to_string(&tmp);
4733 0 : varname = &tmp;
4734 : } else if (IS_TMP_VAR == IS_CV || IS_TMP_VAR == IS_VAR) {
4735 : varname->refcount++;
4736 : }
4737 :
4738 0 : if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) {
4739 0 : zend_std_unset_static_property(EX_T(opline->op2.u.var).class_entry, Z_STRVAL_P(varname), Z_STRLEN_P(varname) TSRMLS_CC);
4740 : } else {
4741 0 : target_symbol_table = zend_get_target_symbol_table(opline, EX(Ts), BP_VAR_IS, varname TSRMLS_CC);
4742 0 : if (zend_hash_del(target_symbol_table, varname->value.str.val, varname->value.str.len+1) == SUCCESS) {
4743 0 : zend_execute_data *ex = execute_data;
4744 |