1/*
2   +----------------------------------------------------------------------+
3   | Zend Engine                                                          |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1998-2014 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#ifdef ZEND_WIN32
22# pragma warning(once : 4101)
23# pragma warning(once : 6235)
24# pragma warning(once : 6237)
25# pragma warning(once : 6239)
26# pragma warning(once : 6240)
27# pragma warning(once : 6285)
28# pragma warning(once : 6286)
29# pragma warning(once : 6326)
30#endif
31static user_opcode_handler_t zend_user_opcode_handlers[256] = {
32    (user_opcode_handler_t)NULL,
33    (user_opcode_handler_t)NULL,
34    (user_opcode_handler_t)NULL,
35    (user_opcode_handler_t)NULL,
36    (user_opcode_handler_t)NULL,
37    (user_opcode_handler_t)NULL,
38    (user_opcode_handler_t)NULL,
39    (user_opcode_handler_t)NULL,
40    (user_opcode_handler_t)NULL,
41    (user_opcode_handler_t)NULL,
42    (user_opcode_handler_t)NULL,
43    (user_opcode_handler_t)NULL,
44    (user_opcode_handler_t)NULL,
45    (user_opcode_handler_t)NULL,
46    (user_opcode_handler_t)NULL,
47    (user_opcode_handler_t)NULL,
48    (user_opcode_handler_t)NULL,
49    (user_opcode_handler_t)NULL,
50    (user_opcode_handler_t)NULL,
51    (user_opcode_handler_t)NULL,
52    (user_opcode_handler_t)NULL,
53    (user_opcode_handler_t)NULL,
54    (user_opcode_handler_t)NULL,
55    (user_opcode_handler_t)NULL,
56    (user_opcode_handler_t)NULL,
57    (user_opcode_handler_t)NULL,
58    (user_opcode_handler_t)NULL,
59    (user_opcode_handler_t)NULL,
60    (user_opcode_handler_t)NULL,
61    (user_opcode_handler_t)NULL,
62    (user_opcode_handler_t)NULL,
63    (user_opcode_handler_t)NULL,
64    (user_opcode_handler_t)NULL,
65    (user_opcode_handler_t)NULL,
66    (user_opcode_handler_t)NULL,
67    (user_opcode_handler_t)NULL,
68    (user_opcode_handler_t)NULL,
69    (user_opcode_handler_t)NULL,
70    (user_opcode_handler_t)NULL,
71    (user_opcode_handler_t)NULL,
72    (user_opcode_handler_t)NULL,
73    (user_opcode_handler_t)NULL,
74    (user_opcode_handler_t)NULL,
75    (user_opcode_handler_t)NULL,
76    (user_opcode_handler_t)NULL,
77    (user_opcode_handler_t)NULL,
78    (user_opcode_handler_t)NULL,
79    (user_opcode_handler_t)NULL,
80    (user_opcode_handler_t)NULL,
81    (user_opcode_handler_t)NULL,
82    (user_opcode_handler_t)NULL,
83    (user_opcode_handler_t)NULL,
84    (user_opcode_handler_t)NULL,
85    (user_opcode_handler_t)NULL,
86    (user_opcode_handler_t)NULL,
87    (user_opcode_handler_t)NULL,
88    (user_opcode_handler_t)NULL,
89    (user_opcode_handler_t)NULL,
90    (user_opcode_handler_t)NULL,
91    (user_opcode_handler_t)NULL,
92    (user_opcode_handler_t)NULL,
93    (user_opcode_handler_t)NULL,
94    (user_opcode_handler_t)NULL,
95    (user_opcode_handler_t)NULL,
96    (user_opcode_handler_t)NULL,
97    (user_opcode_handler_t)NULL,
98    (user_opcode_handler_t)NULL,
99    (user_opcode_handler_t)NULL,
100    (user_opcode_handler_t)NULL,
101    (user_opcode_handler_t)NULL,
102    (user_opcode_handler_t)NULL,
103    (user_opcode_handler_t)NULL,
104    (user_opcode_handler_t)NULL,
105    (user_opcode_handler_t)NULL,
106    (user_opcode_handler_t)NULL,
107    (user_opcode_handler_t)NULL,
108    (user_opcode_handler_t)NULL,
109    (user_opcode_handler_t)NULL,
110    (user_opcode_handler_t)NULL,
111    (user_opcode_handler_t)NULL,
112    (user_opcode_handler_t)NULL,
113    (user_opcode_handler_t)NULL,
114    (user_opcode_handler_t)NULL,
115    (user_opcode_handler_t)NULL,
116    (user_opcode_handler_t)NULL,
117    (user_opcode_handler_t)NULL,
118    (user_opcode_handler_t)NULL,
119    (user_opcode_handler_t)NULL,
120    (user_opcode_handler_t)NULL,
121    (user_opcode_handler_t)NULL,
122    (user_opcode_handler_t)NULL,
123    (user_opcode_handler_t)NULL,
124    (user_opcode_handler_t)NULL,
125    (user_opcode_handler_t)NULL,
126    (user_opcode_handler_t)NULL,
127    (user_opcode_handler_t)NULL,
128    (user_opcode_handler_t)NULL,
129    (user_opcode_handler_t)NULL,
130    (user_opcode_handler_t)NULL,
131    (user_opcode_handler_t)NULL,
132    (user_opcode_handler_t)NULL,
133    (user_opcode_handler_t)NULL,
134    (user_opcode_handler_t)NULL,
135    (user_opcode_handler_t)NULL,
136    (user_opcode_handler_t)NULL,
137    (user_opcode_handler_t)NULL,
138    (user_opcode_handler_t)NULL,
139    (user_opcode_handler_t)NULL,
140    (user_opcode_handler_t)NULL,
141    (user_opcode_handler_t)NULL,
142    (user_opcode_handler_t)NULL,
143    (user_opcode_handler_t)NULL,
144    (user_opcode_handler_t)NULL,
145    (user_opcode_handler_t)NULL,
146    (user_opcode_handler_t)NULL,
147    (user_opcode_handler_t)NULL,
148    (user_opcode_handler_t)NULL,
149    (user_opcode_handler_t)NULL,
150    (user_opcode_handler_t)NULL,
151    (user_opcode_handler_t)NULL,
152    (user_opcode_handler_t)NULL,
153    (user_opcode_handler_t)NULL,
154    (user_opcode_handler_t)NULL,
155    (user_opcode_handler_t)NULL,
156    (user_opcode_handler_t)NULL,
157    (user_opcode_handler_t)NULL,
158    (user_opcode_handler_t)NULL,
159    (user_opcode_handler_t)NULL,
160    (user_opcode_handler_t)NULL,
161    (user_opcode_handler_t)NULL,
162    (user_opcode_handler_t)NULL,
163    (user_opcode_handler_t)NULL,
164    (user_opcode_handler_t)NULL,
165    (user_opcode_handler_t)NULL,
166    (user_opcode_handler_t)NULL,
167    (user_opcode_handler_t)NULL,
168    (user_opcode_handler_t)NULL,
169    (user_opcode_handler_t)NULL,
170    (user_opcode_handler_t)NULL,
171    (user_opcode_handler_t)NULL,
172    (user_opcode_handler_t)NULL,
173    (user_opcode_handler_t)NULL,
174    (user_opcode_handler_t)NULL,
175    (user_opcode_handler_t)NULL,
176    (user_opcode_handler_t)NULL,
177    (user_opcode_handler_t)NULL,
178    (user_opcode_handler_t)NULL,
179    (user_opcode_handler_t)NULL,
180    (user_opcode_handler_t)NULL,
181    (user_opcode_handler_t)NULL,
182    (user_opcode_handler_t)NULL,
183    (user_opcode_handler_t)NULL,
184    (user_opcode_handler_t)NULL,
185    (user_opcode_handler_t)NULL,
186    (user_opcode_handler_t)NULL,
187    (user_opcode_handler_t)NULL,
188    (user_opcode_handler_t)NULL,
189    (user_opcode_handler_t)NULL,
190    (user_opcode_handler_t)NULL,
191    (user_opcode_handler_t)NULL,
192    (user_opcode_handler_t)NULL,
193    (user_opcode_handler_t)NULL,
194    (user_opcode_handler_t)NULL,
195    (user_opcode_handler_t)NULL,
196    (user_opcode_handler_t)NULL,
197    (user_opcode_handler_t)NULL,
198    (user_opcode_handler_t)NULL,
199    (user_opcode_handler_t)NULL,
200    (user_opcode_handler_t)NULL,
201    (user_opcode_handler_t)NULL,
202    (user_opcode_handler_t)NULL,
203    (user_opcode_handler_t)NULL,
204    (user_opcode_handler_t)NULL,
205    (user_opcode_handler_t)NULL,
206    (user_opcode_handler_t)NULL,
207    (user_opcode_handler_t)NULL,
208    (user_opcode_handler_t)NULL,
209    (user_opcode_handler_t)NULL,
210    (user_opcode_handler_t)NULL,
211    (user_opcode_handler_t)NULL,
212    (user_opcode_handler_t)NULL,
213    (user_opcode_handler_t)NULL,
214    (user_opcode_handler_t)NULL,
215    (user_opcode_handler_t)NULL,
216    (user_opcode_handler_t)NULL,
217    (user_opcode_handler_t)NULL,
218    (user_opcode_handler_t)NULL,
219    (user_opcode_handler_t)NULL,
220    (user_opcode_handler_t)NULL,
221    (user_opcode_handler_t)NULL,
222    (user_opcode_handler_t)NULL,
223    (user_opcode_handler_t)NULL,
224    (user_opcode_handler_t)NULL,
225    (user_opcode_handler_t)NULL,
226    (user_opcode_handler_t)NULL,
227    (user_opcode_handler_t)NULL,
228    (user_opcode_handler_t)NULL,
229    (user_opcode_handler_t)NULL,
230    (user_opcode_handler_t)NULL,
231    (user_opcode_handler_t)NULL,
232    (user_opcode_handler_t)NULL,
233    (user_opcode_handler_t)NULL,
234    (user_opcode_handler_t)NULL,
235    (user_opcode_handler_t)NULL,
236    (user_opcode_handler_t)NULL,
237    (user_opcode_handler_t)NULL,
238    (user_opcode_handler_t)NULL,
239    (user_opcode_handler_t)NULL,
240    (user_opcode_handler_t)NULL,
241    (user_opcode_handler_t)NULL,
242    (user_opcode_handler_t)NULL,
243    (user_opcode_handler_t)NULL,
244    (user_opcode_handler_t)NULL,
245    (user_opcode_handler_t)NULL,
246    (user_opcode_handler_t)NULL,
247    (user_opcode_handler_t)NULL,
248    (user_opcode_handler_t)NULL,
249    (user_opcode_handler_t)NULL,
250    (user_opcode_handler_t)NULL,
251    (user_opcode_handler_t)NULL,
252    (user_opcode_handler_t)NULL,
253    (user_opcode_handler_t)NULL,
254    (user_opcode_handler_t)NULL,
255    (user_opcode_handler_t)NULL,
256    (user_opcode_handler_t)NULL,
257    (user_opcode_handler_t)NULL,
258    (user_opcode_handler_t)NULL,
259    (user_opcode_handler_t)NULL,
260    (user_opcode_handler_t)NULL,
261    (user_opcode_handler_t)NULL,
262    (user_opcode_handler_t)NULL,
263    (user_opcode_handler_t)NULL,
264    (user_opcode_handler_t)NULL,
265    (user_opcode_handler_t)NULL,
266    (user_opcode_handler_t)NULL,
267    (user_opcode_handler_t)NULL,
268    (user_opcode_handler_t)NULL,
269    (user_opcode_handler_t)NULL,
270    (user_opcode_handler_t)NULL,
271    (user_opcode_handler_t)NULL,
272    (user_opcode_handler_t)NULL,
273    (user_opcode_handler_t)NULL,
274    (user_opcode_handler_t)NULL,
275    (user_opcode_handler_t)NULL,
276    (user_opcode_handler_t)NULL,
277    (user_opcode_handler_t)NULL,
278    (user_opcode_handler_t)NULL,
279    (user_opcode_handler_t)NULL,
280    (user_opcode_handler_t)NULL,
281    (user_opcode_handler_t)NULL,
282    (user_opcode_handler_t)NULL,
283    (user_opcode_handler_t)NULL,
284    (user_opcode_handler_t)NULL,
285    (user_opcode_handler_t)NULL,
286    (user_opcode_handler_t)NULL,
287    (user_opcode_handler_t)NULL
288};
289
290static zend_uchar zend_user_opcodes[256] = {0,
291    1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
292    17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,
293    33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,
294    49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,
295    65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,
296    81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,
297    97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,
298    113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,
299    129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,
300    145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,
301    161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,
302    177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,
303    193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,
304    209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,
305    225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,
306    241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
307};
308
309static opcode_handler_t zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);
310
311
312#undef OPLINE
313#undef DCL_OPLINE
314#undef USE_OPLINE
315#undef LOAD_OPLINE
316#undef SAVE_OPLINE
317#define OPLINE EX(opline)
318#define DCL_OPLINE
319#define USE_OPLINE const zend_op *opline = EX(opline);
320#define LOAD_OPLINE()
321#define SAVE_OPLINE()
322#undef CHECK_EXCEPTION
323#undef HANDLE_EXCEPTION
324#undef HANDLE_EXCEPTION_LEAVE
325#define CHECK_EXCEPTION() LOAD_OPLINE()
326#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()
327#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()
328#define ZEND_VM_CONTINUE()         return  0
329#define ZEND_VM_RETURN()           return -1
330#define ZEND_VM_ENTER()            return  1
331#define ZEND_VM_LEAVE()            return  2
332#define ZEND_VM_DISPATCH(opcode, opline) return zend_vm_get_opcode_handler(opcode, opline)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
333
334#define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL execute_data TSRMLS_CC
335
336ZEND_API void execute_ex(zend_execute_data *execute_data TSRMLS_DC)
337{
338    DCL_OPLINE
339
340
341
342    LOAD_OPLINE();
343
344    while (1) {
345        int ret;
346#ifdef ZEND_WIN32
347        if (EG(timed_out)) {
348            zend_timeout(0);
349        }
350#endif
351
352        if (UNEXPECTED((ret = OPLINE->handler(execute_data TSRMLS_CC)) != 0)) {
353            if (EXPECTED(ret > 0)) {
354                execute_data = EG(current_execute_data);
355            } else {
356                return;
357            }
358        }
359
360    }
361    zend_error_noreturn(E_ERROR, "Arrived at end of main loop which shouldn't happen");
362}
363
364ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value TSRMLS_DC)
365{
366    zend_execute_data *execute_data;
367
368    if (EG(exception) != NULL) {
369        return;
370    }
371
372    execute_data = zend_vm_stack_push_call_frame(
373        (zend_function*)op_array, 0, 0, EG(current_execute_data) ? EG(current_execute_data)->called_scope : NULL, Z_OBJ(EG(This)), NULL TSRMLS_CC);
374    if (EG(current_execute_data)) {
375        execute_data->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
376    } else {
377        execute_data->symbol_table = &EG(symbol_table);
378    }
379    EX(prev_execute_data) = EG(current_execute_data);
380    i_init_execute_data(execute_data, op_array, return_value, VM_FRAME_TOP_CODE TSRMLS_CC);
381    zend_execute_ex(execute_data TSRMLS_CC);
382}
383
384static int ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
385{
386    vm_frame_kind frame_kind = EX(frame_kind);
387
388    if (frame_kind == VM_FRAME_NESTED_FUNCTION) {
389        i_free_compiled_variables(execute_data TSRMLS_CC);
390        if (UNEXPECTED(EX(symbol_table) != NULL)) {
391            zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
392        }
393        zend_vm_stack_free_extra_args(execute_data TSRMLS_CC);
394        EG(current_execute_data) = EX(prev_execute_data);
395        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_CLOSURE) != 0) && EX(func)->op_array.prototype) {
396            OBJ_RELEASE((zend_object*)EX(func)->op_array.prototype);
397        }
398        zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
399
400        execute_data = EG(current_execute_data);
401
402        if (Z_OBJ(EG(This))) {
403            if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
404                if (!(EX(opline)->op1.num & ZEND_CALL_CTOR_RESULT_UNUSED)) {
405                    Z_DELREF(EG(This));
406                }
407                if (Z_REFCOUNT(EG(This)) == 1) {
408                    zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
409                }
410            }
411            if (!Z_DELREF(EG(This))) {
412                _zval_dtor_func_for_ptr(Z_COUNTED(EG(This)) ZEND_FILE_LINE_CC);
413            } else if (UNEXPECTED(!Z_GC_INFO(EG(This)))) {
414                gc_possible_root(Z_COUNTED(EG(This)) TSRMLS_CC);
415            }
416        }
417        Z_OBJ(EG(This)) = EX(object);
418        EG(scope) = EX(scope);
419
420        if (UNEXPECTED(EG(exception) != NULL)) {
421            const zend_op *opline = EX(opline);
422            zend_throw_exception_internal(NULL TSRMLS_CC);
423            if (RETURN_VALUE_USED(opline)) {
424                zval_ptr_dtor(EX_VAR(opline->result.var));
425            }
426            HANDLE_EXCEPTION_LEAVE();
427        }
428
429        LOAD_OPLINE();
430        ZEND_VM_INC_OPCODE();
431        ZEND_VM_LEAVE();
432    } else if (frame_kind == VM_FRAME_NESTED_CODE) {
433        zend_detach_symbol_table(execute_data);
434        destroy_op_array(&EX(func)->op_array TSRMLS_CC);
435        efree_size(EX(func), sizeof(zend_op_array));
436        EG(current_execute_data) = EX(prev_execute_data);
437        zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
438
439        execute_data = EG(current_execute_data);
440        zend_attach_symbol_table(execute_data);
441        if (UNEXPECTED(EG(exception) != NULL)) {
442            zend_throw_exception_internal(NULL TSRMLS_CC);
443            HANDLE_EXCEPTION_LEAVE();
444        }
445
446        LOAD_OPLINE();
447        ZEND_VM_INC_OPCODE();
448        ZEND_VM_LEAVE();
449    } else {
450        if (frame_kind == VM_FRAME_TOP_FUNCTION) {
451            i_free_compiled_variables(execute_data TSRMLS_CC);
452            if (UNEXPECTED(EX(symbol_table) != NULL)) {
453                zend_clean_and_cache_symbol_table(EX(symbol_table) TSRMLS_CC);
454            }
455            zend_vm_stack_free_extra_args(execute_data TSRMLS_CC);
456            EG(current_execute_data) = EX(prev_execute_data);
457            if ((EX(func)->op_array.fn_flags & ZEND_ACC_CLOSURE) && EX(func)->op_array.prototype) {
458                OBJ_RELEASE((zend_object*)EX(func)->op_array.prototype);
459            }
460        } else /* if (frame_kind == VM_FRAME_TOP_CODE) */ {
461            zend_array *symbol_table = EX(symbol_table);
462            zend_execute_data *old_execute_data;
463
464            zend_detach_symbol_table(execute_data);
465            old_execute_data = EX(prev_execute_data);
466            while (old_execute_data) {
467                if (old_execute_data->func && ZEND_USER_CODE(old_execute_data->func->op_array.type)) {
468                    if (old_execute_data->symbol_table == symbol_table) {
469                        zend_attach_symbol_table(old_execute_data);
470                    }
471                    break;
472                }
473                old_execute_data = old_execute_data->prev_execute_data;
474            }
475            EG(current_execute_data) = EX(prev_execute_data);
476        }
477        zend_vm_stack_free_call_frame(execute_data TSRMLS_CC);
478
479        ZEND_VM_RETURN();
480    }
481}
482
483static int ZEND_FASTCALL  ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
484{
485    USE_OPLINE
486
487    ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
488    ZEND_VM_CONTINUE();
489}
490
491static int ZEND_FASTCALL  ZEND_INIT_STRING_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
492{
493    USE_OPLINE
494    zval *tmp = EX_VAR(opline->result.var);
495
496    SAVE_OPLINE();
497    ZVAL_EMPTY_STRING(tmp);
498    /*CHECK_EXCEPTION();*/
499    ZEND_VM_NEXT_OPCODE();
500}
501
502static int ZEND_FASTCALL  ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
503{
504    USE_OPLINE
505    zend_execute_data *call = EX(call);
506    zend_function *fbc = call->func;
507
508    SAVE_OPLINE();
509    EX(call) = call->prev_nested_call;
510    if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
511        if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
512            zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", fbc->common.scope->name->val, fbc->common.function_name->val);
513        }
514        if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
515            zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
516                fbc->common.scope ? fbc->common.scope->name->val : "",
517                fbc->common.scope ? "::" : "",
518                fbc->common.function_name->val);
519            if (UNEXPECTED(EG(exception) != NULL)) {
520                HANDLE_EXCEPTION();
521            }
522        }
523    }
524    if (fbc->common.scope &&
525        !(fbc->common.fn_flags & ZEND_ACC_STATIC) &&
526        !call->object) {
527
528        if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
529            /* FIXME: output identifiers properly */
530            zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
531            if (UNEXPECTED(EG(exception) != NULL)) {
532                HANDLE_EXCEPTION();
533            }
534        } else {
535            /* FIXME: output identifiers properly */
536            /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
537            zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name->val, fbc->common.function_name->val);
538        }
539    }
540
541    LOAD_OPLINE();
542
543    if (UNEXPECTED(fbc->type == ZEND_INTERNAL_FUNCTION)) {
544        int should_change_scope = 0;
545        zval *ret;
546
547        if (fbc->common.scope) {
548            should_change_scope = 1;
549            Z_OBJ(EG(This)) = call->object;
550            /* TODO: we don't set scope if we call an object method ??? */
551            /* See: ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt */
552#if 1
553            EG(scope) = (call->object) ? NULL : fbc->common.scope;
554#else
555            EG(scope) = fbc->common.scope;
556#endif
557        } else {
558            call->called_scope = EX(called_scope);
559        }
560
561        call->prev_execute_data = execute_data;
562        EG(current_execute_data) = call;
563
564        if (fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) {
565            uint32_t i;
566            zval *p = ZEND_CALL_ARG(call, 1);
567
568            for (i = 0; i < call->num_args; ++i) {
569                zend_verify_arg_type(fbc, i + 1, p, 0 TSRMLS_CC);
570                p++;
571            }
572            if (UNEXPECTED(EG(exception) != NULL)) {
573                EG(current_execute_data) = call->prev_execute_data;
574                zend_vm_stack_free_args(call TSRMLS_CC);
575                zend_vm_stack_free_call_frame(call TSRMLS_CC);
576                if (RETURN_VALUE_USED(opline)) {
577                    ZVAL_UNDEF(EX_VAR(opline->result.var));
578                }
579                if (UNEXPECTED(should_change_scope)) {
580                    goto fcall_end_change_scope;
581                } else {
582                    goto fcall_end;
583                }
584            }
585        }
586
587        ret = EX_VAR(opline->result.var);
588        ZVAL_NULL(ret);
589        Z_VAR_FLAGS_P(ret) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
590
591        if (!zend_execute_internal) {
592            /* saves one function call if zend_execute_internal is not used */
593            fbc->internal_function.handler(call->num_args, ret TSRMLS_CC);
594        } else {
595            zend_execute_internal(call, ret TSRMLS_CC);
596        }
597        EG(current_execute_data) = call->prev_execute_data;
598        zend_vm_stack_free_args(call TSRMLS_CC);
599        zend_vm_stack_free_call_frame(call TSRMLS_CC);
600
601        if (!RETURN_VALUE_USED(opline)) {
602            zval_ptr_dtor(ret);
603        }
604
605        if (UNEXPECTED(should_change_scope)) {
606            goto fcall_end_change_scope;
607        } else {
608            goto fcall_end;
609        }
610    } else if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
611        zval *return_value = NULL;
612
613        Z_OBJ(EG(This)) = call->object;
614        EG(scope) = fbc->common.scope;
615        call->symbol_table = NULL;
616        if (RETURN_VALUE_USED(opline)) {
617            return_value = EX_VAR(opline->result.var);
618
619            ZVAL_NULL(return_value);
620            Z_VAR_FLAGS_P(return_value) = (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0 ? IS_VAR_RET_REF : 0;
621        }
622
623        if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
624            if (RETURN_VALUE_USED(opline)) {
625                zend_generator_create_zval(call, &fbc->op_array, EX_VAR(opline->result.var) TSRMLS_CC);
626            } else {
627                zend_vm_stack_free_args(call TSRMLS_CC);
628            }
629
630            zend_vm_stack_free_call_frame(call TSRMLS_CC);
631        } else {
632            call->prev_execute_data = execute_data;
633            i_init_func_execute_data(call, &fbc->op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_FUNCTION : VM_FRAME_TOP_FUNCTION TSRMLS_CC);
634
635            if (EXPECTED(zend_execute_ex == execute_ex)) {
636                ZEND_VM_ENTER();
637            } else {
638                zend_execute_ex(call TSRMLS_CC);
639            }
640        }
641    } else { /* ZEND_OVERLOADED_FUNCTION */
642        Z_OBJ(EG(This)) = call->object;
643        EG(scope) = fbc->common.scope;
644
645        ZVAL_NULL(EX_VAR(opline->result.var));
646
647        /* Not sure what should be done here if it's a static method */
648        if (EXPECTED(call->object != NULL)) {
649            call->prev_execute_data = execute_data;
650            EG(current_execute_data) = call;
651            call->object->handlers->call_method(fbc->common.function_name, call->object, call->num_args, EX_VAR(opline->result.var) TSRMLS_CC);
652            EG(current_execute_data) = call->prev_execute_data;
653        } else {
654            zend_error_noreturn(E_ERROR, "Cannot call overloaded function for non-object");
655        }
656
657        zend_vm_stack_free_args(call TSRMLS_CC);
658
659        zend_vm_stack_free_call_frame(call TSRMLS_CC);
660
661        if (fbc->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
662            zend_string_release(fbc->common.function_name);
663        }
664        efree(fbc);
665
666        if (!RETURN_VALUE_USED(opline)) {
667            zval_ptr_dtor(EX_VAR(opline->result.var));
668        } else {
669//???           Z_UNSET_ISREF_P(EX_T(opline->result.var).var.ptr);
670//???           Z_SET_REFCOUNT_P(EX_T(opline->result.var).var.ptr, 1);
671            Z_VAR_FLAGS_P(EX_VAR(opline->result.var)) = 0;
672        }
673    }
674
675fcall_end_change_scope:
676    if (Z_OBJ(EG(This))) {
677        if (UNEXPECTED(EG(exception) != NULL) && (opline->op1.num & ZEND_CALL_CTOR)) {
678            if (!(opline->op1.num & ZEND_CALL_CTOR_RESULT_UNUSED)) {
679                Z_DELREF(EG(This));
680            }
681            if (Z_REFCOUNT(EG(This)) == 1) {
682                zend_object_store_ctor_failed(Z_OBJ(EG(This)) TSRMLS_CC);
683            }
684        }
685        if (!Z_DELREF(EG(This))) {
686            _zval_dtor_func_for_ptr(Z_COUNTED(EG(This)) ZEND_FILE_LINE_CC);
687        } else if (UNEXPECTED(!Z_GC_INFO(EG(This)))) {
688            gc_possible_root(Z_COUNTED(EG(This)) TSRMLS_CC);
689        }
690    }
691    Z_OBJ(EG(This)) = EX(object);
692    EG(scope) = EX(scope);
693
694fcall_end:
695    if (UNEXPECTED(EG(exception) != NULL)) {
696        zend_throw_exception_internal(NULL TSRMLS_CC);
697        if (RETURN_VALUE_USED(opline)) {
698            zval_ptr_dtor(EX_VAR(opline->result.var));
699        }
700        HANDLE_EXCEPTION();
701    }
702
703    ZEND_VM_NEXT_OPCODE();
704}
705
706static int ZEND_FASTCALL  ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
707{
708    /* The generator object is stored in EX(return_value) */
709    zend_generator *generator = (zend_generator *) EX(return_value);
710
711    /* Close the generator to free up resources */
712    zend_generator_close(generator, 1 TSRMLS_CC);
713
714    /* Pass execution back to handling code */
715    ZEND_VM_RETURN();
716}
717
718static int ZEND_FASTCALL  ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
719{
720    USE_OPLINE
721    zend_free_op free_op1;
722    zval *args;
723    int arg_num;
724    SAVE_OPLINE();
725
726    args = get_zval_ptr(opline->op1_type, &opline->op1, execute_data, &free_op1, BP_VAR_R);
727    arg_num = EX(call)->num_args + 1;
728
729send_again:
730    switch (Z_TYPE_P(args)) {
731        case IS_ARRAY: {
732            HashTable *ht = Z_ARRVAL_P(args);
733            zval *arg, *top;
734            zend_string *name;
735
736            zend_vm_stack_extend_call_frame(&EX(call), arg_num - 1, zend_hash_num_elements(ht) TSRMLS_CC);
737
738            if (opline->op1_type != IS_CONST && opline->op1_type != IS_TMP_VAR && Z_IMMUTABLE_P(args)) {
739                int i;
740                int separate = 0;
741
742                /* check if any of arguments are going to be passed by reference */
743                for (i = 0; i < zend_hash_num_elements(ht); i++) {
744                    if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num + i)) {
745                        separate = 1;
746                        break;
747                    }
748                }
749                if (separate) {
750                    zval_copy_ctor(args);
751                    ht = Z_ARRVAL_P(args);
752                }
753            }
754
755            ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
756                if (name) {
757                    zend_error(E_RECOVERABLE_ERROR, "Cannot unpack array with string keys");
758                    FREE_OP(free_op1);
759                    CHECK_EXCEPTION();
760                    ZEND_VM_NEXT_OPCODE();
761                }
762
763                top = ZEND_CALL_ARG(EX(call), arg_num);
764                if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
765                    if (!Z_IMMUTABLE_P(args)) {
766                        ZVAL_MAKE_REF(arg);
767                        Z_ADDREF_P(arg);
768                        ZVAL_REF(top, Z_REF_P(arg));
769                    } else {
770                        ZVAL_DUP(top, arg);
771                    }
772                } else if (Z_ISREF_P(arg)) {
773                    ZVAL_COPY(top, Z_REFVAL_P(arg));
774                } else {
775                    ZVAL_COPY(top, arg);
776                }
777
778                EX(call)->num_args++;
779                arg_num++;
780            } ZEND_HASH_FOREACH_END();
781
782            break;
783        }
784        case IS_OBJECT: {
785            zend_class_entry *ce = Z_OBJCE_P(args);
786            zend_object_iterator *iter;
787
788            if (!ce || !ce->get_iterator) {
789                zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
790                break;
791            }
792
793            iter = ce->get_iterator(ce, args, 0 TSRMLS_CC);
794            if (UNEXPECTED(!iter)) {
795                FREE_OP(free_op1);
796                if (!EG(exception)) {
797                    zend_throw_exception_ex(
798                        NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name->val
799                    );
800                }
801                HANDLE_EXCEPTION();
802            }
803
804            if (iter->funcs->rewind) {
805                iter->funcs->rewind(iter TSRMLS_CC);
806                if (UNEXPECTED(EG(exception) != NULL)) {
807                    goto unpack_iter_dtor;
808                }
809            }
810
811            for (; iter->funcs->valid(iter TSRMLS_CC) == SUCCESS; ++arg_num) {
812                zval *arg, *top;
813
814                if (UNEXPECTED(EG(exception) != NULL)) {
815                    goto unpack_iter_dtor;
816                }
817
818                arg = iter->funcs->get_current_data(iter TSRMLS_CC);
819                if (UNEXPECTED(EG(exception) != NULL)) {
820                    goto unpack_iter_dtor;
821                }
822
823                if (iter->funcs->get_current_key) {
824                    zval key;
825                    iter->funcs->get_current_key(iter, &key TSRMLS_CC);
826                    if (UNEXPECTED(EG(exception) != NULL)) {
827                        goto unpack_iter_dtor;
828                    }
829
830                    if (Z_TYPE(key) == IS_STRING) {
831                        zend_error(E_RECOVERABLE_ERROR,
832                            "Cannot unpack Traversable with string keys");
833                        zval_dtor(&key);
834                        goto unpack_iter_dtor;
835                    }
836
837                    zval_dtor(&key);
838                }
839
840                if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
841                    zend_error(
842                        E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()"
843                        " by unpacking a Traversable, passing by-value instead", arg_num,
844                        EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "",
845                        EX(call)->func->common.scope ? "::" : "",
846                        EX(call)->func->common.function_name->val
847                    );
848                }
849
850                if (Z_ISREF_P(arg)) {
851                    ZVAL_DUP(arg, Z_REFVAL_P(arg));
852                } else {
853                    if (Z_REFCOUNTED_P(arg)) Z_ADDREF_P(arg);
854                }
855
856                zend_vm_stack_extend_call_frame(&EX(call), arg_num - 1, 1 TSRMLS_CC);
857                top = ZEND_CALL_ARG(EX(call), arg_num);
858                ZVAL_COPY_VALUE(top, arg);
859                EX(call)->num_args++;
860
861                iter->funcs->move_forward(iter TSRMLS_CC);
862                if (UNEXPECTED(EG(exception) != NULL)) {
863                    goto unpack_iter_dtor;
864                }
865            }
866
867unpack_iter_dtor:
868            zend_iterator_dtor(iter TSRMLS_CC);
869            break;
870        }
871        case IS_REFERENCE:
872            args = Z_REFVAL_P(args);
873            goto send_again;
874            break;
875        default:
876            zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
877    }
878
879    FREE_OP(free_op1);
880    CHECK_EXCEPTION();
881    ZEND_VM_NEXT_OPCODE();
882}
883
884static int ZEND_FASTCALL  ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
885{
886    USE_OPLINE
887    zend_free_op free_op1;
888    zval *args;
889    SAVE_OPLINE();
890
891    args = get_zval_ptr_deref(opline->op1_type, &opline->op1, execute_data, &free_op1, BP_VAR_R);
892
893    if (Z_TYPE_P(args) != IS_ARRAY) {
894        zend_error(E_WARNING, "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
895        if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
896            OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
897        }
898        if (EX(call)->object) {
899            OBJ_RELEASE(EX(call)->object);
900        }
901        EX(call)->func = (zend_function*)&zend_pass_function;
902        EX(call)->called_scope = NULL;
903        EX(call)->object = NULL;
904    } else {
905        uint32_t arg_num = 1;
906
907        HashTable *ht = Z_ARRVAL_P(args);
908        zval *arg, *param, tmp;
909
910        zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht) TSRMLS_CC);
911
912        if (opline->op1_type != IS_CONST && opline->op1_type != IS_TMP_VAR && Z_IMMUTABLE_P(args)) {
913            uint32_t i;
914            int separate = 0;
915
916            /* check if any of arguments are going to be passed by reference */
917            for (i = 0; i < zend_hash_num_elements(ht); i++) {
918                if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num + i)) {
919                    separate = 1;
920                    break;
921                }
922            }
923            if (separate) {
924                zval_copy_ctor(args);
925                ht = Z_ARRVAL_P(args);
926            }
927        }
928
929        param = ZEND_CALL_ARG(EX(call), arg_num);
930        ZEND_HASH_FOREACH_VAL(ht, arg) {
931            if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
932                // TODO: Scalar values don't have reference counters anymore.
933                // They are assumed to be 1, and they may be easily passed by
934                // reference now. However, previously scalars with refcount==1
935                // might be passed and with refcount>1 might not. We can support
936                // only single behavior ???
937#if 0
938                if (Z_REFCOUNTED_P(arg) &&
939                    // This solution breaks the following test (omit warning message) ???
940                    // Zend/tests/bug61273.phpt
941                    // ext/reflection/tests/bug42976.phpt
942                    // ext/standard/tests/general_functions/call_user_func_array_variation_001.phpt
943#else
944                if (!Z_REFCOUNTED_P(arg) ||
945                    // This solution breaks the following test (emit warning message) ???
946                    // ext/pdo_sqlite/tests/pdo_005.phpt
947#endif
948                    (!Z_ISREF_P(arg) && Z_REFCOUNT_P(arg) > 1)) {
949
950                    if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
951
952                        zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
953                            arg_num,
954                            EX(call)->func->common.scope ? EX(call)->func->common.scope->name->val : "",
955                            EX(call)->func->common.scope ? "::" : "",
956                            EX(call)->func->common.function_name->val);
957
958                        if (EX(call)->func->common.fn_flags & ZEND_ACC_CLOSURE) {
959                            OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
960                        }
961                        if (EX(call)->object) {
962                            OBJ_RELEASE(EX(call)->object);
963                        }
964                        EX(call)->func = (zend_function*)&zend_pass_function;
965                        EX(call)->called_scope = NULL;
966                        EX(call)->object = NULL;
967
968                        break;
969                    }
970
971                    if (Z_REFCOUNTED_P(arg)) {
972                        Z_DELREF_P(arg);
973                    }
974                    ZVAL_DUP(&tmp, arg);
975                    ZVAL_NEW_REF(arg, &tmp);
976                    Z_ADDREF_P(arg);
977                } else if (!Z_ISREF_P(arg)) {
978                    ZVAL_NEW_REF(arg, arg);
979                    Z_ADDREF_P(arg);
980                } else if (Z_REFCOUNTED_P(arg)) {
981                    Z_ADDREF_P(arg);
982                }
983                ZVAL_COPY_VALUE(param, arg);
984            } else if (Z_ISREF_P(arg) &&
985                   /* don't separate references for __call */
986                   (EX(call)->func->common.fn_flags & ZEND_ACC_CALL_VIA_HANDLER) == 0) {
987                ZVAL_DUP(param, Z_REFVAL_P(arg));
988            } else {
989                ZVAL_COPY(param, arg);
990            }
991            EX(call)->num_args++;
992            arg_num++;
993            param++;
994        } ZEND_HASH_FOREACH_END();
995    }
996    FREE_OP(free_op1);
997    CHECK_EXCEPTION();
998    ZEND_VM_NEXT_OPCODE();
999}
1000
1001static int ZEND_FASTCALL  ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1002{
1003    USE_OPLINE
1004    uint32_t arg_num = opline->op1.num;
1005
1006    SAVE_OPLINE();
1007    if (UNEXPECTED(arg_num > EX(num_args))) {
1008        zend_verify_missing_arg(execute_data, arg_num TSRMLS_CC);
1009        CHECK_EXCEPTION();
1010    } else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
1011        zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
1012
1013        zend_verify_arg_type(EX(func), arg_num, param, opline->extended_value TSRMLS_CC);
1014        CHECK_EXCEPTION();
1015    }
1016
1017    ZEND_VM_NEXT_OPCODE();
1018}
1019
1020static int ZEND_FASTCALL  ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1021{
1022    USE_OPLINE
1023    uint32_t arg_num = opline->op1.num;
1024    uint32_t arg_count = EX(num_args);
1025    zval *params;
1026
1027    SAVE_OPLINE();
1028
1029    params = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
1030
1031    if (arg_num <= arg_count) {
1032        zval *param;
1033
1034        array_init_size(params, arg_count - arg_num + 1);
1035        param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
1036        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
1037            do {
1038                zend_verify_arg_type(EX(func), arg_num, param, opline->extended_value TSRMLS_CC);
1039                zend_hash_next_index_insert_new(Z_ARRVAL_P(params), param);
1040                if (Z_REFCOUNTED_P(param)) Z_ADDREF_P(param);
1041                param++;
1042            } while (++arg_num <= arg_count);
1043        } else {
1044            do {
1045                zend_hash_next_index_insert_new(Z_ARRVAL_P(params), param);
1046                if (Z_REFCOUNTED_P(param)) Z_ADDREF_P(param);
1047                param++;
1048            } while (++arg_num <= arg_count);
1049        }
1050    } else {
1051        array_init(params);
1052    }
1053
1054    CHECK_EXCEPTION();
1055    ZEND_VM_NEXT_OPCODE();
1056}
1057
1058static int ZEND_FASTCALL  ZEND_NEW_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1059{
1060    USE_OPLINE
1061    zval object_zval;
1062    zend_function *constructor;
1063
1064    SAVE_OPLINE();
1065    if (UNEXPECTED((Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) {
1066        if (Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & ZEND_ACC_INTERFACE) {
1067            zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
1068        } else if ((Z_CE_P(EX_VAR(opline->op1.var))->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
1069            zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
1070        } else {
1071            zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", Z_CE_P(EX_VAR(opline->op1.var))->name->val);
1072        }
1073    }
1074    object_init_ex(&object_zval, Z_CE_P(EX_VAR(opline->op1.var)));
1075    constructor = Z_OBJ_HT(object_zval)->get_constructor(Z_OBJ(object_zval) TSRMLS_CC);
1076
1077    if (constructor == NULL) {
1078        if (RETURN_VALUE_USED(opline)) {
1079            ZVAL_COPY_VALUE(EX_VAR(opline->result.var), &object_zval);
1080        } else {
1081            zval_ptr_dtor(&object_zval);
1082        }
1083        ZEND_VM_JMP(opline->op2.jmp_addr);
1084    } else {
1085        /* We are not handling overloaded classes right now */
1086        EX(call) = zend_vm_stack_push_call_frame(
1087            constructor, opline->extended_value,
1088            RETURN_VALUE_USED(opline) ?
1089                ZEND_CALL_CTOR : (ZEND_CALL_CTOR | ZEND_CALL_CTOR_RESULT_UNUSED),
1090            Z_CE_P(EX_VAR(opline->op1.var)),
1091            Z_OBJ(object_zval),
1092            EX(call) TSRMLS_CC);
1093
1094        if (RETURN_VALUE_USED(opline)) {
1095            ZVAL_COPY(EX_VAR(opline->result.var), &object_zval);
1096            EX(call)->return_value = EX_VAR(opline->result.var);
1097        } else {
1098            EX(call)->return_value = NULL;
1099        }
1100
1101        CHECK_EXCEPTION();
1102        ZEND_VM_NEXT_OPCODE();
1103    }
1104}
1105
1106static int ZEND_FASTCALL  ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1107{
1108    USE_OPLINE
1109
1110    SAVE_OPLINE();
1111    ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
1112    if (Z_TYPE(EX(old_error_reporting)) == IS_UNDEF) {
1113        ZVAL_LONG(&EX(old_error_reporting), EG(error_reporting));
1114    }
1115
1116    if (EG(error_reporting)) {
1117        do {
1118            EG(error_reporting) = 0;
1119            if (!EG(error_reporting_ini_entry)) {
1120                zend_ini_entry *p = zend_hash_str_find_ptr(EG(ini_directives), "error_reporting", sizeof("error_reporting")-1);
1121                if (p) {
1122                    EG(error_reporting_ini_entry) = p;
1123                } else {
1124                    break;
1125                }
1126            }
1127            if (!EG(error_reporting_ini_entry)->modified) {
1128                if (!EG(modified_ini_directives)) {
1129                    ALLOC_HASHTABLE(EG(modified_ini_directives));
1130                    zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
1131                }
1132                if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
1133                    EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
1134                    EG(error_reporting_ini_entry)->orig_value_length = EG(error_reporting_ini_entry)->value_length;
1135                    EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
1136                    EG(error_reporting_ini_entry)->modified = 1;
1137                }
1138            } else if (EG(error_reporting_ini_entry)->value != EG(error_reporting_ini_entry)->orig_value) {
1139                efree(EG(error_reporting_ini_entry)->value);
1140            }
1141            EG(error_reporting_ini_entry)->value = estrndup("0", sizeof("0")-1);
1142            EG(error_reporting_ini_entry)->value_length = sizeof("0")-1;
1143        } while (0);
1144    }
1145    CHECK_EXCEPTION();
1146    ZEND_VM_NEXT_OPCODE();
1147}
1148
1149static int ZEND_FASTCALL  ZEND_RAISE_ABSTRACT_ERROR_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1150{
1151    SAVE_OPLINE();
1152    zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(scope)->name->val, EX(func)->op_array.function_name->val);
1153    ZEND_VM_NEXT_OPCODE(); /* Never reached */
1154}
1155
1156static int ZEND_FASTCALL  ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1157{
1158    SAVE_OPLINE();
1159    if (!EG(no_extensions)) {
1160        zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(func) TSRMLS_CC);
1161    }
1162    CHECK_EXCEPTION();
1163    ZEND_VM_NEXT_OPCODE();
1164}
1165
1166static int ZEND_FASTCALL  ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1167{
1168    SAVE_OPLINE();
1169    if (!EG(no_extensions)) {
1170        zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(func) TSRMLS_CC);
1171    }
1172    CHECK_EXCEPTION();
1173    ZEND_VM_NEXT_OPCODE();
1174}
1175
1176static int ZEND_FASTCALL  ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1177{
1178    SAVE_OPLINE();
1179    if (!EG(no_extensions)) {
1180        zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(func) TSRMLS_CC);
1181    }
1182    CHECK_EXCEPTION();
1183    ZEND_VM_NEXT_OPCODE();
1184}
1185
1186static int ZEND_FASTCALL  ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1187{
1188    USE_OPLINE
1189
1190    SAVE_OPLINE();
1191    Z_CE_P(EX_VAR(opline->result.var)) = do_bind_class(&EX(func)->op_array, opline, EG(class_table), 0 TSRMLS_CC);
1192    CHECK_EXCEPTION();
1193    ZEND_VM_NEXT_OPCODE();
1194}
1195
1196static int ZEND_FASTCALL  ZEND_DECLARE_INHERITED_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1197{
1198    USE_OPLINE
1199
1200    SAVE_OPLINE();
1201    Z_CE_P(EX_VAR(opline->result.var)) = do_bind_inherited_class(&EX(func)->op_array, opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0 TSRMLS_CC);
1202    CHECK_EXCEPTION();
1203    ZEND_VM_NEXT_OPCODE();
1204}
1205
1206static int ZEND_FASTCALL  ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1207{
1208    USE_OPLINE
1209    zval *zce, *orig_zce;
1210
1211    SAVE_OPLINE();
1212    if ((zce = zend_hash_find(EG(class_table), Z_STR_P(opline->op2.zv))) == NULL ||
1213        ((orig_zce = zend_hash_find(EG(class_table), Z_STR_P(opline->op1.zv))) != NULL &&
1214         Z_CE_P(zce) != Z_CE_P(orig_zce))) {
1215        do_bind_inherited_class(&EX(func)->op_array, opline, EG(class_table), Z_CE_P(EX_VAR(opline->extended_value)), 0 TSRMLS_CC);
1216    }
1217    CHECK_EXCEPTION();
1218    ZEND_VM_NEXT_OPCODE();
1219}
1220
1221static int ZEND_FASTCALL  ZEND_DECLARE_FUNCTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1222{
1223    USE_OPLINE
1224
1225    SAVE_OPLINE();
1226    do_bind_function(&EX(func)->op_array, opline, EG(function_table), 0 TSRMLS_CC);
1227    CHECK_EXCEPTION();
1228    ZEND_VM_NEXT_OPCODE();
1229}
1230
1231static int ZEND_FASTCALL  ZEND_TICKS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1232{
1233    USE_OPLINE
1234
1235    SAVE_OPLINE();
1236    if (++EG(ticks_count)>=opline->extended_value) {
1237        EG(ticks_count)=0;
1238        if (zend_ticks_function) {
1239            zend_ticks_function(opline->extended_value TSRMLS_CC);
1240        }
1241    }
1242    CHECK_EXCEPTION();
1243    ZEND_VM_NEXT_OPCODE();
1244}
1245
1246static int ZEND_FASTCALL  ZEND_EXT_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1247{
1248    ZEND_VM_NEXT_OPCODE();
1249}
1250
1251static int ZEND_FASTCALL  ZEND_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1252{
1253    ZEND_VM_NEXT_OPCODE();
1254}
1255
1256static int ZEND_FASTCALL  ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1257{
1258    USE_OPLINE
1259    zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
1260    zend_class_entry *trait;
1261
1262    SAVE_OPLINE();
1263    if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
1264        trait = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
1265    } else {
1266        trait = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv),
1267                                         opline->op2.zv + 1,
1268                                         opline->extended_value TSRMLS_CC);
1269        if (UNEXPECTED(trait == NULL)) {
1270            CHECK_EXCEPTION();
1271            ZEND_VM_NEXT_OPCODE();
1272        }
1273        if (!((trait->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT)) {
1274            zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ce->name->val, trait->name->val);
1275        }
1276        CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), trait);
1277    }
1278
1279    zend_do_implement_trait(ce, trait TSRMLS_CC);
1280
1281    CHECK_EXCEPTION();
1282    ZEND_VM_NEXT_OPCODE();
1283}
1284
1285static int ZEND_FASTCALL  ZEND_BIND_TRAITS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1286{
1287    USE_OPLINE
1288    zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
1289
1290    SAVE_OPLINE();
1291    zend_do_bind_traits(ce TSRMLS_CC);
1292    CHECK_EXCEPTION();
1293    ZEND_VM_NEXT_OPCODE();
1294}
1295
1296static int ZEND_FASTCALL  ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1297{
1298    uint32_t op_num = EG(opline_before_exception) - EX(func)->op_array.opcodes;
1299    int i;
1300    uint32_t catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
1301
1302    for (i = 0; i < EX(func)->op_array.last_try_catch; i++) {
1303        if (EX(func)->op_array.try_catch_array[i].try_op > op_num) {
1304            /* further blocks will not be relevant... */
1305            break;
1306        }
1307        if (op_num < EX(func)->op_array.try_catch_array[i].catch_op) {
1308            catch_op_num = EX(func)->op_array.try_catch_array[i].catch_op;
1309        }
1310        if (op_num < EX(func)->op_array.try_catch_array[i].finally_op) {
1311            finally_op_num = EX(func)->op_array.try_catch_array[i].finally_op;
1312        }
1313        if (op_num >= EX(func)->op_array.try_catch_array[i].finally_op &&
1314                op_num < EX(func)->op_array.try_catch_array[i].finally_end) {
1315            finally_op_end = EX(func)->op_array.try_catch_array[i].finally_end;
1316        }
1317    }
1318
1319    if (EX(call)) {
1320        zend_execute_data *call = EX(call);
1321        do {
1322            /* If the exception was thrown during a function call there might be
1323             * arguments pushed to the stack that have to be dtor'ed. */
1324            zend_vm_stack_free_args(EX(call) TSRMLS_CC);
1325
1326            if (call->object) {
1327                if (call->flags & ZEND_CALL_CTOR) {
1328                    if (!(call->flags & ZEND_CALL_CTOR_RESULT_UNUSED)) {
1329                        GC_REFCOUNT(call->object)--;
1330                    }
1331                    if (GC_REFCOUNT(call->object) == 1) {
1332                        zend_object_store_ctor_failed(call->object TSRMLS_CC);
1333                    }
1334                }
1335                OBJ_RELEASE(call->object);
1336            }
1337            EX(call) = call->prev_nested_call;
1338            zend_vm_stack_free_call_frame(call TSRMLS_CC);
1339            call = EX(call);
1340        } while (call);
1341    }
1342
1343    for (i = 0; i < EX(func)->op_array.last_brk_cont; i++) {
1344        if (EX(func)->op_array.brk_cont_array[i].start < 0) {
1345            continue;
1346        } else if (EX(func)->op_array.brk_cont_array[i].start > op_num) {
1347            /* further blocks will not be relevant... */
1348            break;
1349        } else if (op_num < EX(func)->op_array.brk_cont_array[i].brk) {
1350            if (!catch_op_num ||
1351                catch_op_num >= EX(func)->op_array.brk_cont_array[i].brk) {
1352                zend_op *brk_opline = &EX(func)->op_array.opcodes[EX(func)->op_array.brk_cont_array[i].brk];
1353
1354                if (brk_opline->opcode == ZEND_SWITCH_FREE) {
1355                    if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
1356                        zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
1357                    }
1358                } else if (brk_opline->opcode == ZEND_FREE) {
1359                    if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
1360                        zval_dtor(EX_VAR(brk_opline->op1.var));
1361                    }
1362                }
1363            }
1364        }
1365    }
1366
1367    /* restore previous error_reporting value */
1368    if (!EG(error_reporting) && Z_TYPE(EX(old_error_reporting)) != IS_UNDEF && Z_LVAL(EX(old_error_reporting)) != 0) {
1369        zval restored_error_reporting;
1370        zend_string *key;
1371
1372        ZVAL_LONG(&restored_error_reporting, Z_LVAL(EX(old_error_reporting)));
1373        convert_to_string(&restored_error_reporting);
1374        key = zend_string_init("error_reporting", sizeof("error_reporting")-1, 0);
1375        zend_alter_ini_entry_ex(key, Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME, 1 TSRMLS_CC);
1376        zend_string_free(key);
1377        zval_dtor(&restored_error_reporting);
1378    }
1379    ZVAL_UNDEF(&EX(old_error_reporting));
1380
1381    if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
1382        if (EX(delayed_exception)) {
1383            zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
1384        }
1385        EX(delayed_exception) = EG(exception);
1386        EG(exception) = NULL;
1387        EX(fast_ret) = NULL;
1388        ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[finally_op_num]);
1389        ZEND_VM_CONTINUE();
1390    } else if (catch_op_num) {
1391        if (finally_op_end && catch_op_num > finally_op_end) {
1392            /* we are going out of current finally scope */
1393            if (EX(delayed_exception)) {
1394                zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
1395                EX(delayed_exception) = NULL;
1396            }
1397        }
1398        ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[catch_op_num]);
1399        ZEND_VM_CONTINUE();
1400    } else {
1401        if (EX(delayed_exception)) {
1402            zend_exception_set_previous(EG(exception), EX(delayed_exception) TSRMLS_CC);
1403            EX(delayed_exception) = NULL;
1404        }
1405        if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1406            return ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1407        } else {
1408            return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1409        }
1410    }
1411}
1412
1413static int ZEND_FASTCALL  ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1414{
1415    USE_OPLINE
1416
1417    SAVE_OPLINE();
1418    zend_verify_abstract_class(Z_CE_P(EX_VAR(opline->op1.var)) TSRMLS_CC);
1419    CHECK_EXCEPTION();
1420    ZEND_VM_NEXT_OPCODE();
1421}
1422
1423static int ZEND_FASTCALL  ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1424{
1425    USE_OPLINE
1426    int ret;
1427
1428    SAVE_OPLINE();
1429    ret = zend_user_opcode_handlers[opline->opcode](ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_INTERNAL);
1430    LOAD_OPLINE();
1431
1432    switch (ret) {
1433        case ZEND_USER_OPCODE_CONTINUE:
1434            ZEND_VM_CONTINUE();
1435        case ZEND_USER_OPCODE_RETURN:
1436            if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1437                return ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1438            } else {
1439                return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1440            }
1441        case ZEND_USER_OPCODE_ENTER:
1442            ZEND_VM_ENTER();
1443        case ZEND_USER_OPCODE_LEAVE:
1444            ZEND_VM_LEAVE();
1445        case ZEND_USER_OPCODE_DISPATCH:
1446            ZEND_VM_DISPATCH(opline->opcode, opline);
1447        default:
1448            ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline);
1449    }
1450}
1451
1452static int ZEND_FASTCALL  ZEND_DISCARD_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1453{
1454    if (EX(delayed_exception) != NULL) {
1455        /* discard the previously thrown exception */
1456        OBJ_RELEASE(EX(delayed_exception));
1457        EX(delayed_exception) = NULL;
1458    }
1459
1460    ZEND_VM_NEXT_OPCODE();
1461}
1462
1463static int ZEND_FASTCALL  ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1464{
1465    USE_OPLINE
1466
1467    if ((opline->extended_value & ZEND_FAST_CALL_FROM_CATCH) &&
1468        UNEXPECTED(EG(prev_exception) != NULL)) {
1469        /* in case of unhandled exception jump to catch block instead of finally */
1470        ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]);
1471        ZEND_VM_CONTINUE();
1472    }
1473    EX(fast_ret) = opline;
1474    EX(delayed_exception) = NULL;
1475    ZEND_VM_SET_OPCODE(opline->op1.jmp_addr);
1476    ZEND_VM_CONTINUE();
1477}
1478
1479static int ZEND_FASTCALL  ZEND_FAST_RET_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1480{
1481    if (EX(fast_ret)) {
1482        ZEND_VM_SET_OPCODE(EX(fast_ret) + 1);
1483        if ((EX(fast_ret)->extended_value & ZEND_FAST_CALL_FROM_FINALLY)) {
1484            EX(fast_ret) = &EX(func)->op_array.opcodes[EX(fast_ret)->op2.opline_num];
1485        }
1486        ZEND_VM_CONTINUE();
1487    } else {
1488        /* special case for unhandled exceptions */
1489        USE_OPLINE
1490
1491        if (opline->extended_value == ZEND_FAST_RET_TO_FINALLY) {
1492            ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]);
1493            ZEND_VM_CONTINUE();
1494        } else {
1495            EG(exception) = EX(delayed_exception);
1496            EX(delayed_exception) = NULL;
1497            if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
1498                ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[opline->op2.opline_num]);
1499                ZEND_VM_CONTINUE();
1500            } else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1501                return ZEND_GENERATOR_RETURN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1502            } else {
1503                return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
1504            }
1505        }
1506    }
1507}
1508
1509static int ZEND_FASTCALL  ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1510{
1511    USE_OPLINE
1512
1513    SAVE_OPLINE();
1514    if (EG(exception)) {
1515        zend_exception_save(TSRMLS_C);
1516    }
1517    if (IS_CONST == IS_UNUSED) {
1518        Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
1519        CHECK_EXCEPTION();
1520        ZEND_VM_NEXT_OPCODE();
1521    } else {
1522
1523        zval *class_name = opline->op2.zv;
1524
1525        if (IS_CONST == IS_CONST) {
1526            if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
1527                Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
1528            } else {
1529                Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
1530                CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
1531            }
1532        } else if (Z_TYPE_P(class_name) == IS_OBJECT) {
1533            Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
1534        } else if (Z_TYPE_P(class_name) == IS_STRING) {
1535            Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
1536        } else {
1537            if (UNEXPECTED(EG(exception) != NULL)) {
1538                HANDLE_EXCEPTION();
1539            }
1540            zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
1541        }
1542
1543        CHECK_EXCEPTION();
1544        ZEND_VM_NEXT_OPCODE();
1545    }
1546}
1547
1548static int ZEND_FASTCALL  ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1549{
1550    USE_OPLINE
1551    zend_function *fbc;
1552    zval *function_name, *func;
1553
1554    if (IS_CONST == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
1555        function_name = (zval*)(opline->op2.zv+1);
1556        if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
1557            fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
1558        } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
1559            SAVE_OPLINE();
1560            zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
1561        } else {
1562            fbc = Z_FUNC_P(func);
1563            CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
1564        }
1565
1566        EX(call) = zend_vm_stack_push_call_frame(
1567            fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
1568
1569        /*CHECK_EXCEPTION();*/
1570        ZEND_VM_NEXT_OPCODE();
1571    } else {
1572        zend_string *lcname;
1573
1574        zend_class_entry *called_scope;
1575        zend_object *object;
1576        zval *function_name_ptr;
1577
1578        SAVE_OPLINE();
1579        function_name_ptr = function_name = opline->op2.zv;
1580
1581        ZVAL_DEREF(function_name);
1582        if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
1583            if (Z_STRVAL_P(function_name)[0] == '\\') {
1584                lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
1585                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
1586            } else {
1587                lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
1588                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
1589            }
1590            if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
1591                zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
1592            }
1593            zend_string_free(lcname);
1594
1595            fbc = Z_FUNC_P(func);
1596            called_scope = NULL;
1597            object = NULL;
1598        } else if (IS_CONST != IS_CONST &&
1599            EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
1600            Z_OBJ_HANDLER_P(function_name, get_closure) &&
1601            Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
1602            if (object) {
1603                GC_REFCOUNT(object)++;
1604            }
1605            if (IS_CONST == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
1606                fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
1607                /* Delay closure destruction until its invocation */
1608                fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
1609            } else if (IS_CONST == IS_CV) {
1610
1611            }
1612        } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
1613                zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
1614            zval *obj;
1615            zval *method;
1616
1617            obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
1618            method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
1619
1620            if (!obj || !method) {
1621                zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
1622            }
1623
1624            ZVAL_DEREF(obj);
1625            if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
1626                zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
1627            }
1628
1629            ZVAL_DEREF(method);
1630            if (Z_TYPE_P(method) != IS_STRING) {
1631                zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
1632            }
1633
1634            if (Z_TYPE_P(obj) == IS_STRING) {
1635                object = NULL;
1636                called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
1637                if (UNEXPECTED(called_scope == NULL)) {
1638                    CHECK_EXCEPTION();
1639                    ZEND_VM_NEXT_OPCODE();
1640                }
1641
1642                if (called_scope->get_static_method) {
1643                    fbc = called_scope->get_static_method(called_scope, Z_STR_P(method) TSRMLS_CC);
1644                } else {
1645                    fbc = zend_std_get_static_method(called_scope, Z_STR_P(method), NULL TSRMLS_CC);
1646                }
1647                if (UNEXPECTED(fbc == NULL)) {
1648                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
1649                }
1650            } else {
1651                called_scope = Z_OBJCE_P(obj);
1652                object = Z_OBJ_P(obj);
1653
1654                fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
1655                if (UNEXPECTED(fbc == NULL)) {
1656                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
1657                }
1658
1659                if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
1660                    object = NULL;
1661                } else {
1662                    GC_REFCOUNT(object)++; /* For $this pointer */
1663                }
1664            }
1665
1666        } else {
1667            if (UNEXPECTED(EG(exception) != NULL)) {
1668                HANDLE_EXCEPTION();
1669            }
1670            zend_error_noreturn(E_ERROR, "Function name must be a string");
1671            ZEND_VM_CONTINUE(); /* Never reached */
1672        }
1673        EX(call) = zend_vm_stack_push_call_frame(
1674            fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
1675
1676        CHECK_EXCEPTION();
1677        ZEND_VM_NEXT_OPCODE();
1678    }
1679}
1680
1681static int ZEND_FASTCALL  ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1682{
1683    USE_OPLINE
1684    zval *func_name;
1685    zval *func;
1686    zend_function *fbc;
1687
1688    func_name = opline->op2.zv + 1;
1689    if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
1690        fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
1691    } else if ((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL) {
1692        func_name++;
1693        if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(func_name))) == NULL)) {
1694            SAVE_OPLINE();
1695            zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
1696        } else {
1697            fbc = Z_FUNC_P(func);
1698            CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
1699        }
1700    } else {
1701        fbc = Z_FUNC_P(func);
1702        CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
1703    }
1704
1705    EX(call) = zend_vm_stack_push_call_frame(
1706        fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
1707
1708    ZEND_VM_NEXT_OPCODE();
1709}
1710
1711static int ZEND_FASTCALL  ZEND_INIT_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1712{
1713    USE_OPLINE
1714
1715    zval *fname = opline->op2.zv;
1716    zval *func;
1717    zend_function *fbc;
1718
1719    if (CACHED_PTR(Z_CACHE_SLOT_P(fname))) {
1720        fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
1721    } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(fname))) == NULL)) {
1722        SAVE_OPLINE();
1723        zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(fname));
1724    } else {
1725        fbc = Z_FUNC_P(func);
1726        CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc);
1727    }
1728
1729    EX(call) = zend_vm_stack_push_call_frame(
1730        fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
1731
1732    ZEND_VM_NEXT_OPCODE();
1733}
1734
1735static int ZEND_FASTCALL  ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1736{
1737    USE_OPLINE
1738    uint32_t arg_num = opline->op1.num;
1739    zval *param;
1740
1741    SAVE_OPLINE();
1742    param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var TSRMLS_CC);
1743    if (arg_num > EX(num_args)) {
1744        ZVAL_COPY_VALUE(param, opline->op2.zv);
1745        if (Z_OPT_CONSTANT_P(param)) {
1746            zval_update_constant(param, 0 TSRMLS_CC);
1747        } else {
1748            /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
1749            if (UNEXPECTED(Z_OPT_COPYABLE_P(param))) {
1750                zval_copy_ctor_func(param);
1751            }
1752        }
1753    }
1754
1755    if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
1756        zend_verify_arg_type(EX(func), arg_num, param, opline->extended_value TSRMLS_CC);
1757    }
1758
1759    CHECK_EXCEPTION();
1760    ZEND_VM_NEXT_OPCODE();
1761}
1762
1763static int ZEND_FASTCALL  ZEND_BRK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1764{
1765    USE_OPLINE
1766    zend_brk_cont_element *el;
1767
1768    SAVE_OPLINE();
1769    el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
1770                       &EX(func)->op_array, execute_data TSRMLS_CC);
1771    ZEND_VM_JMP(EX(func)->op_array.opcodes + el->brk);
1772}
1773
1774static int ZEND_FASTCALL  ZEND_CONT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1775{
1776    USE_OPLINE
1777    zend_brk_cont_element *el;
1778
1779    SAVE_OPLINE();
1780    el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->op1.opline_num,
1781                       &EX(func)->op_array, execute_data TSRMLS_CC);
1782    ZEND_VM_JMP(EX(func)->op_array.opcodes + el->cont);
1783}
1784
1785static int ZEND_FASTCALL  ZEND_GOTO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1786{
1787    zend_op *brk_opline;
1788    USE_OPLINE
1789    zend_brk_cont_element *el;
1790
1791    SAVE_OPLINE();
1792    el = zend_brk_cont(Z_LVAL_P(opline->op2.zv), opline->extended_value,
1793                       &EX(func)->op_array, execute_data TSRMLS_CC);
1794
1795    brk_opline = EX(func)->op_array.opcodes + el->brk;
1796
1797    if (brk_opline->opcode == ZEND_SWITCH_FREE) {
1798        if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
1799            zval_ptr_dtor(EX_VAR(brk_opline->op1.var));
1800        }
1801    } else if (brk_opline->opcode == ZEND_FREE) {
1802        if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
1803            zval_dtor(EX_VAR(brk_opline->op1.var));
1804        }
1805    }
1806    ZEND_VM_JMP(opline->op1.jmp_addr);
1807}
1808
1809static int ZEND_FASTCALL  ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1810{
1811    USE_OPLINE
1812    zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
1813    zend_class_entry *iface;
1814
1815    SAVE_OPLINE();
1816    if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
1817        iface = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
1818    } else {
1819        iface = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
1820        if (UNEXPECTED(iface == NULL)) {
1821            CHECK_EXCEPTION();
1822            ZEND_VM_NEXT_OPCODE();
1823        }
1824        CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), iface);
1825    }
1826
1827    if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) {
1828        zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ce->name->val, iface->name->val);
1829    }
1830    zend_do_implement_interface(ce, iface TSRMLS_CC);
1831
1832    CHECK_EXCEPTION();
1833    ZEND_VM_NEXT_OPCODE();
1834}
1835
1836static int ZEND_FASTCALL  ZEND_FETCH_CLASS_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1837{
1838    USE_OPLINE
1839
1840    SAVE_OPLINE();
1841    if (EG(exception)) {
1842        zend_exception_save(TSRMLS_C);
1843    }
1844    if (IS_TMP_VAR == IS_UNUSED) {
1845        Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
1846        CHECK_EXCEPTION();
1847        ZEND_VM_NEXT_OPCODE();
1848    } else {
1849        zend_free_op free_op2;
1850        zval *class_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
1851
1852        if (IS_TMP_VAR == IS_CONST) {
1853            if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
1854                Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
1855            } else {
1856                Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
1857                CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
1858            }
1859        } else if (Z_TYPE_P(class_name) == IS_OBJECT) {
1860            Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
1861        } else if (Z_TYPE_P(class_name) == IS_STRING) {
1862            Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
1863        } else {
1864            if (UNEXPECTED(EG(exception) != NULL)) {
1865                HANDLE_EXCEPTION();
1866            }
1867            zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
1868        }
1869
1870        zval_dtor(free_op2.var);
1871        CHECK_EXCEPTION();
1872        ZEND_VM_NEXT_OPCODE();
1873    }
1874}
1875
1876static int ZEND_FASTCALL  ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1877{
1878    USE_OPLINE
1879    zend_function *fbc;
1880    zval *function_name, *func;
1881
1882    if (IS_TMP_VAR == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
1883        function_name = (zval*)(opline->op2.zv+1);
1884        if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
1885            fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
1886        } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
1887            SAVE_OPLINE();
1888            zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
1889        } else {
1890            fbc = Z_FUNC_P(func);
1891            CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
1892        }
1893
1894        EX(call) = zend_vm_stack_push_call_frame(
1895            fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
1896
1897        /*CHECK_EXCEPTION();*/
1898        ZEND_VM_NEXT_OPCODE();
1899    } else {
1900        zend_string *lcname;
1901        zend_free_op free_op2;
1902        zend_class_entry *called_scope;
1903        zend_object *object;
1904        zval *function_name_ptr;
1905
1906        SAVE_OPLINE();
1907        function_name_ptr = function_name = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
1908
1909        ZVAL_DEREF(function_name);
1910        if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
1911            if (Z_STRVAL_P(function_name)[0] == '\\') {
1912                lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
1913                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
1914            } else {
1915                lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
1916                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
1917            }
1918            if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
1919                zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
1920            }
1921            zend_string_free(lcname);
1922            zval_dtor(free_op2.var);
1923
1924            fbc = Z_FUNC_P(func);
1925            called_scope = NULL;
1926            object = NULL;
1927        } else if (IS_TMP_VAR != IS_CONST &&
1928            EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
1929            Z_OBJ_HANDLER_P(function_name, get_closure) &&
1930            Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
1931            if (object) {
1932                GC_REFCOUNT(object)++;
1933            }
1934            if (IS_TMP_VAR == IS_VAR && 1 && Z_REFCOUNT_P(function_name) == 1 &&
1935                fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
1936                /* Delay closure destruction until its invocation */
1937                fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
1938            } else if (IS_TMP_VAR == IS_CV) {
1939                zval_dtor(free_op2.var);
1940            }
1941        } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
1942                zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
1943            zval *obj;
1944            zval *method;
1945
1946            obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
1947            method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
1948
1949            if (!obj || !method) {
1950                zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
1951            }
1952
1953            ZVAL_DEREF(obj);
1954            if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
1955                zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
1956            }
1957
1958            ZVAL_DEREF(method);
1959            if (Z_TYPE_P(method) != IS_STRING) {
1960                zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
1961            }
1962
1963            if (Z_TYPE_P(obj) == IS_STRING) {
1964                object = NULL;
1965                called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
1966                if (UNEXPECTED(called_scope == NULL)) {
1967                    CHECK_EXCEPTION();
1968                    ZEND_VM_NEXT_OPCODE();
1969                }
1970
1971                if (called_scope->get_static_method) {
1972                    fbc = called_scope->get_static_method(called_scope, Z_STR_P(method) TSRMLS_CC);
1973                } else {
1974                    fbc = zend_std_get_static_method(called_scope, Z_STR_P(method), NULL TSRMLS_CC);
1975                }
1976                if (UNEXPECTED(fbc == NULL)) {
1977                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
1978                }
1979            } else {
1980                called_scope = Z_OBJCE_P(obj);
1981                object = Z_OBJ_P(obj);
1982
1983                fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
1984                if (UNEXPECTED(fbc == NULL)) {
1985                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
1986                }
1987
1988                if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
1989                    object = NULL;
1990                } else {
1991                    GC_REFCOUNT(object)++; /* For $this pointer */
1992                }
1993            }
1994            zval_dtor(free_op2.var);
1995        } else {
1996            if (UNEXPECTED(EG(exception) != NULL)) {
1997                HANDLE_EXCEPTION();
1998            }
1999            zend_error_noreturn(E_ERROR, "Function name must be a string");
2000            ZEND_VM_CONTINUE(); /* Never reached */
2001        }
2002        EX(call) = zend_vm_stack_push_call_frame(
2003            fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
2004
2005        CHECK_EXCEPTION();
2006        ZEND_VM_NEXT_OPCODE();
2007    }
2008}
2009
2010static int ZEND_FASTCALL  ZEND_FETCH_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2011{
2012    USE_OPLINE
2013
2014    SAVE_OPLINE();
2015    if (EG(exception)) {
2016        zend_exception_save(TSRMLS_C);
2017    }
2018    if (IS_VAR == IS_UNUSED) {
2019        Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
2020        CHECK_EXCEPTION();
2021        ZEND_VM_NEXT_OPCODE();
2022    } else {
2023        zend_free_op free_op2;
2024        zval *class_name = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
2025
2026        if (IS_VAR == IS_CONST) {
2027            if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
2028                Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2029            } else {
2030                Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
2031                CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
2032            }
2033        } else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2034            Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2035        } else if (Z_TYPE_P(class_name) == IS_STRING) {
2036            Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
2037        } else {
2038            if (UNEXPECTED(EG(exception) != NULL)) {
2039                HANDLE_EXCEPTION();
2040            }
2041            zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
2042        }
2043
2044        zval_ptr_dtor_nogc(free_op2.var);
2045        CHECK_EXCEPTION();
2046        ZEND_VM_NEXT_OPCODE();
2047    }
2048}
2049
2050static int ZEND_FASTCALL  ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2051{
2052    USE_OPLINE
2053    zend_function *fbc;
2054    zval *function_name, *func;
2055
2056    if (IS_VAR == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
2057        function_name = (zval*)(opline->op2.zv+1);
2058        if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
2059            fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
2060        } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
2061            SAVE_OPLINE();
2062            zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
2063        } else {
2064            fbc = Z_FUNC_P(func);
2065            CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
2066        }
2067
2068        EX(call) = zend_vm_stack_push_call_frame(
2069            fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
2070
2071        /*CHECK_EXCEPTION();*/
2072        ZEND_VM_NEXT_OPCODE();
2073    } else {
2074        zend_string *lcname;
2075        zend_free_op free_op2;
2076        zend_class_entry *called_scope;
2077        zend_object *object;
2078        zval *function_name_ptr;
2079
2080        SAVE_OPLINE();
2081        function_name_ptr = function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2 TSRMLS_CC);
2082
2083        ZVAL_DEREF(function_name);
2084        if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
2085            if (Z_STRVAL_P(function_name)[0] == '\\') {
2086                lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
2087                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
2088            } else {
2089                lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
2090                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
2091            }
2092            if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
2093                zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
2094            }
2095            zend_string_free(lcname);
2096            zval_ptr_dtor_nogc(free_op2.var);
2097
2098            fbc = Z_FUNC_P(func);
2099            called_scope = NULL;
2100            object = NULL;
2101        } else if (IS_VAR != IS_CONST &&
2102            EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
2103            Z_OBJ_HANDLER_P(function_name, get_closure) &&
2104            Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
2105            if (object) {
2106                GC_REFCOUNT(object)++;
2107            }
2108            if (IS_VAR == IS_VAR && (free_op2.var != NULL) && Z_REFCOUNT_P(function_name) == 1 &&
2109                fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
2110                /* Delay closure destruction until its invocation */
2111                fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
2112            } else if (IS_VAR == IS_CV) {
2113                zval_ptr_dtor_nogc(free_op2.var);
2114            }
2115        } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
2116                zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
2117            zval *obj;
2118            zval *method;
2119
2120            obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
2121            method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
2122
2123            if (!obj || !method) {
2124                zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
2125            }
2126
2127            ZVAL_DEREF(obj);
2128            if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
2129                zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
2130            }
2131
2132            ZVAL_DEREF(method);
2133            if (Z_TYPE_P(method) != IS_STRING) {
2134                zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
2135            }
2136
2137            if (Z_TYPE_P(obj) == IS_STRING) {
2138                object = NULL;
2139                called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
2140                if (UNEXPECTED(called_scope == NULL)) {
2141                    CHECK_EXCEPTION();
2142                    ZEND_VM_NEXT_OPCODE();
2143                }
2144
2145                if (called_scope->get_static_method) {
2146                    fbc = called_scope->get_static_method(called_scope, Z_STR_P(method) TSRMLS_CC);
2147                } else {
2148                    fbc = zend_std_get_static_method(called_scope, Z_STR_P(method), NULL TSRMLS_CC);
2149                }
2150                if (UNEXPECTED(fbc == NULL)) {
2151                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
2152                }
2153            } else {
2154                called_scope = Z_OBJCE_P(obj);
2155                object = Z_OBJ_P(obj);
2156
2157                fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
2158                if (UNEXPECTED(fbc == NULL)) {
2159                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
2160                }
2161
2162                if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
2163                    object = NULL;
2164                } else {
2165                    GC_REFCOUNT(object)++; /* For $this pointer */
2166                }
2167            }
2168            zval_ptr_dtor_nogc(free_op2.var);
2169        } else {
2170            if (UNEXPECTED(EG(exception) != NULL)) {
2171                HANDLE_EXCEPTION();
2172            }
2173            zend_error_noreturn(E_ERROR, "Function name must be a string");
2174            ZEND_VM_CONTINUE(); /* Never reached */
2175        }
2176        EX(call) = zend_vm_stack_push_call_frame(
2177            fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
2178
2179        CHECK_EXCEPTION();
2180        ZEND_VM_NEXT_OPCODE();
2181    }
2182}
2183
2184static int ZEND_FASTCALL  ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2185{
2186    USE_OPLINE
2187
2188    SAVE_OPLINE();
2189    if (EG(exception)) {
2190        zend_exception_save(TSRMLS_C);
2191    }
2192    if (IS_UNUSED == IS_UNUSED) {
2193        Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
2194        CHECK_EXCEPTION();
2195        ZEND_VM_NEXT_OPCODE();
2196    } else {
2197
2198        zval *class_name = NULL;
2199
2200        if (IS_UNUSED == IS_CONST) {
2201            if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
2202                Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2203            } else {
2204                Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
2205                CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
2206            }
2207        } else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2208            Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2209        } else if (Z_TYPE_P(class_name) == IS_STRING) {
2210            Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
2211        } else {
2212            if (UNEXPECTED(EG(exception) != NULL)) {
2213                HANDLE_EXCEPTION();
2214            }
2215            zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
2216        }
2217
2218        CHECK_EXCEPTION();
2219        ZEND_VM_NEXT_OPCODE();
2220    }
2221}
2222
2223static int ZEND_FASTCALL  ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2224{
2225    USE_OPLINE
2226
2227    SAVE_OPLINE();
2228    if (EG(exception)) {
2229        zend_exception_save(TSRMLS_C);
2230    }
2231    if (IS_CV == IS_UNUSED) {
2232        Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value TSRMLS_CC);
2233        CHECK_EXCEPTION();
2234        ZEND_VM_NEXT_OPCODE();
2235    } else {
2236
2237        zval *class_name = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
2238
2239        if (IS_CV == IS_CONST) {
2240            if (CACHED_PTR(Z_CACHE_SLOT_P(class_name))) {
2241                Z_CE_P(EX_VAR(opline->result.var)) = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2242            } else {
2243                Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class_by_name(Z_STR_P(class_name), opline->op2.zv + 1, opline->extended_value TSRMLS_CC);
2244                CACHE_PTR(Z_CACHE_SLOT_P(class_name), Z_CE_P(EX_VAR(opline->result.var)));
2245            }
2246        } else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2247            Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2248        } else if (Z_TYPE_P(class_name) == IS_STRING) {
2249            Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value TSRMLS_CC);
2250        } else {
2251            if (UNEXPECTED(EG(exception) != NULL)) {
2252                HANDLE_EXCEPTION();
2253            }
2254            zend_error_noreturn(E_ERROR, "Class name must be a valid object or a string");
2255        }
2256
2257        CHECK_EXCEPTION();
2258        ZEND_VM_NEXT_OPCODE();
2259    }
2260}
2261
2262static int ZEND_FASTCALL  ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2263{
2264    USE_OPLINE
2265    zend_function *fbc;
2266    zval *function_name, *func;
2267
2268    if (IS_CV == IS_CONST && Z_TYPE_P(opline->op2.zv) == IS_STRING) {
2269        function_name = (zval*)(opline->op2.zv+1);
2270        if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
2271            fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
2272        } else if (UNEXPECTED((func = zend_hash_find(EG(function_table), Z_STR_P(function_name))) == NULL)) {
2273            SAVE_OPLINE();
2274            zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(opline->op2.zv));
2275        } else {
2276            fbc = Z_FUNC_P(func);
2277            CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), fbc);
2278        }
2279
2280        EX(call) = zend_vm_stack_push_call_frame(
2281            fbc, opline->extended_value, 0, NULL, NULL, EX(call) TSRMLS_CC);
2282
2283        /*CHECK_EXCEPTION();*/
2284        ZEND_VM_NEXT_OPCODE();
2285    } else {
2286        zend_string *lcname;
2287
2288        zend_class_entry *called_scope;
2289        zend_object *object;
2290        zval *function_name_ptr;
2291
2292        SAVE_OPLINE();
2293        function_name_ptr = function_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC);
2294
2295        ZVAL_DEREF(function_name);
2296        if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
2297            if (Z_STRVAL_P(function_name)[0] == '\\') {
2298                lcname = zend_string_alloc(Z_STRLEN_P(function_name) - 1, 0);
2299                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name) + 1, Z_STRLEN_P(function_name) - 1);
2300            } else {
2301                lcname = zend_string_alloc(Z_STRLEN_P(function_name), 0);
2302                zend_str_tolower_copy(lcname->val, Z_STRVAL_P(function_name), Z_STRLEN_P(function_name));
2303            }
2304            if (UNEXPECTED((func = zend_hash_find(EG(function_table), lcname)) == NULL)) {
2305                zend_error_noreturn(E_ERROR, "Call to undefined function %s()", Z_STRVAL_P(function_name));
2306            }
2307            zend_string_free(lcname);
2308
2309            fbc = Z_FUNC_P(func);
2310            called_scope = NULL;
2311            object = NULL;
2312        } else if (IS_CV != IS_CONST &&
2313            EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT) &&
2314            Z_OBJ_HANDLER_P(function_name, get_closure) &&
2315            Z_OBJ_HANDLER_P(function_name, get_closure)(function_name, &called_scope, &fbc, &object TSRMLS_CC) == SUCCESS) {
2316            if (object) {
2317                GC_REFCOUNT(object)++;
2318            }
2319            if (IS_CV == IS_VAR && 0 && Z_REFCOUNT_P(function_name) == 1 &&
2320                fbc->common.fn_flags & ZEND_ACC_CLOSURE) {
2321                /* Delay closure destruction until its invocation */
2322                fbc->common.prototype = (zend_function*)Z_OBJ_P(function_name_ptr);
2323            } else if (IS_CV == IS_CV) {
2324
2325            }
2326        } else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY) &&
2327                zend_hash_num_elements(Z_ARRVAL_P(function_name)) == 2) {
2328            zval *obj;
2329            zval *method;
2330
2331            obj = zend_hash_index_find(Z_ARRVAL_P(function_name), 0);
2332            method = zend_hash_index_find(Z_ARRVAL_P(function_name), 1);
2333
2334            if (!obj || !method) {
2335                zend_error_noreturn(E_ERROR, "Array callback has to contain indices 0 and 1");
2336            }
2337
2338            ZVAL_DEREF(obj);
2339            if (Z_TYPE_P(obj) != IS_STRING && Z_TYPE_P(obj) != IS_OBJECT) {
2340                zend_error_noreturn(E_ERROR, "First array member is not a valid class name or object");
2341            }
2342
2343            ZVAL_DEREF(method);
2344            if (Z_TYPE_P(method) != IS_STRING) {
2345                zend_error_noreturn(E_ERROR, "Second array member is not a valid method");
2346            }
2347
2348            if (Z_TYPE_P(obj) == IS_STRING) {
2349                object = NULL;
2350                called_scope = zend_fetch_class_by_name(Z_STR_P(obj), NULL, 0 TSRMLS_CC);
2351                if (UNEXPECTED(called_scope == NULL)) {
2352                    CHECK_EXCEPTION();
2353                    ZEND_VM_NEXT_OPCODE();
2354                }
2355
2356                if (called_scope->get_static_method) {
2357                    fbc = called_scope->get_static_method(called_scope, Z_STR_P(method) TSRMLS_CC);
2358                } else {
2359                    fbc = zend_std_get_static_method(called_scope, Z_STR_P(method), NULL TSRMLS_CC);
2360                }
2361                if (UNEXPECTED(fbc == NULL)) {
2362                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method));
2363                }
2364            } else {
2365                called_scope = Z_OBJCE_P(obj);
2366                object = Z_OBJ_P(obj);
2367
2368                fbc = Z_OBJ_HT_P(obj)->get_method(&object, Z_STR_P(method), NULL TSRMLS_CC);
2369                if (UNEXPECTED(fbc == NULL)) {
2370                    zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", Z_OBJ_CLASS_NAME_P(object), Z_STRVAL_P(method));
2371                }
2372
2373                if ((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0) {
2374                    object = NULL;
2375                } else {
2376                    GC_REFCOUNT(object)++; /* For $this pointer */
2377                }
2378            }
2379
2380        } else {
2381            if (UNEXPECTED(EG(exception) != NULL)) {
2382                HANDLE_EXCEPTION();
2383            }
2384            zend_error_noreturn(E_ERROR, "Function name must be a string");
2385            ZEND_VM_CONTINUE(); /* Never reached */
2386        }
2387        EX(call) = zend_vm_stack_push_call_frame(
2388            fbc, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
2389
2390        CHECK_EXCEPTION();
2391        ZEND_VM_NEXT_OPCODE();
2392    }
2393}
2394
2395static int ZEND_FASTCALL  ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2396{
2397    USE_OPLINE
2398
2399
2400    SAVE_OPLINE();
2401    bitwise_not_function(EX_VAR(opline->result.var),
2402        opline->op1.zv TSRMLS_CC);
2403
2404    CHECK_EXCEPTION();
2405    ZEND_VM_NEXT_OPCODE();
2406}
2407
2408static int ZEND_FASTCALL  ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2409{
2410    USE_OPLINE
2411
2412
2413    SAVE_OPLINE();
2414    boolean_not_function(EX_VAR(opline->result.var),
2415        opline->op1.zv TSRMLS_CC);
2416
2417    CHECK_EXCEPTION();
2418    ZEND_VM_NEXT_OPCODE();
2419}
2420
2421static int ZEND_FASTCALL  ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2422{
2423    USE_OPLINE
2424
2425    zval *z;
2426
2427    SAVE_OPLINE();
2428    z = opline->op1.zv;
2429
2430    zend_print_variable(z TSRMLS_CC);
2431
2432    CHECK_EXCEPTION();
2433    ZEND_VM_NEXT_OPCODE();
2434}
2435
2436static int ZEND_FASTCALL  ZEND_PRINT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2437{
2438    USE_OPLINE
2439
2440    ZVAL_LONG(EX_VAR(opline->result.var), 1);
2441    return ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
2442}
2443
2444static int ZEND_FASTCALL  ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2445{
2446    USE_OPLINE
2447
2448    zval *val;
2449
2450    SAVE_OPLINE();
2451    val = opline->op1.zv;
2452
2453    if (IS_CONST == IS_TMP_VAR) {
2454        if (Z_TYPE_P(val) == IS_TRUE) {
2455            ZEND_VM_SET_OPCODE(opline + 1);
2456            ZEND_VM_CONTINUE();
2457        } else if (EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
2458            ZEND_VM_SET_OPCODE(opline->op2.jmp_addr);
2459            ZEND_VM_CONTINUE();
2460        }
2461    }
2462
2463    if (i_zend_is_true(val TSRMLS_CC)) {
2464        opline++;
2465    } else {
2466        opline = opline->op2.jmp_addr;
2467    }
2468
2469    if (UNEXPECTED(EG(exception) != NULL)) {
2470        HANDLE_EXCEPTION();
2471    }
2472    ZEND_VM_JMP(opline);
2473}
2474
2475static int ZEND_FASTCALL  ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2476{
2477    USE_OPLINE
2478
2479    zval *val;
2480
2481    SAVE_OPLINE();
2482    val = opline->op1.zv;
2483
2484    if (IS_CONST == IS_TMP_VAR) {
2485        if (Z_TYPE_P(val) == IS_TRUE) {
2486            ZEND_VM_SET_OPCODE(opline->op2.jmp_addr);
2487            ZEND_VM_CONTINUE();
2488        } else if (EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
2489            ZEND_VM_SET_OPCODE(opline + 1);
2490            ZEND_VM_CONTINUE();
2491        }
2492    }
2493
2494    if (i_zend_is_true(val TSRMLS_CC)) {
2495        opline = opline->op2.jmp_addr;
2496    } else {
2497        opline++;
2498    }
2499
2500    if (UNEXPECTED(EG(exception) != NULL)) {
2501        HANDLE_EXCEPTION();
2502    }
2503    ZEND_VM_JMP(opline);
2504}
2505
2506static int ZEND_FASTCALL  ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2507{
2508    USE_OPLINE
2509
2510    zval *val;
2511
2512    SAVE_OPLINE();
2513    val = opline->op1.zv;
2514
2515    if (IS_CONST == IS_TMP_VAR) {
2516        if (EXPECTED(Z_TYPE_P(val) == IS_TRUE)) {
2517            ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
2518            ZEND_VM_CONTINUE();
2519        } else if (EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
2520            ZEND_VM_SET_OPCODE(opline->op2.jmp_addr);
2521            ZEND_VM_CONTINUE();
2522        }
2523    }
2524
2525    if (i_zend_is_true(val TSRMLS_CC)) {
2526        opline = (zend_op*)(((char*)opline) + opline->extended_value);
2527    } else {
2528        opline = opline->op2.jmp_addr;
2529    }
2530
2531    if (UNEXPECTED(EG(exception) != NULL)) {
2532        HANDLE_EXCEPTION();
2533    }
2534    ZEND_VM_JMP(opline);
2535}
2536
2537static int ZEND_FASTCALL  ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2538{
2539    USE_OPLINE
2540
2541    zval *val;
2542
2543    SAVE_OPLINE();
2544    val = opline->op1.zv;
2545
2546    if (IS_CONST == IS_TMP_VAR) {
2547        if (Z_TYPE_P(val) == IS_TRUE) {
2548            ZVAL_TRUE(EX_VAR(opline->result.var));
2549            ZEND_VM_SET_OPCODE(opline + 1);
2550            ZEND_VM_CONTINUE();
2551        } else if (EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
2552            ZVAL_FALSE(EX_VAR(opline->result.var));
2553            ZEND_VM_SET_OPCODE(opline->op2.jmp_addr);
2554            ZEND_VM_CONTINUE();
2555        }
2556    }
2557
2558    if (i_zend_is_true(val TSRMLS_CC)) {
2559        ZVAL_TRUE(EX_VAR(opline->result.var));
2560        opline++;
2561    } else {
2562        ZVAL_FALSE(EX_VAR(opline->result.var));
2563        opline = opline->op2.jmp_addr;
2564    }
2565
2566    if (UNEXPECTED(EG(exception) != NULL)) {
2567        HANDLE_EXCEPTION();
2568    }
2569    ZEND_VM_JMP(opline);
2570}
2571
2572static int ZEND_FASTCALL  ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2573{
2574    USE_OPLINE
2575
2576    zval *val;
2577
2578    SAVE_OPLINE();
2579    val = opline->op1.zv;
2580
2581    if (IS_CONST == IS_TMP_VAR) {
2582        if (Z_TYPE_P(val) == IS_TRUE) {
2583            ZVAL_TRUE(EX_VAR(opline->result.var));
2584            ZEND_VM_SET_OPCODE(opline->op2.jmp_addr);
2585            ZEND_VM_CONTINUE();
2586        } else if (EXPECTED(Z_TYPE_P(val) <= IS_TRUE)) {
2587            ZVAL_FALSE(EX_VAR(opline->result.var));
2588            ZEND_VM_SET_OPCODE(opline + 1);
2589            ZEND_VM_CONTINUE();
2590        }
2591    }
2592    if (i_zend_is_true(val TSRMLS_CC)) {
2593        ZVAL_TRUE(EX_VAR(opline->result.var));
2594        opline = opline->op2.jmp_addr;
2595    } else {
2596        ZVAL_FALSE(EX_VAR(opline->result.var));
2597        opline++;
2598    }
2599
2600    if (UNEXPECTED(EG(exception) != NULL)) {
2601        HANDLE_EXCEPTION();
2602    }
2603    ZEND_VM_JMP(opline);
2604}
2605
2606static int ZEND_FASTCALL  ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2607{
2608    USE_OPLINE
2609    zval *retval_ptr;
2610
2611
2612    SAVE_OPLINE();
2613    retval_ptr = opline->op1.zv;
2614
2615    if (!EX(return_value)) {
2616
2617    } else {
2618        if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
2619            ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
2620            if (IS_CONST == IS_CONST) {
2621                if (UNEXPECTED(Z_OPT_COPYABLE_P(EX(return_value)))) {
2622                    zval_copy_ctor_func(EX(return_value));
2623                }
2624            }
2625        } else if (Z_ISREF_P(retval_ptr)) {
2626            ZVAL_COPY(EX(return_value), Z_REFVAL_P(retval_ptr));
2627
2628        } else {
2629            ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
2630            if (IS_CONST == IS_CV) {
2631                if (Z_OPT_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
2632            }
2633        }
2634    }
2635    return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
2636}
2637
2638static int ZEND_FASTCALL  ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2639{
2640    USE_OPLINE
2641    zval *retval_ptr;
2642
2643
2644    SAVE_OPLINE();
2645
2646    do {
2647        if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR ||
2648            (IS_CONST == IS_VAR && opline->extended_value == ZEND_RETURNS_VALUE)) {
2649            /* Not supposed to happen, but we'll allow it */
2650            zend_error(E_NOTICE, "Only variable references should be returned by reference");
2651
2652            retval_ptr = opline->op1.zv;
2653            if (!EX(return_value)) {
2654                if (IS_CONST == IS_TMP_VAR) {
2655
2656                }
2657            } else {
2658                ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
2659                if (IS_CONST != IS_TMP_VAR) {
2660                    zval_opt_copy_ctor_no_imm(EX(return_value));
2661                }
2662            }
2663            break;
2664        }
2665
2666        retval_ptr = NULL;
2667
2668        if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(retval_ptr) == IS_STR_OFFSET)) {
2669            zend_error_noreturn(E_ERROR, "Cannot return string offsets by reference");
2670        }
2671
2672        if (IS_CONST == IS_VAR && !Z_ISREF_P(retval_ptr)) {
2673            if (opline->extended_value == ZEND_RETURNS_FUNCTION &&
2674                (Z_VAR_FLAGS_P(retval_ptr) & IS_VAR_RET_REF)) {
2675            } else {
2676                zend_error(E_NOTICE, "Only variable references should be returned by reference");
2677                if (EX(return_value)) {
2678                    zval tmp;
2679                    ZVAL_DUP(&tmp, retval_ptr);
2680                    ZVAL_NEW_REF(EX(return_value), &tmp);
2681                }
2682                break;
2683            }
2684        }
2685
2686        if (EX(return_value)) {
2687            ZVAL_MAKE_REF(retval_ptr);
2688            Z_ADDREF_P(retval_ptr);
2689            ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
2690        }
2691    } while (0);
2692
2693    return zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
2694}
2695
2696static int ZEND_FASTCALL  ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2697{
2698    USE_OPLINE
2699    zval *value;
2700
2701
2702    SAVE_OPLINE();
2703    value = opline->op1.zv;
2704
2705    if (IS_CONST == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
2706        if (UNEXPECTED(EG(exception) != NULL)) {
2707            HANDLE_EXCEPTION();
2708        }
2709        zend_error_noreturn(E_ERROR, "Can only throw objects");
2710    }
2711
2712    zend_exception_save(TSRMLS_C);
2713    if (IS_CONST != IS_TMP_VAR) {
2714        if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
2715    }
2716
2717    zend_throw_exception_object(value TSRMLS_CC);
2718    zend_exception_restore(TSRMLS_C);
2719
2720    HANDLE_EXCEPTION();
2721}
2722
2723static int ZEND_FASTCALL  ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2724{
2725    USE_OPLINE
2726    zval *value, *arg;
2727
2728
2729    SAVE_OPLINE();
2730    value = opline->op1.zv;
2731    arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
2732    EX(call)->num_args = opline->op2.num;
2733    ZVAL_COPY_VALUE(arg, value);
2734    if (IS_CONST == IS_CONST) {
2735        if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) {
2736            zval_copy_ctor_func(arg);
2737        }
2738    }
2739    ZEND_VM_NEXT_OPCODE();
2740}
2741
2742static int ZEND_FASTCALL  ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2743{
2744    USE_OPLINE
2745    zval *value, *arg;
2746
2747
2748    SAVE_OPLINE();
2749    if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, opline->op2.num)) {
2750        zend_error_noreturn(E_ERROR, "Cannot pass parameter %d by reference", opline->op2.num);
2751    }
2752    value = opline->op1.zv;
2753    arg = ZEND_CALL_ARG(EX(call), opline->op2.num);
2754    EX(call)->num_args = opline->op2.num;
2755    ZVAL_COPY_VALUE(arg, value);
2756    if (IS_CONST == IS_CONST) {
2757        if (UNEXPECTED(Z_OPT_COPYABLE_P(arg))) {
2758            zval_copy_ctor_func(arg);
2759        }
2760    }
2761    ZEND_VM_NEXT_OPCODE();
2762}
2763
2764static int ZEND_FASTCALL  ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2765{
2766    USE_OPLINE
2767
2768    zval *retval = EX_VAR(opline->result.var);
2769
2770    SAVE_OPLINE();
2771    /* PHP 3.0 returned "" for false and 1 for true, here we use 0 and 1 for now */
2772    ZVAL_BOOL(retval, i_zend_is_true(opline->op1.zv TSRMLS_CC));
2773
2774    CHECK_EXCEPTION();
2775    ZEND_VM_NEXT_OPCODE();
2776}
2777
2778static int ZEND_FASTCALL  ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2779{
2780    USE_OPLINE
2781
2782    zval *obj;
2783    zend_class_entry *ce;
2784    zend_function *clone;
2785    zend_object_clone_obj_t clone_call;
2786
2787    SAVE_OPLINE();
2788    obj = opline->op1.zv;
2789
2790    if (IS_CONST == IS_CONST ||
2791        UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT)) {
2792        if (UNEXPECTED(EG(exception) != NULL)) {
2793            HANDLE_EXCEPTION();
2794        }
2795        zend_error_noreturn(E_ERROR, "__clone method called on non-object");
2796    }
2797
2798    ce = Z_OBJCE_P(obj);
2799    clone = ce ? ce->clone : NULL;
2800    clone_call =  Z_OBJ_HT_P(obj)->clone_obj;
2801    if (UNEXPECTED(clone_call == NULL)) {
2802        if (ce) {
2803            zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object of class %s", ce->name->val);
2804        } else {
2805            zend_error_noreturn(E_ERROR, "Trying to clone an uncloneable object");
2806        }
2807    }
2808
2809    if (ce && clone) {
2810        if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
2811            /* Ensure that if we're calling a private function, we're allowed to do so.
2812             */
2813            if (UNEXPECTED(ce != EX(scope))) {
2814                zend_error_noreturn(E_ERROR, "Call to private %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
2815            }
2816        } else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
2817            /* Ensure that if we're calling a protected function, we're allowed to do so.
2818             */
2819            if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), EX(scope)))) {
2820                zend_error_noreturn(E_ERROR, "Call to protected %s::__clone() from context '%s'", ce->name->val, EX(scope) ? EX(scope)->name->val : "");
2821            }
2822        }
2823    }
2824
2825    if (EXPECTED(EG(exception) == NULL)) {
2826        ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj TSRMLS_CC));
2827        if (!RETURN_VALUE_USED(opline) || UNEXPECTED(EG(exception) != NULL)) {
2828            zval_ptr_dtor(EX_VAR(opline->result.var));
2829        }
2830    }
2831
2832    CHECK_EXCEPTION();
2833    ZEND_VM_NEXT_OPCODE();
2834}
2835
2836static int ZEND_FASTCALL  ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2837{
2838    USE_OPLINE
2839
2840    zval *expr;
2841    zval *result = EX_VAR(opline->result.var);
2842
2843    SAVE_OPLINE();
2844    expr = opline->op1.zv;
2845
2846    switch (opline->extended_value) {
2847        case IS_NULL:
2848            /* This code is taken from convert_to_null. However, it does not seems very useful,
2849             * because a conversion to null always results in the same value. This could only
2850             * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
2851#if 0
2852            if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
2853                ZVAL_DEREF(expr);
2854            }
2855            if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
2856                if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL TSRMLS_CC) == SUCCESS) {
2857                    break;
2858                }
2859            }
2860#endif
2861
2862            ZVAL_NULL(result);
2863            break;
2864        case _IS_BOOL:
2865            ZVAL_BOOL(result, zend_is_true(expr TSRMLS_CC));
2866            break;
2867        case IS_LONG:
2868            ZVAL_LONG(result, zval_get_long(expr));
2869            break;
2870        case IS_DOUBLE:
2871            ZVAL_DOUBLE(result, zval_get_double(expr));
2872            break;
2873        case IS_STRING:
2874            ZVAL_STR(result, zval_get_string(expr));
2875            break;
2876        default:
2877            /* If value is already of correct type, return it directly */
2878            if (Z_TYPE_P(expr) == opline->extended_value) {
2879                ZVAL_COPY_VALUE(result, expr);
2880                if (IS_CONST == IS_CONST) {
2881                    if (UNEXPECTED(Z_OPT_COPYABLE_P(result))) {
2882                        zval_copy_ctor_func(result);
2883                    }
2884                } else if (IS_CONST != IS_TMP_VAR) {
2885                    if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
2886                }
2887
2888                CHECK_EXCEPTION();
2889                ZEND_VM_NEXT_OPCODE();
2890            }
2891
2892            if (opline->extended_value == IS_ARRAY) {
2893                if (Z_TYPE_P(expr) != IS_OBJECT) {
2894                    ZVAL_NEW_ARR(result);
2895                    zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0);
2896                    if (Z_TYPE_P(expr) != IS_NULL) {
2897                        expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr);
2898                        if (IS_CONST == IS_CONST) {
2899                            if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
2900                                zval_copy_ctor_func(expr);
2901                            }
2902                        } else if (IS_CONST != IS_TMP_VAR) {
2903                            if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
2904                        }
2905                    }
2906                } else {
2907                    ZVAL_COPY_VALUE(result, expr);
2908                    if (!0) {
2909                        zval_opt_copy_ctor(result);
2910                    }
2911                    convert_to_array(result);
2912                }
2913            } else {
2914                if (Z_TYPE_P(expr) != IS_ARRAY) {
2915                    object_init(result);
2916                    if (Z_TYPE_P(expr) != IS_NULL) {
2917                        expr = zend_hash_str_add_new(Z_OBJPROP_P(result), "scalar", sizeof("scalar")-1, expr);
2918                        if (IS_CONST == IS_CONST) {
2919                            if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
2920                                zval_copy_ctor_func(expr);
2921                            }
2922                        } else if (IS_CONST != IS_TMP_VAR) {
2923                            if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
2924                        }
2925                    }
2926                } else {
2927                    ZVAL_COPY_VALUE(result, expr);
2928                    if (!0) {
2929                        zval_opt_copy_ctor(result);
2930                    }
2931                    convert_to_object(result);
2932                }
2933            }
2934
2935            CHECK_EXCEPTION();
2936            ZEND_VM_NEXT_OPCODE();
2937    }
2938
2939    CHECK_EXCEPTION();
2940    ZEND_VM_NEXT_OPCODE();
2941}
2942
2943static int ZEND_FASTCALL  ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2944{
2945    USE_OPLINE
2946    zend_op_array *new_op_array=NULL;
2947
2948    zval *inc_filename;
2949    zval tmp_inc_filename;
2950    zend_bool failure_retval=0;
2951
2952    SAVE_OPLINE();
2953    inc_filename = opline->op1.zv;
2954
2955    ZVAL_UNDEF(&tmp_inc_filename);
2956    if (Z_TYPE_P(inc_filename) != IS_STRING) {
2957        ZVAL_DUP(&tmp_inc_filename, inc_filename);
2958        convert_to_string(&tmp_inc_filename);
2959        inc_filename = &tmp_inc_filename;
2960    }
2961
2962    if (opline->extended_value != ZEND_EVAL && strlen(Z_STRVAL_P(inc_filename)) != Z_STRLEN_P(inc_filename)) {
2963        if (opline->extended_value == ZEND_INCLUDE_ONCE || opline->extended_value == ZEND_INCLUDE) {
2964            zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
2965        } else {
2966            zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
2967        }
2968    } else {
2969        switch (opline->extended_value) {
2970            case ZEND_INCLUDE_ONCE:
2971            case ZEND_REQUIRE_ONCE: {
2972                    zend_file_handle file_handle;
2973                    char *resolved_path;
2974
2975                    resolved_path = zend_resolve_path(Z_STRVAL_P(inc_filename), Z_STRLEN_P(inc_filename) TSRMLS_CC);
2976                    if (resolved_path) {
2977                        failure_retval = zend_hash_str_exists(&EG(included_files), resolved_path, strlen(resolved_path));
2978                    } else {
2979                        resolved_path = Z_STRVAL_P(inc_filename);
2980                    }
2981
2982                    if (failure_retval) {
2983                        /* do nothing, file already included */
2984                    } else if (SUCCESS == zend_stream_open(resolved_path, &file_handle TSRMLS_CC)) {
2985
2986                        if (!file_handle.opened_path) {
2987                            file_handle.opened_path = estrdup(resolved_path);
2988                        }
2989
2990                        if (zend_hash_str_add_empty_element(&EG(included_files), file_handle.opened_path, strlen(file_handle.opened_path))) {
2991                            new_op_array = zend_compile_file(&file_handle, (opline->extended_value==ZEND_INCLUDE_ONCE?ZEND_INCLUDE:ZEND_REQUIRE) TSRMLS_CC);
2992                            zend_destroy_file_handle(&file_handle TSRMLS_CC);
2993                        } else {
2994                            zend_file_handle_dtor(&file_handle TSRMLS_CC);
2995                            failure_retval=1;
2996                        }
2997                    } else {
2998                        if (opline->extended_value == ZEND_INCLUDE_ONCE) {
2999                            zend_message_dispatcher(ZMSG_FAILED_INCLUDE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
3000                        } else {
3001                            zend_message_dispatcher(ZMSG_FAILED_REQUIRE_FOPEN, Z_STRVAL_P(inc_filename) TSRMLS_CC);
3002                        }
3003                    }
3004                    if (resolved_path != Z_STRVAL_P(inc_filename)) {
3005                        efree(resolved_path);
3006                    }
3007                }
3008                break;
3009            case ZEND_INCLUDE:
3010            case ZEND_REQUIRE:
3011                new_op_array = compile_filename(opline->extended_value, inc_filename TSRMLS_CC);
3012                break;
3013            case ZEND_EVAL: {
3014                    char *eval_desc = zend_make_compiled_string_description("eval()'d code" TSRMLS_CC);
3015
3016                    new_op_array = zend_compile_string(inc_filename, eval_desc TSRMLS_CC);
3017                    efree(eval_desc);
3018                }
3019                break;
3020            EMPTY_SWITCH_DEFAULT_CASE()
3021        }
3022    }
3023    if (Z_TYPE(tmp_inc_filename) != IS_UNDEF) {
3024        zval_ptr_dtor(&tmp_inc_filename);
3025    }
3026
3027    if (UNEXPECTED(EG(exception) != NULL)) {
3028        HANDLE_EXCEPTION();
3029    } else if (EXPECTED(new_op_array != NULL)) {
3030        zval *return_value = NULL;
3031        zend_execute_data *call;
3032
3033        if (RETURN_VALUE_USED(opline)) {
3034            return_value = EX_VAR(opline->result.var);
3035        }
3036
3037        call = zend_vm_stack_push_call_frame(
3038            (zend_function*)new_op_array, 0, 0, EX(called_scope), EX(object), NULL TSRMLS_CC);
3039
3040        if (EX(symbol_table)) {
3041            call->symbol_table = EX(symbol_table);
3042        } else {
3043            call->symbol_table = zend_rebuild_symbol_table(TSRMLS_C);
3044        }
3045
3046        call->prev_execute_data = execute_data;
3047        i_init_code_execute_data(call, new_op_array, return_value, EXPECTED(zend_execute_ex == execute_ex) ? VM_FRAME_NESTED_CODE : VM_FRAME_TOP_CODE TSRMLS_CC);
3048        if (EXPECTED(zend_execute_ex == execute_ex)) {
3049            ZEND_VM_ENTER();
3050        } else {
3051            zend_execute_ex(call TSRMLS_CC);
3052        }
3053
3054        destroy_op_array(new_op_array TSRMLS_CC);
3055        efree_size(new_op_array, sizeof(zend_op_array));
3056        if (UNEXPECTED(EG(exception) != NULL)) {
3057            zend_throw_exception_internal(NULL TSRMLS_CC);
3058            HANDLE_EXCEPTION();
3059        }
3060
3061    } else if (RETURN_VALUE_USED(opline)) {
3062        ZVAL_BOOL(EX_VAR(opline->result.var), failure_retval);
3063    }
3064    ZEND_VM_NEXT_OPCODE();
3065}
3066
3067static int ZEND_FASTCALL  ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3068{
3069    USE_OPLINE
3070
3071    zval *array_ptr, *array_ref, iterator, tmp;
3072    HashTable *fe_ht;
3073    zend_object_iterator *iter = NULL;
3074    zend_class_entry *ce = NULL;
3075    zend_bool is_empty = 0;
3076
3077    SAVE_OPLINE();
3078
3079    if ((IS_CONST == IS_CV || IS_CONST == IS_VAR) &&
3080        (opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
3081        array_ptr = array_ref = NULL;
3082        ZVAL_DEREF(array_ptr);
3083        if (Z_TYPE_P(array_ptr) == IS_ARRAY) {
3084            if (!Z_ISREF_P(array_ref)) {
3085                SEPARATE_ZVAL_NOREF(array_ptr);
3086                array_ref = array_ptr;
3087                if (opline->extended_value & ZEND_FE_FETCH_BYREF) {
3088                    ZVAL_NEW_REF(array_ptr, array_ptr);
3089                    array_ref = array_ptr;
3090                    array_ptr = Z_REFVAL_P(array_ptr);
3091                }
3092            } else if (Z_IMMUTABLE_P(array_ptr)) {
3093                zval_copy_ctor(array_ptr);
3094            } else {
3095                SEPARATE_ZVAL_NOREF(array_ptr);
3096            }
3097            if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
3098        } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
3099            if(Z_OBJ_HT_P(array_ptr)->get_class_entry == NULL) {
3100                zend_error(E_WARNING, "foreach() cannot iterate over objects without PHP class");
3101                ZEND_VM_JMP(opline->op2.jmp_addr);
3102            }
3103
3104            ce = Z_OBJCE_P(array_ptr);
3105            if (!ce || ce->get_iterator == NULL) {
3106                if (!Z_ISREF_P(array_ref)) {
3107                    SEPARATE_ZVAL_NOREF(array_ptr);
3108                }
3109                Z_ADDREF_P(array_ptr);
3110            }
3111            array_ref = array_ptr;
3112        } else {
3113            if (Z_REFCOUNTED_P(array_ref)) Z_ADDREF_P(array_ref);
3114        }
3115    } else {
3116        array_ptr = array_ref = opline->op1.zv;
3117        ZVAL_DEREF(array_ptr);
3118        if (0) { /* IS_TMP_VAR */
3119            ZVAL_COPY_VALUE(&tmp, array_ptr);
3120            array_ptr = &tmp;
3121            if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
3122                ce = Z_OBJCE_P(array_ptr);
3123                if (ce && ce->get_iterator) {
3124                    Z_DELREF_P(array_ref);
3125                }
3126            }
3127        } else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
3128            ce = Z_OBJCE_P(array_ptr);
3129            if (!ce || !ce->get_iterator) {
3130                if (IS_CONST == IS_CV) {
3131                    Z_ADDREF_P(array_ref);
3132                }
3133            }
3134        } else if (Z_IMMUTABLE_P(array_ref)) {
3135            if (IS_CONST == IS_CV) {
3136                zval_copy_ctor(array_ref);
3137                Z_ADDREF_P(array_ref);
3138            } else {
3139                ZVAL_DUP(&tmp, array_ref);
3140                array_ptr = array_ref = &tmp;
3141            }
3142        } else if (Z_REFCOUNTED_P(array_ref)) {
3143            if (IS_CONST == IS_CONST ||
3144                       (IS_CONST == IS_CV &&
3145                        !Z_ISREF_P(array_ref) &&
3146                        Z_REFCOUNT_P(array_ref) > 1) ||
3147                       (IS_CONST == IS_VAR &&
3148                        !Z_ISREF_P(array_ref) &&
3149                        Z_REFCOUNT_P(array_ref) > 2)) {
3150                if (IS_CONST == IS_VAR) {
3151                    Z_DELREF_P(array_ref);
3152                }
3153                ZVAL_DUP(&tmp, array_ref);
3154                array_ptr = array_ref = &tmp;
3155            } else if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
3156                if (Z_ISREF_P(array_ref) && Z_REFCOUNT_P(array_ref) == 1) {
3157                    ZVAL_UNREF(array_ref);
3158                    array_ptr = array_ref;
3159                }
3160                if (Z_IMMUTABLE_P(array_ptr) ||
3161                    (Z_ISREF_P(array_ref) &&
3162                     Z_REFCOUNTED_P(array_ptr) &&
3163                     Z_REFCOUNT_P(array_ptr) > 1)) {
3164                    if (!Z_IMMUTABLE_P(array_ptr)) {
3165                        Z_DELREF_P(array_ptr);
3166                    }
3167                    zval_copy_ctor(array_ptr);
3168                }
3169                if (IS_CONST == IS_CV) {
3170                    Z_ADDREF_P(array_ref);
3171                }
3172            }
3173        }
3174    }
3175
3176    if (ce && ce->get_iterator) {
3177        iter = ce->get_iterator(ce, array_ptr, opline->extended_value & ZEND_FE_RESET_REFERENCE TSRMLS_CC);
3178
3179        if (IS_CONST == IS_VAR && !(opline->extended_value & ZEND_FE_RESET_VARIABLE)) {
3180
3181        }
3182        if (iter && EXPECTED(EG(exception) == NULL)) {
3183            ZVAL_OBJ(&iterator, &iter->std);
3184            array_ptr = array_ref = &iterator;
3185        } else {
3186            if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
3187
3188            }
3189            if (!EG(exception)) {
3190                zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Object of type %s did not create an Iterator", ce->name->val);
3191            }
3192            zend_throw_exception_internal(NULL TSRMLS_CC);
3193            HANDLE_EXCEPTION();
3194        }
3195    }
3196
3197    ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ref);
3198
3199    if (iter) {
3200        iter->index = 0;
3201        if (iter->funcs->rewind) {
3202            iter->funcs->rewind(iter TSRMLS_CC);
3203            if (UNEXPECTED(EG(exception) != NULL)) {
3204                zval_ptr_dtor(array_ref);
3205                if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
3206
3207                }
3208                HANDLE_EXCEPTION();
3209            }
3210        }
3211        is_empty = iter->funcs->valid(iter TSRMLS_CC) != SUCCESS;
3212        if (UNEXPECTED(EG(exception) != NULL)) {
3213            zval_ptr_dtor(array_ref);
3214            if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
3215
3216            }
3217            HANDLE_EXCEPTION();
3218        }
3219        iter->index = -1; /* will be set to 0 before using next handler */
3220    } else if ((fe_ht = HASH_OF(array_ptr)) != NULL) {
3221        zend_hash_internal_pointer_reset(fe_ht);
3222        if (ce) {
3223            zend_object *zobj = Z_OBJ_P(array_ptr);
3224            while (zend_hash_has_more_elements(fe_ht) == SUCCESS) {
3225                zend_string *str_key;
3226                zend_ulong int_key;
3227                zend_uchar key_type;
3228
3229                key_type = zend_hash_get_current_key(fe_ht, &str_key, &int_key, 0);
3230                if (key_type != HASH_KEY_NON_EXISTENT &&
3231                    (key_type == HASH_KEY_IS_LONG ||
3232                     zend_check_property_access(zobj, str_key TSRMLS_CC) == SUCCESS)) {
3233                    break;
3234                }
3235                zend_hash_move_forward(fe_ht);
3236            }
3237        }
3238        is_empty = zend_hash_has_more_elements(fe_ht) != SUCCESS;
3239        zend_hash_get_pointer(fe_ht, (HashPointer*)EX_VAR((opline+2)->op1.var));
3240    } else {
3241        zend_error(E_WARNING, "Invalid argument supplied for foreach()");
3242        is_empty = 1;
3243    }
3244
3245    if (IS_CONST == IS_VAR && opline->extended_value & ZEND_FE_RESET_VARIABLE) {
3246
3247    }
3248    if (is_empty) {
3249        ZEND_VM_JMP(opline->op2.jmp_addr);
3250    } else {
3251        CHECK_EXCEPTION();
3252        ZEND_VM_NEXT_OPCODE();
3253    }
3254}
3255
3256static int ZEND_FASTCALL  ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3257{
3258#if 0 || (IS_CONST != IS_UNUSED)
3259    USE_OPLINE
3260
3261    SAVE_OPLINE();
3262    if (IS_CONST != IS_UNUSED) {
3263
3264        zval *ptr = opline->op1.zv;
3265
3266        if (Z_TYPE_P(ptr) == IS_LONG) {
3267            EG(exit_status) = Z_LVAL_P(ptr);
3268        } else {
3269            zend_print_variable(ptr TSRMLS_CC);
3270        }
3271
3272    }
3273#endif
3274    zend_bailout();
3275    ZEND_VM_NEXT_OPCODE(); /* Never reached */
3276}
3277
3278static int ZEND_FASTCALL  ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3279{
3280    USE_OPLINE
3281
3282    zval *value;
3283
3284    SAVE_OPLINE();
3285    value = opline->op1.zv;
3286
3287    if (i_zend_is_true(value TSRMLS_CC)) {
3288        ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
3289        if (IS_CONST == IS_CONST) {
3290            if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3291                zval_copy_ctor_func(EX_VAR(opline->result.var));
3292            }
3293        } else if (IS_CONST == IS_CV) {
3294            if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
3295        }
3296        ZEND_VM_JMP(opline->op2.jmp_addr);
3297    }
3298
3299    CHECK_EXCEPTION();
3300    ZEND_VM_NEXT_OPCODE();
3301}
3302
3303static int ZEND_FASTCALL  ZEND_JMP_SET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3304{
3305    USE_OPLINE
3306
3307    zval *value;
3308
3309    SAVE_OPLINE();
3310    value = opline->op1.zv;
3311
3312    if (i_zend_is_true(value TSRMLS_CC)) {
3313        ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
3314        if (IS_CONST == IS_CONST) {
3315            if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3316                zval_copy_ctor_func(EX_VAR(opline->result.var));
3317            }
3318        } else if (IS_CONST == IS_CV) {
3319            if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
3320        }
3321        ZEND_VM_JMP(opline->op2.jmp_addr);
3322    }
3323
3324    CHECK_EXCEPTION();
3325    ZEND_VM_NEXT_OPCODE();
3326}
3327
3328static int ZEND_FASTCALL  ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3329{
3330    USE_OPLINE
3331
3332    zval *value;
3333
3334    SAVE_OPLINE();
3335    value = opline->op1.zv;
3336
3337    ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
3338    if (IS_CONST == IS_CONST) {
3339        if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3340            zval_copy_ctor_func(EX_VAR(opline->result.var));
3341        }
3342    } else if (IS_CONST == IS_CV) {
3343        if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
3344    }
3345    ZEND_VM_NEXT_OPCODE();
3346}
3347
3348static int ZEND_FASTCALL  ZEND_QM_ASSIGN_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3349{
3350    USE_OPLINE
3351
3352    zval *value;
3353
3354    SAVE_OPLINE();
3355    value = opline->op1.zv;
3356
3357    ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
3358    if (IS_CONST == IS_CONST) {
3359        if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3360            zval_copy_ctor_func(EX_VAR(opline->result.var));
3361        }
3362    } else if (IS_CONST == IS_CV) {
3363        if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
3364    }
3365    ZEND_VM_NEXT_OPCODE();
3366}
3367
3368static int ZEND_FASTCALL  ZEND_STRLEN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3369{
3370    USE_OPLINE
3371    zval *value;
3372
3373
3374    SAVE_OPLINE();
3375    value = opline->op1.zv;
3376    if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
3377        ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
3378    } else {
3379        if (Z_TYPE_P(value) < IS_TRUE) {
3380            ZVAL_LONG(EX_VAR(opline->result.var), 0);
3381        } else if (Z_TYPE_P(value) == IS_TRUE) {
3382            ZVAL_LONG(EX_VAR(opline->result.var), 1);
3383        } else if (Z_TYPE_P(value) <= IS_DOUBLE) {
3384            zend_string *str = zval_get_string(value);
3385            ZVAL_LONG(EX_VAR(opline->result.var), str->len);
3386            zend_string_release(str);
3387        } else if (Z_TYPE_P(value) == IS_OBJECT) {
3388            zend_string *str;
3389            zval tmp;
3390
3391            ZVAL_COPY(&tmp, value);
3392            if (parse_arg_object_to_str(&tmp, &str, IS_STRING TSRMLS_CC) == FAILURE) {
3393                goto strlen_error;
3394            }
3395            ZVAL_LONG(EX_VAR(opline->result.var), str->len);
3396            zval_dtor(&tmp);
3397        } else {
3398strlen_error:
3399            zend_error(E_WARNING, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
3400            ZVAL_NULL(EX_VAR(opline->result.var));
3401        }
3402    }
3403
3404    CHECK_EXCEPTION();
3405    ZEND_VM_NEXT_OPCODE();
3406}
3407
3408static int ZEND_FASTCALL  ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3409{
3410    USE_OPLINE
3411    zval *value;
3412
3413
3414    SAVE_OPLINE();
3415    value = opline->op1.zv;
3416    switch (opline->extended_value) {
3417        case IS_NULL:
3418        case IS_LONG:
3419        case IS_DOUBLE:
3420        case IS_STRING:
3421        case IS_ARRAY:
3422            ZVAL_BOOL(EX_VAR(opline->result.var), Z_TYPE_P(value) == opline->extended_value);
3423            break;
3424        case _IS_BOOL:
3425            ZVAL_BOOL(EX_VAR(opline->result.var), Z_TYPE_P(value) == IS_TRUE || Z_TYPE_P(value) == IS_FALSE);
3426            break;
3427        case IS_OBJECT:
3428            if (Z_TYPE_P(value) == opline->extended_value) {
3429                if (Z_OBJ_HT_P(value)->get_class_entry == NULL) {
3430                    ZVAL_TRUE(EX_VAR(opline->result.var));
3431                } else {
3432                    zend_class_entry *ce = Z_OBJCE_P(value);
3433                    if (ce->name->len == sizeof("__PHP_Incomplete_Class") - 1
3434                            && !strncmp(ce->name->val, "__PHP_Incomplete_Class", ce->name->len)) {
3435                        ZVAL_FALSE(EX_VAR(opline->result.var));
3436                    } else {
3437                        ZVAL_TRUE(EX_VAR(opline->result.var));
3438                    }
3439                }
3440            } else {
3441                ZVAL_FALSE(EX_VAR(opline->result.var));
3442            }
3443            break;
3444        case IS_RESOURCE:
3445            if (Z_TYPE_P(value) == opline->extended_value) {
3446                const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(value) TSRMLS_CC);
3447                ZVAL_BOOL(EX_VAR(opline->result.var), type_name != NULL);
3448            } else {
3449                ZVAL_FALSE(EX_VAR(opline->result.var));
3450            }
3451            break;
3452        EMPTY_SWITCH_DEFAULT_CASE()
3453    }
3454
3455    CHECK_EXCEPTION();
3456    ZEND_VM_NEXT_OPCODE();
3457}
3458
3459static int ZEND_FASTCALL  ZEND_DEFINED_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3460{
3461    USE_OPLINE
3462    zend_constant *c;
3463
3464    SAVE_OPLINE();
3465    if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
3466        ZVAL_TRUE(EX_VAR(opline->result.var));
3467    } else if ((c = zend_quick_get_constant(opline->op1.zv, 0 TSRMLS_CC)) == NULL) {
3468        ZVAL_FALSE(EX_VAR(opline->result.var));
3469    } else {
3470        CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), c);
3471        ZVAL_TRUE(EX_VAR(opline->result.var));
3472    }
3473    CHECK_EXCEPTION();
3474    ZEND_VM_NEXT_OPCODE();
3475}
3476
3477static int ZEND_FASTCALL  ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3478{
3479    USE_OPLINE
3480
3481
3482    SAVE_OPLINE();
3483    fast_add_function(EX_VAR(opline->result.var),
3484        opline->op1.zv,
3485        opline->op2.zv TSRMLS_CC);
3486
3487
3488    CHECK_EXCEPTION();
3489    ZEND_VM_NEXT_OPCODE();
3490}
3491
3492static int ZEND_FASTCALL  ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3493{
3494    USE_OPLINE
3495
3496
3497    SAVE_OPLINE();
3498    fast_sub_function(EX_VAR(opline->result.var),
3499        opline->op1.zv,
3500        opline->op2.zv TSRMLS_CC);
3501
3502
3503    CHECK_EXCEPTION();
3504    ZEND_VM_NEXT_OPCODE();
3505}
3506
3507static int ZEND_FASTCALL  ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3508{
3509    USE_OPLINE
3510
3511
3512    SAVE_OPLINE();
3513    fast_mul_function(EX_VAR(opline->result.var),
3514        opline->op1.zv,
3515        opline->op2.zv TSRMLS_CC);
3516
3517
3518    CHECK_EXCEPTION();
3519    ZEND_VM_NEXT_OPCODE();
3520}
3521
3522static int ZEND_FASTCALL  ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3523{
3524    USE_OPLINE
3525
3526
3527    SAVE_OPLINE();
3528    fast_div_function(EX_VAR(opline->result.var),
3529        opline->op1.zv,
3530        opline->op2.zv TSRMLS_CC);
3531
3532
3533    CHECK_EXCEPTION();
3534    ZEND_VM_NEXT_OPCODE();
3535}
3536
3537static int ZEND_FASTCALL  ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3538{
3539    USE_OPLINE
3540
3541
3542    SAVE_OPLINE();
3543    fast_mod_function(EX_VAR(opline->result.var),
3544        opline->op1.zv,
3545        opline->op2.zv TSRMLS_CC);
3546
3547
3548    CHECK_EXCEPTION();
3549    ZEND_VM_NEXT_OPCODE();
3550}
3551
3552static int ZEND_FASTCALL  ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3553{
3554    USE_OPLINE
3555
3556
3557    SAVE_OPLINE();
3558    shift_left_function(EX_VAR(opline->result.var),
3559        opline->op1.zv,
3560        opline->op2.zv TSRMLS_CC);
3561
3562
3563    CHECK_EXCEPTION();
3564    ZEND_VM_NEXT_OPCODE();
3565}
3566
3567static int ZEND_FASTCALL  ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3568{
3569    USE_OPLINE
3570
3571
3572    SAVE_OPLINE();
3573    shift_right_function(EX_VAR(opline->result.var),
3574        opline->op1.zv,
3575        opline->op2.zv TSRMLS_CC);
3576
3577
3578    CHECK_EXCEPTION();
3579    ZEND_VM_NEXT_OPCODE();
3580}
3581
3582static int ZEND_FASTCALL  ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3583{
3584    USE_OPLINE
3585
3586
3587    SAVE_OPLINE();
3588    concat_function(EX_VAR(opline->result.var),
3589        opline->op1.zv,
3590        opline->op2.zv TSRMLS_CC);
3591
3592
3593    CHECK_EXCEPTION();
3594    ZEND_VM_NEXT_OPCODE();
3595}
3596
3597static int ZEND_FASTCALL  ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3598{
3599    USE_OPLINE
3600
3601
3602    SAVE_OPLINE();
3603    fast_is_identical_function(EX_VAR(opline->result.var),
3604        opline->op1.zv,
3605        opline->op2.zv TSRMLS_CC);
3606
3607
3608    CHECK_EXCEPTION();
3609    ZEND_VM_NEXT_OPCODE();
3610}
3611
3612static int ZEND_FASTCALL  ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3613{
3614    USE_OPLINE
3615
3616    zval *result = EX_VAR(opline->result.var);
3617
3618    SAVE_OPLINE();
3619    fast_is_not_identical_function(result,
3620        opline->op1.zv,
3621        opline->op2.zv TSRMLS_CC);
3622
3623
3624    CHECK_EXCEPTION();
3625    ZEND_VM_NEXT_OPCODE();
3626}
3627
3628static int ZEND_FASTCALL  ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3629{
3630    USE_OPLINE
3631
3632    zval *result = EX_VAR(opline->result.var);
3633
3634    SAVE_OPLINE();
3635    fast_equal_function(result,
3636        opline->op1.zv,
3637        opline->op2.zv TSRMLS_CC);
3638
3639
3640    CHECK_EXCEPTION();
3641    ZEND_VM_NEXT_OPCODE();
3642}
3643
3644static int ZEND_FASTCALL  ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3645{
3646    USE_OPLINE
3647
3648    zval *result = EX_VAR(opline->result.var);
3649
3650    SAVE_OPLINE();
3651    fast_not_equal_function(result,
3652        opline->op1.zv,
3653        opline->op2.zv TSRMLS_CC);
3654
3655
3656    CHECK_EXCEPTION();
3657    ZEND_VM_NEXT_OPCODE();
3658}
3659
3660static int ZEND_FASTCALL  ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3661{
3662    USE_OPLINE
3663
3664    zval *result = EX_VAR(opline->result.var);
3665
3666    SAVE_OPLINE();
3667    fast_is_smaller_function(result,
3668        opline->op1.zv,
3669        opline->op2.zv TSRMLS_CC);
3670
3671
3672    CHECK_EXCEPTION();
3673    ZEND_VM_NEXT_OPCODE();
3674}
3675
3676static int ZEND_FASTCALL  ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3677{
3678    USE_OPLINE
3679
3680    zval *result = EX_VAR(opline->result.var);
3681
3682    SAVE_OPLINE();
3683    fast_is_smaller_or_equal_function(result,
3684        opline->op1.zv,
3685        opline->op2.zv TSRMLS_CC);
3686
3687
3688    CHECK_EXCEPTION();
3689    ZEND_VM_NEXT_OPCODE();
3690}
3691
3692static int ZEND_FASTCALL  ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3693{
3694    USE_OPLINE
3695
3696
3697    SAVE_OPLINE();
3698    bitwise_or_function(EX_VAR(opline->result.var),
3699        opline->op1.zv,
3700        opline->op2.zv TSRMLS_CC);
3701
3702
3703    CHECK_EXCEPTION();
3704    ZEND_VM_NEXT_OPCODE();
3705}
3706
3707static int ZEND_FASTCALL  ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3708{
3709    USE_OPLINE
3710
3711
3712    SAVE_OPLINE();
3713    bitwise_and_function(EX_VAR(opline->result.var),
3714        opline->op1.zv,
3715        opline->op2.zv TSRMLS_CC);
3716
3717
3718    CHECK_EXCEPTION();
3719    ZEND_VM_NEXT_OPCODE();
3720}
3721
3722static int ZEND_FASTCALL  ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3723{
3724    USE_OPLINE
3725
3726
3727    SAVE_OPLINE();
3728    bitwise_xor_function(EX_VAR(opline->result.var),
3729        opline->op1.zv,
3730        opline->op2.zv TSRMLS_CC);
3731
3732
3733    CHECK_EXCEPTION();
3734    ZEND_VM_NEXT_OPCODE();
3735}
3736
3737static int ZEND_FASTCALL  ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3738{
3739    USE_OPLINE
3740
3741
3742    SAVE_OPLINE();
3743    boolean_xor_function(EX_VAR(opline->result.var),
3744        opline->op1.zv,
3745        opline->op2.zv TSRMLS_CC);
3746
3747
3748    CHECK_EXCEPTION();
3749    ZEND_VM_NEXT_OPCODE();
3750}
3751
3752static int ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_CONST(int type, ZEND_OPCODE_HANDLER_ARGS)
3753{
3754    USE_OPLINE
3755
3756    zval *varname;
3757    zval *retval;
3758    zend_string *name;
3759    HashTable *target_symbol_table;
3760
3761    SAVE_OPLINE();
3762    varname = opline->op1.zv;
3763
3764    if (IS_CONST == IS_CONST) {
3765        name = Z_STR_P(varname);
3766    } else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
3767        name = Z_STR_P(varname);
3768        zend_string_addref(name);
3769    } else {
3770        name = zval_get_string(varname);
3771    }
3772
3773    if (IS_CONST != IS_UNUSED) {
3774        zend_class_entry *ce;
3775
3776        if (IS_CONST == IS_CONST) {
3777            if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
3778                ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
3779            } else {
3780                ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
3781                if (UNEXPECTED(ce == NULL)) {
3782                    if (IS_CONST != IS_CONST) {
3783                        zend_string_release(name);
3784                    }
3785
3786                    CHECK_EXCEPTION();
3787                    ZEND_VM_NEXT_OPCODE();
3788                }
3789                CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
3790            }
3791        } else {
3792            ce = Z_CE_P(EX_VAR(opline->op2.var));
3793        }
3794        retval = zend_std_get_static_property(ce, name, 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
3795
3796    } else {
3797        target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
3798        retval = zend_hash_find(target_symbol_table, name);
3799        if (retval == NULL) {
3800            switch (type) {
3801                case BP_VAR_R:
3802                case BP_VAR_UNSET:
3803                    zend_error(E_NOTICE,"Undefined variable: %s", name->val);
3804                    /* break missing intentionally */
3805                case BP_VAR_IS:
3806                    retval = EX_VAR(opline->result.var);
3807                    ZVAL_NULL(retval);
3808                    break;
3809                case BP_VAR_RW:
3810                    zend_error(E_NOTICE,"Undefined variable: %s", name->val);
3811                    /* break missing intentionally */
3812                case BP_VAR_W:
3813                    retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval));
3814                    break;
3815                EMPTY_SWITCH_DEFAULT_CASE()
3816            }
3817        /* GLOBAL or $$name variable may be an INDIRECT pointer to CV */
3818        } else if (Z_TYPE_P(retval) == IS_INDIRECT) {
3819            retval = Z_INDIRECT_P(retval);
3820            if (Z_TYPE_P(retval) == IS_UNDEF) {
3821                switch (type) {
3822                    case BP_VAR_R:
3823                    case BP_VAR_UNSET:
3824                        zend_error(E_NOTICE,"Undefined variable: %s", name->val);
3825                        /* break missing intentionally */
3826                    case BP_VAR_IS:
3827                        retval = EX_VAR(opline->result.var);
3828                        ZVAL_NULL(retval);
3829                        break;
3830                    case BP_VAR_RW:
3831                        zend_error(E_NOTICE,"Undefined variable: %s", name->val);
3832                        /* break missing intentionally */
3833                    case BP_VAR_W:
3834                        ZVAL_NULL(retval);
3835                        break;
3836                    EMPTY_SWITCH_DEFAULT_CASE()
3837                }
3838            }
3839        }
3840        if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) == ZEND_FETCH_STATIC) {
3841            if (Z_CONSTANT_P(retval)) {
3842                zval_update_constant(retval, 1 TSRMLS_CC);
3843            }
3844        } else if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
3845
3846        }
3847    }
3848
3849    if (IS_CONST != IS_CONST) {
3850        zend_string_release(name);
3851    }
3852
3853    ZEND_ASSERT(retval != NULL);
3854    if (type == BP_VAR_R || type == BP_VAR_IS) {
3855        if (/*type == BP_VAR_R &&*/ Z_ISREF_P(retval) && Z_REFCOUNT_P(retval) == 1) {
3856            ZVAL_UNREF(retval);
3857        }
3858        ZVAL_COPY(EX_VAR(opline->result.var), retval);
3859    } else {
3860        if (/*type == BP_VAR_W &&*/ (opline->extended_value & ZEND_FETCH_MAKE_REF)) {
3861            ZVAL_MAKE_REF(retval);
3862        }
3863        ZVAL_INDIRECT(EX_VAR(opline->result.var), retval);
3864    }
3865    CHECK_EXCEPTION();
3866    ZEND_VM_NEXT_OPCODE();
3867}
3868
3869static int ZEND_FASTCALL  ZEND_FETCH_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3870{
3871    return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3872}
3873
3874static int ZEND_FASTCALL  ZEND_FETCH_W_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3875{
3876    return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3877}
3878
3879static int ZEND_FASTCALL  ZEND_FETCH_RW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3880{
3881    return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_RW, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3882}
3883
3884static int ZEND_FASTCALL  ZEND_FETCH_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3885{
3886    USE_OPLINE
3887
3888    if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
3889        return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_W, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3890    } else {
3891        return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_R, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3892    }
3893}
3894
3895static int ZEND_FASTCALL  ZEND_FETCH_UNSET_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3896{
3897    return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_UNSET, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3898}
3899
3900static int ZEND_FASTCALL  ZEND_FETCH_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3901{
3902    return zend_fetch_var_address_helper_SPEC_CONST_CONST(BP_VAR_IS, ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
3903}
3904
3905static int ZEND_FASTCALL  ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3906{
3907    USE_OPLINE
3908
3909    zval *container;
3910
3911    SAVE_OPLINE();
3912    container = opline->op1.zv;
3913    zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
3914
3915    if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) {
3916
3917    }
3918    CHECK_EXCEPTION();
3919    ZEND_VM_NEXT_OPCODE();
3920}
3921
3922static int ZEND_FASTCALL  ZEND_FETCH_DIM_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3923{
3924    USE_OPLINE
3925
3926    zval *container;
3927
3928    SAVE_OPLINE();
3929    container = opline->op1.zv;
3930    zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
3931
3932
3933    CHECK_EXCEPTION();
3934    ZEND_VM_NEXT_OPCODE();
3935}
3936
3937static int ZEND_FASTCALL  ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3938{
3939    USE_OPLINE
3940    zval *container;
3941    zend_free_op free_op1;
3942
3943    SAVE_OPLINE();
3944
3945    if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
3946        if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
3947            zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
3948        }
3949        container = NULL;
3950        if (IS_CONST == IS_VAR && UNEXPECTED(container == NULL)) {
3951            zend_error_noreturn(E_ERROR, "Cannot use string offset as an array");
3952        }
3953        zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
3954        if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
3955            EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
3956        }
3957
3958
3959    } else {
3960        if (IS_CONST == IS_UNUSED) {
3961            zend_error_noreturn(E_ERROR, "Cannot use [] for reading");
3962        }
3963        container = opline->op1.zv;
3964        zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC);
3965
3966
3967    }
3968    CHECK_EXCEPTION();
3969    ZEND_VM_NEXT_OPCODE();
3970}
3971
3972static int ZEND_FASTCALL zend_fetch_property_address_read_helper_SPEC_CONST_CONST(ZEND_OPCODE_HANDLER_ARGS)
3973{
3974    USE_OPLINE
3975
3976    zval *container;
3977
3978    zval *offset;
3979
3980    SAVE_OPLINE();
3981    container = opline->op1.zv;
3982    offset  = opline->op2.zv;
3983
3984    if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
3985        UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
3986        zend_error(E_NOTICE, "Trying to get property of non-object");
3987        ZVAL_NULL(EX_VAR(opline->result.var));
3988    } else {
3989        zval *retval;
3990
3991        /* here we are sure we are dealing with an object */
3992        retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
3993
3994        if (retval != EX_VAR(opline->result.var)) {
3995            ZVAL_COPY(EX_VAR(opline->result.var), retval);
3996        }
3997    }
3998
3999
4000    CHECK_EXCEPTION();
4001    ZEND_VM_NEXT_OPCODE();
4002}
4003
4004static int ZEND_FASTCALL  ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4005{
4006    return zend_fetch_property_address_read_helper_SPEC_CONST_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4007}
4008
4009static int ZEND_FASTCALL  ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4010{
4011    USE_OPLINE
4012
4013    zval *container;
4014
4015    zval *offset;
4016
4017    SAVE_OPLINE();
4018    container = opline->op1.zv;
4019    offset  = opline->op2.zv;
4020
4021    if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT) ||
4022        UNEXPECTED(Z_OBJ_HT_P(container)->read_property == NULL)) {
4023        ZVAL_NULL(EX_VAR(opline->result.var));
4024    } else {
4025        zval *retval;
4026
4027        /* here we are sure we are dealing with an object */
4028        retval = Z_OBJ_HT_P(container)->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var) TSRMLS_CC);
4029
4030        if (retval != EX_VAR(opline->result.var)) {
4031            ZVAL_COPY(EX_VAR(opline->result.var), retval);
4032        }
4033    }
4034
4035
4036    CHECK_EXCEPTION();
4037    ZEND_VM_NEXT_OPCODE();
4038}
4039
4040static int ZEND_FASTCALL  ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4041{
4042    USE_OPLINE
4043    zval *container;
4044
4045    if (zend_is_by_ref_func_arg_fetch(opline, EX(call) TSRMLS_CC)) {
4046        /* Behave like FETCH_OBJ_W */
4047        zend_free_op free_op1;
4048        zval *property;
4049
4050        SAVE_OPLINE();
4051        property = opline->op2.zv;
4052        container = NULL;
4053
4054        if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
4055            zend_error_noreturn(E_ERROR, "Cannot use temporary expression in write context");
4056        }
4057        if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(container) == IS_STR_OFFSET)) {
4058            zend_error_noreturn(E_ERROR, "Cannot use string offset as an object");
4059        }
4060        zend_fetch_property_address(EX_VAR(opline->result.var), container, property, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W, 0 TSRMLS_CC);
4061
4062        if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1.var)) {
4063            EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
4064        }
4065
4066        CHECK_EXCEPTION();
4067        ZEND_VM_NEXT_OPCODE();
4068    } else {
4069        return zend_fetch_property_address_read_helper_SPEC_CONST_CONST(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4070    }
4071}
4072
4073static int ZEND_FASTCALL  ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4074{
4075    USE_OPLINE
4076
4077    zval *container;
4078
4079    SAVE_OPLINE();
4080    container = opline->op1.zv;
4081
4082    if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) {
4083        ZVAL_NULL(EX_VAR(opline->result.var));
4084    } else {
4085
4086        zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC);
4087
4088        ZVAL_COPY(EX_VAR(opline->result.var), value);
4089
4090    }
4091    CHECK_EXCEPTION();
4092    ZEND_VM_NEXT_OPCODE();
4093}
4094
4095static int ZEND_FASTCALL  ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4096{
4097    USE_OPLINE
4098    zval *function_name;
4099    zend_class_entry *ce;
4100    zend_object *object;
4101    zend_function *fbc;
4102
4103    SAVE_OPLINE();
4104
4105    if (IS_CONST == IS_CONST) {
4106        /* no function found. try a static method in class */
4107        if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
4108            ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
4109        } else {
4110            ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, ZEND_FETCH_CLASS_DEFAULT TSRMLS_CC);
4111            if (UNEXPECTED(EG(exception) != NULL)) {
4112                HANDLE_EXCEPTION();
4113            }
4114            if (UNEXPECTED(ce == NULL)) {
4115                zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
4116            }
4117            CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
4118        }
4119    } else {
4120        ce = Z_CE_P(EX_VAR(opline->op1.var));
4121    }
4122
4123    if (IS_CONST == IS_CONST &&
4124        IS_CONST == IS_CONST &&
4125        CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
4126        fbc = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
4127    } else if (IS_CONST != IS_CONST &&
4128               IS_CONST == IS_CONST &&
4129               (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce))) {
4130        /* do nothing */
4131    } else if (IS_CONST != IS_UNUSED) {
4132
4133
4134        function_name = opline->op2.zv;
4135        if (IS_CONST != IS_CONST) {
4136            if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
4137                if (UNEXPECTED(EG(exception) != NULL)) {
4138                    HANDLE_EXCEPTION();
4139                }
4140                zend_error_noreturn(E_ERROR, "Function name must be a string");
4141            }
4142        }
4143
4144        if (ce->get_static_method) {
4145            fbc = ce->get_static_method(ce, Z_STR_P(function_name) TSRMLS_CC);
4146        } else {
4147            fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (opline->op2.zv + 1) : NULL) TSRMLS_CC);
4148        }
4149        if (UNEXPECTED(fbc == NULL)) {
4150            zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name->val, Z_STRVAL_P(function_name));
4151        }
4152        if (IS_CONST == IS_CONST &&
4153            EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
4154            EXPECTED((fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_HANDLER|ZEND_ACC_NEVER_CACHE)) == 0)) {
4155            if (IS_CONST == IS_CONST) {
4156                CACHE_PTR(Z_CACHE_SLOT_P(function_name), fbc);
4157            } else {
4158                CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, fbc);
4159            }
4160        }
4161        if (IS_CONST != IS_CONST) {
4162
4163        }
4164    } else {
4165        if (UNEXPECTED(ce->constructor == NULL)) {
4166            zend_error_noreturn(E_ERROR, "Cannot call constructor");
4167        }
4168        if (EX(object) && zend_get_class_entry(EX(object) TSRMLS_CC) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
4169            zend_error_noreturn(E_ERROR, "Cannot call private %s::__construct()", ce->name->val);
4170        }
4171        fbc = ce->constructor;
4172    }
4173
4174    object = NULL;
4175    if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
4176        if (EX(object)) {
4177            object = EX(object);
4178            GC_REFCOUNT(object)++;
4179            if (object->handlers->get_class_entry &&
4180                !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) {
4181                /* We are calling method of the other (incompatible) class,
4182                   but passing $this. This is done for compatibility with php-4. */
4183                if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
4184                    zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
4185                } else {
4186                    /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
4187                    zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val);
4188                }
4189            }
4190        }
4191    }
4192
4193    if (IS_CONST != IS_CONST) {
4194        /* previous opcode is ZEND_FETCH_CLASS */
4195        if ((opline-1)->extended_value == ZEND_FETCH_CLASS_PARENT || (opline-1)->extended_value == ZEND_FETCH_CLASS_SELF) {
4196            ce = EX(called_scope);
4197        }
4198    }
4199
4200    EX(call) = zend_vm_stack_push_call_frame(
4201        fbc, opline->extended_value, 0, ce, object, EX(call) TSRMLS_CC);
4202
4203    if (IS_CONST == IS_UNUSED) {
4204        EX(call)->return_value = NULL;
4205    }
4206
4207    CHECK_EXCEPTION();
4208    ZEND_VM_NEXT_OPCODE();
4209}
4210
4211static int ZEND_FASTCALL  ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4212{
4213    USE_OPLINE
4214
4215    zval *function_name = opline->op2.zv;
4216    zend_fcall_info_cache fcc;
4217    char *error = NULL;
4218    zend_function *func;
4219    zend_class_entry *called_scope;
4220    zend_object *object;
4221
4222    if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error TSRMLS_CC)) {
4223        if (error) {
4224            efree(error);
4225        }
4226        func = fcc.function_handler;
4227        if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
4228            /* Delay closure destruction until its invocation */
4229            func->common.prototype = (zend_function*)Z_OBJ_P(function_name);
4230            Z_ADDREF_P(function_name);
4231        }
4232        called_scope = fcc.called_scope;
4233        object = fcc.object;
4234        if (object) {
4235            GC_REFCOUNT(object)++; /* For $this pointer */
4236        }
4237    } else {
4238        zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error);
4239        efree(error);
4240        func = (zend_function*)&zend_pass_function;
4241        called_scope = NULL;
4242        object = NULL;
4243    }
4244
4245    EX(call) = zend_vm_stack_push_call_frame(
4246        func, opline->extended_value, 0, called_scope, object, EX(call) TSRMLS_CC);
4247
4248    CHECK_EXCEPTION();
4249    ZEND_VM_NEXT_OPCODE();
4250}
4251
4252static int ZEND_FASTCALL  ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4253{
4254    USE_OPLINE
4255
4256    zval *result = EX_VAR(opline->result.var);
4257
4258    SAVE_OPLINE();
4259    fast_equal_function(result,
4260         opline->op1.zv,
4261         opline->op2.zv TSRMLS_CC);
4262
4263    CHECK_EXCEPTION();
4264    ZEND_VM_NEXT_OPCODE();
4265}
4266
4267static int ZEND_FASTCALL  ZEND_FETCH_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4268{
4269    USE_OPLINE
4270
4271    SAVE_OPLINE();
4272    if (IS_CONST == IS_UNUSED) {
4273        zend_constant *c;
4274        zval *retval;
4275
4276        if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
4277            c = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
4278        } else if ((c = zend_quick_get_constant(opline->op2.zv + 1, opline->extended_value TSRMLS_CC)) == NULL) {
4279            if ((opline->extended_value & IS_CONSTANT_UNQUALIFIED) != 0) {
4280                char *actual = (char *)zend_memrchr(Z_STRVAL_P(opline->op2.zv), '\\', Z_STRLEN_P(opline->op2.zv));
4281                if(!actual) {
4282                    actual = Z_STRVAL_P(opline->op2.zv);
4283                } else {
4284                    actual++;
4285                }
4286                /* non-qualified constant - allow text substitution */
4287                zend_error(E_NOTICE, "Use of undefined constant %s - assumed '%s'", actual, actual);
4288                ZVAL_STRINGL(EX_VAR(opline->result.var), actual, Z_STRLEN_P(opline->op2.zv)-(actual - Z_STRVAL_P(opline->op2.zv)));
4289                CHECK_EXCEPTION();
4290                ZEND_VM_NEXT_OPCODE();
4291            } else {
4292                zend_error_noreturn(E_ERROR, "Undefined constant '%s'", Z_STRVAL_P(opline->op2.zv));
4293            }
4294        } else {
4295            CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), c);
4296        }
4297        retval = EX_VAR(opline->result.var);
4298        ZVAL_COPY_VALUE(retval, &c->value);
4299        if (Z_OPT_COPYABLE_P(retval) || Z_OPT_REFCOUNTED_P(retval)) {
4300            if (Z_OPT_COPYABLE_P(retval)) {
4301                zval_copy_ctor_func(retval);
4302            } else {
4303                Z_ADDREF_P(retval);
4304            }
4305        }
4306    } else {
4307        /* class constant */
4308        zend_class_entry *ce;
4309        zval *value;
4310
4311        if (IS_CONST == IS_CONST) {
4312            if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
4313                value = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
4314                ZVAL_DEREF(value);
4315                ZVAL_DUP(EX_VAR(opline->result.var), value);
4316                goto constant_fetch_end;
4317            } else if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv))) {
4318                ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op1.zv));
4319            } else {
4320                ce = zend_fetch_class_by_name(Z_STR_P(opline->op1.zv), opline->op1.zv + 1, opline->extended_value TSRMLS_CC);
4321                if (UNEXPECTED(EG(exception) != NULL)) {
4322                    HANDLE_EXCEPTION();
4323                }
4324                if (UNEXPECTED(ce == NULL)) {
4325                    zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op1.zv));
4326                }
4327                CACHE_PTR(Z_CACHE_SLOT_P(opline->op1.zv), ce);
4328            }
4329        } else {
4330            ce = Z_CE_P(EX_VAR(opline->op1.var));
4331            if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce)) != NULL) {
4332                ZVAL_DEREF(value);
4333                ZVAL_DUP(EX_VAR(opline->result.var), value);
4334                goto constant_fetch_end;
4335            }
4336        }
4337
4338        if (EXPECTED((value = zend_hash_find(&ce->constants_table, Z_STR_P(opline->op2.zv))) != NULL)) {
4339            ZVAL_DEREF(value);
4340            if (Z_CONSTANT_P(value)) {
4341                EG(scope) = ce;
4342                zval_update_constant(value, 1 TSRMLS_CC);
4343                EG(scope) = EX(scope);
4344            }
4345            if (IS_CONST == IS_CONST) {
4346                CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), value);
4347            } else {
4348                CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce, value);
4349            }
4350            ZVAL_DUP(EX_VAR(opline->result.var), value);
4351        } else if (Z_STRLEN_P(opline->op2.zv) == sizeof("class")-1 && memcmp(Z_STRVAL_P(opline->op2.zv), "class", sizeof("class") - 1) == 0) {
4352            /* "class" is assigned as a case-sensitive keyword from zend_do_resolve_class_name */
4353            ZVAL_STR(EX_VAR(opline->result.var), ce->name);
4354            zend_string_addref(ce->name);
4355        } else {
4356            zend_error_noreturn(E_ERROR, "Undefined class constant '%s'", Z_STRVAL_P(opline->op2.zv));
4357        }
4358    }
4359constant_fetch_end:
4360    CHECK_EXCEPTION();
4361    ZEND_VM_NEXT_OPCODE();
4362}
4363
4364static int ZEND_FASTCALL  ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4365{
4366    USE_OPLINE
4367
4368    zval *expr_ptr, new_expr;
4369
4370    SAVE_OPLINE();
4371    if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
4372        (opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
4373        expr_ptr = NULL;
4374        if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(expr_ptr) == IS_STR_OFFSET)) {
4375            zend_error_noreturn(E_ERROR, "Cannot create references to/from string offsets");
4376        }
4377        ZVAL_MAKE_REF(expr_ptr);
4378        Z_ADDREF_P(expr_ptr);
4379
4380    } else {
4381        expr_ptr = opline->op1.zv;
4382        if (0) { /* temporary variable */
4383            ZVAL_COPY_VALUE(&new_expr, expr_ptr);
4384            expr_ptr = &new_expr;
4385        } else if (IS_CONST == IS_CONST) {
4386            if (!Z_IMMUTABLE_P(expr_ptr)) {
4387                ZVAL_DUP(&new_expr, expr_ptr);
4388                expr_ptr = &new_expr;
4389            }
4390        } else if (Z_ISREF_P(expr_ptr)) {
4391            ZVAL_DUP(&new_expr, Z_REFVAL_P(expr_ptr));
4392            expr_ptr = &new_expr;
4393
4394        } else if (IS_CONST == IS_CV && Z_REFCOUNTED_P(expr_ptr)) {
4395            Z_ADDREF_P(expr_ptr);
4396        }
4397    }
4398
4399    if (IS_CONST != IS_UNUSED) {
4400
4401        zval *offset = opline->op2.zv;
4402        zend_string *str;
4403        zend_ulong hval;
4404
4405add_again:
4406        switch (Z_TYPE_P(offset)) {
4407            case IS_DOUBLE:
4408                hval = zend_dval_to_lval(Z_DVAL_P(offset));
4409                goto num_index;
4410            case IS_LONG:
4411                hval = Z_LVAL_P(offset);
4412num_index:
4413                zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
4414                break;
4415            case IS_STRING:
4416                str = Z_STR_P(offset);
4417                if (IS_CONST != IS_CONST) {
4418                    if (ZEND_HANDLE_NUMERIC(str, hval)) {
4419                        goto num_index;
4420                    }
4421                }
4422str_index:
4423                zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), str, expr_ptr);
4424                break;
4425            case IS_NULL:
4426                str = STR_EMPTY_ALLOC();
4427                goto str_index;
4428            case IS_FALSE:
4429                hval = 0;
4430                goto num_index;
4431            case IS_TRUE:
4432                hval = 1;
4433                goto num_index;
4434            case IS_REFERENCE:
4435                offset = Z_REFVAL_P(offset);
4436                goto add_again;
4437                break;
4438            default:
4439                zend_error(E_WARNING, "Illegal offset type");
4440                zval_ptr_dtor(expr_ptr);
4441                /* do nothing */
4442                break;
4443        }
4444
4445    } else {
4446        zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
4447    }
4448    CHECK_EXCEPTION();
4449    ZEND_VM_NEXT_OPCODE();
4450}
4451
4452static int ZEND_FASTCALL  ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4453{
4454    zval *array;
4455    uint32_t size;
4456    USE_OPLINE
4457
4458    array = EX_VAR(opline->result.var);
4459    if (IS_CONST != IS_UNUSED) {
4460        size = opline->extended_value >> ZEND_ARRAY_SIZE_SHIFT;
4461    } else {
4462        size = 0;
4463    }
4464    ZVAL_NEW_ARR(array);
4465    zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0);
4466
4467    if (IS_CONST != IS_UNUSED) {
4468        /* Explicitly initialize array as not-packed if flag is set */
4469        if (opline->extended_value & ZEND_ARRAY_NOT_PACKED) {
4470            zend_hash_real_init(Z_ARRVAL_P(array), 0);
4471        }
4472    }
4473
4474    if (IS_CONST == IS_UNUSED) {
4475        ZEND_VM_NEXT_OPCODE();
4476#if 0 || IS_CONST != IS_UNUSED
4477    } else {
4478        return ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
4479#endif
4480    }
4481}
4482
4483static int ZEND_FASTCALL  ZEND_UNSET_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4484{
4485    USE_OPLINE
4486    zval tmp, *varname;
4487    HashTable *target_symbol_table;
4488
4489    zend_bool tmp_is_dup = 0;
4490
4491    SAVE_OPLINE();
4492    if (IS_CONST == IS_CV &&
4493        IS_CONST == IS_UNUSED &&
4494        (opline->extended_value & ZEND_QUICK_SET)) {
4495        ZVAL_COPY_VALUE(&tmp, EX_VAR(opline->op1.var));
4496        ZVAL_UNDEF(EX_VAR(opline->op1.var));
4497        zval_ptr_dtor(&tmp);
4498        CHECK_EXCEPTION();
4499        ZEND_VM_NEXT_OPCODE();
4500    }
4501
4502    varname = opline->op1.zv;
4503
4504    if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
4505        ZVAL_DUP(&tmp, varname);
4506        convert_to_string(&tmp);
4507        varname = &tmp;
4508        tmp_is_dup = 1;
4509    } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
4510        ZVAL_COPY(&tmp, varname);
4511        varname = &tmp;
4512    }
4513
4514    if (IS_CONST != IS_UNUSED) {
4515        zend_class_entry *ce;
4516
4517        if (IS_CONST == IS_CONST) {
4518            if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
4519                ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
4520            } else {
4521                ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
4522                if (UNEXPECTED(EG(exception) != NULL)) {
4523                    if (IS_CONST != IS_CONST && tmp_is_dup) {
4524                        zval_dtor(&tmp);
4525                    } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
4526                        zval_ptr_dtor(&tmp);
4527                    }
4528
4529                    HANDLE_EXCEPTION();
4530                }
4531                if (UNEXPECTED(ce == NULL)) {
4532                    zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL_P(opline->op2.zv));
4533                }
4534                CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
4535            }
4536        } else {
4537            ce = Z_CE_P(EX_VAR(opline->op2.var));
4538        }
4539        zend_std_unset_static_property(ce, Z_STR_P(varname), ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
4540    } else {
4541        target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
4542        zend_hash_del_ind(target_symbol_table, Z_STR_P(varname));
4543    }
4544
4545    if (IS_CONST != IS_CONST && tmp_is_dup) {
4546        zval_dtor(&tmp);
4547    } else if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
4548        zval_ptr_dtor(&tmp);
4549    }
4550
4551    CHECK_EXCEPTION();
4552    ZEND_VM_NEXT_OPCODE();
4553}
4554
4555static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4556{
4557    USE_OPLINE
4558    zval *value;
4559    zend_bool isset = 1;
4560
4561    SAVE_OPLINE();
4562    if (IS_CONST == IS_CV &&
4563        IS_CONST == IS_UNUSED &&
4564        (opline->extended_value & ZEND_QUICK_SET)) {
4565        if (Z_TYPE_P(EX_VAR(opline->op1.var)) != IS_UNDEF) {
4566            value = EX_VAR(opline->op1.var);
4567            ZVAL_DEREF(value);
4568        } else {
4569            isset = 0;
4570        }
4571    } else {
4572        HashTable *target_symbol_table;
4573
4574        zval tmp, *varname = opline->op1.zv;
4575
4576        if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
4577            ZVAL_DUP(&tmp, varname);
4578            convert_to_string(&tmp);
4579            varname = &tmp;
4580        }
4581
4582        if (IS_CONST != IS_UNUSED) {
4583            zend_class_entry *ce;
4584
4585            if (IS_CONST == IS_CONST) {
4586                if (CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv))) {
4587                    ce = CACHED_PTR(Z_CACHE_SLOT_P(opline->op2.zv));
4588                } else {
4589                    ce = zend_fetch_class_by_name(Z_STR_P(opline->op2.zv), opline->op2.zv + 1, 0 TSRMLS_CC);
4590                    if (UNEXPECTED(ce == NULL)) {
4591                        CHECK_EXCEPTION();
4592                        ZEND_VM_NEXT_OPCODE();
4593                    }
4594                    CACHE_PTR(Z_CACHE_SLOT_P(opline->op2.zv), ce);
4595                }
4596            } else {
4597                ce = Z_CE_P(EX_VAR(opline->op2.var));
4598            }
4599            value = zend_std_get_static_property(ce, Z_STR_P(varname), 1, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(varname)) : NULL) TSRMLS_CC);
4600            if (!value) {
4601                isset = 0;
4602            }
4603        } else {
4604            target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK TSRMLS_CC);
4605            if ((value = zend_hash_find(target_symbol_table, Z_STR_P(varname))) == NULL) {
4606                isset = 0;
4607            }
4608        }
4609
4610        if (IS_CONST != IS_CONST && varname == &tmp) {
4611            zval_dtor(&tmp);
4612        }
4613
4614    }
4615
4616    if (opline->extended_value & ZEND_ISSET) {
4617        if (isset && Z_TYPE_P(value) != IS_NULL &&
4618            (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL)) {
4619            ZVAL_BOOL(EX_VAR(opline->result.var), 1);
4620        } else {
4621            ZVAL_BOOL(EX_VAR(opline->result.var), 0);
4622        }
4623    } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
4624        if (!isset || !i_zend_is_true(value TSRMLS_CC)) {
4625            ZVAL_BOOL(EX_VAR(opline->result.var), 1);
4626        } else {
4627            ZVAL_BOOL(EX_VAR(opline->result.var), 0);
4628        }
4629    }
4630
4631    CHECK_EXCEPTION();
4632    ZEND_VM_NEXT_OPCODE();
4633}
4634
4635static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4636{
4637    USE_OPLINE
4638
4639    zval *container;
4640    int result;
4641    zend_ulong hval;
4642    zval *offset;
4643
4644    SAVE_OPLINE();
4645    container = opline->op1.zv;
4646    offset = opline->op2.zv;
4647
4648    if (Z_TYPE_P(container) == IS_ARRAY) {
4649        HashTable *ht = Z_ARRVAL_P(container);
4650        zval *value;
4651        zend_string *str;
4652
4653isset_again:
4654        if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
4655            str = Z_STR_P(offset);
4656            if (IS_CONST != IS_CONST) {
4657                if (ZEND_HANDLE_NUMERIC(str, hval)) {
4658                    goto num_index_prop;
4659                }
4660            }
4661str_index_prop:
4662            value = zend_hash_find_ind(ht, str);
4663        } else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
4664            hval = Z_LVAL_P(offset);
4665num_index_prop:
4666            value = zend_hash_index_find(ht, hval);
4667        } else {
4668            switch (Z_TYPE_P(offset)) {
4669                case IS_DOUBLE:
4670                    hval = zend_dval_to_lval(Z_DVAL_P(offset));
4671                    goto num_index_prop;
4672                case IS_NULL:
4673                    str = STR_EMPTY_ALLOC();
4674                    goto str_index_prop;
4675                case IS_FALSE:
4676                    hval = 0;
4677                    goto num_index_prop;
4678                case IS_TRUE:
4679                    hval = 1;
4680                    goto num_index_prop;
4681                case IS_RESOURCE:
4682                    hval = Z_RES_HANDLE_P(offset);
4683                    goto num_index_prop;
4684                case IS_REFERENCE:
4685                    offset = Z_REFVAL_P(offset);
4686                    goto isset_again;
4687                default:
4688                    zend_error(E_WARNING, "Illegal offset type in isset or empty");
4689                    value = NULL;
4690                    break;
4691            }
4692        }
4693
4694        if (opline->extended_value & ZEND_ISSET) {
4695            /* > IS_NULL means not IS_UNDEF and not IS_NULL */
4696            result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
4697                (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
4698        } else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
4699            result = (value == NULL || !i_zend_is_true(value TSRMLS_CC));
4700        }
4701    } else if (Z_TYPE_P(container) == IS_OBJECT) {
4702        if (Z_OBJ_HT_P(container)->has_dimension) {
4703            result = Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0 TSRMLS_CC);
4704        } else {
4705            zend_error(E_NOTICE, "Trying to check element of non-array");
4706            result = 0;
4707        }
4708        if ((opline->extended_value & ZEND_ISSET) == 0) {
4709            result = !result;
4710        }
4711    } else if (Z_TYPE_P(container) == IS_STRING) { /* string offsets */
4712        zval tmp;
4713
4714        result = 0;
4715        if (UNEXPECTED(Z_TYPE_P(offset) != IS_LONG)) {
4716            if (IS_CONST == IS_CV || IS_CONST == IS_VAR) {
4717                ZVAL_DEREF(offset);
4718            }
4719            if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
4720                    || (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
4721                        && IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
4722                ZVAL_DUP(&tmp, offset);
4723                convert_to_long(&tmp);
4724                offset = &tmp;
4725            }
4726        }
4727        if (Z_TYPE_P(offset) == IS_LONG) {
4728            if (offset->value.lval >= 0 && offset->value.lval < Z_STRLEN_P(container)) {
4729                if ((opline->extended_value & ZEND_ISSET) ||
4730                    Z_STRVAL_P(container)[offset->value.lval] != '0') {
4731                    result = 1;
4732                }
4733            }
4734        }
4735        if ((opline->extended_value & ZEND_ISSET) == 0) {
4736            result = !result;
4737        }
4738    } else {
4739        result = ((opline->extended_value & ZEND_ISSET) == 0);
4740    }
4741
4742    ZVAL_BOOL(EX_VAR(opline->result.var), result);
4743
4744    CHECK_EXCEPTION();
4745    ZEND_VM_NEXT_OPCODE();
4746}
4747
4748static int ZEND_FASTCALL  ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4749{
4750    USE_OPLINE
4751
4752    zval *container;
4753    int result;
4754    zval *offset;
4755
4756    SAVE_OPLINE();
4757    container = opline->op1.zv;
4758    offset = opline->op2.zv;
4759
4760    if (Z_TYPE_P(container) == IS_OBJECT) {
4761        if (Z_OBJ_HT_P(container)->has_property) {
4762            result = Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(offset)) : NULL) TSRMLS_CC);
4763        } else {
4764            zend_error(E_NOTICE, "Trying to check property of non-object");
4765            result = 0;
4766        }
4767        if ((opline->extended_value & ZEND_ISSET) == 0) {
4768            result = !result;
4769        }
4770    } else {
4771        result = ((opline->extended_value & ZEND_ISSET) == 0);
4772    }
4773
4774    ZVAL_BOOL(EX_VAR(opline->result.var), result);
4775
4776    CHECK_EXCEPTION();
4777    ZEND_VM_NEXT_OPCODE();
4778}
4779
4780static int ZEND_FASTCALL  ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4781{
4782    USE_OPLINE
4783
4784    zval *name;
4785    zval *val;
4786    zend_constant c;
4787
4788    SAVE_OPLINE();
4789    name  = opline->op1.zv;
4790    val   = opline->op2.zv;
4791
4792    ZVAL_COPY_VALUE(&c.value, val);
4793    if (Z_OPT_CONSTANT(c.value)) {
4794        zval_update_constant(&c.value, 0 TSRMLS_CC);
4795    } else {
4796        /* IS_CONST can't be IS_OBJECT, IS_RESOURCE or IS_REFERENCE */
4797        if (UNEXPECTED(Z_OPT_COPYABLE(c.value))) {
4798            zval_copy_ctor_func(&c.value);
4799        }
4800    }
4801    c.flags = CONST_CS; /* non persistent, case sensetive */
4802    c.name = zend_string_dup(Z_STR_P(name), 0);
4803    c.module_number = PHP_USER_CONSTANT;
4804
4805    if (zend_register_constant(&c TSRMLS_CC) == FAILURE) {
4806    }
4807
4808
4809    CHECK_EXCEPTION();
4810    ZEND_VM_NEXT_OPCODE();
4811}
4812
4813static int ZEND_FASTCALL  ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4814{
4815    USE_OPLINE
4816
4817    /* The generator object is stored in EX(return_value) */
4818    zend_generator *generator = (zend_generator *) EX(return_value);
4819
4820    if (generator->flags & ZEND_GENERATOR_FORCED_CLOSE) {
4821        zend_error_noreturn(E_ERROR, "Cannot yield from finally in a force-closed generator");
4822    }
4823
4824    /* Destroy the previously yielded value */
4825    zval_ptr_dtor(&generator->value);
4826
4827    /* Destroy the previously yielded key */
4828    zval_ptr_dtor(&generator->key);
4829
4830    /* Set the new yielded value */
4831    if (IS_CONST != IS_UNUSED) {
4832
4833
4834        if (EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE) {
4835            /* Constants and temporary variables aren't yieldable by reference,
4836             * but we still allow them with a notice. */
4837            if (IS_CONST == IS_CONST || IS_CONST == IS_TMP_VAR) {
4838                zval *value;
4839
4840                zend_error(E_NOTICE, "Only variable references should be yielded by reference");
4841
4842                value = opline->op1.zv;
4843                ZVAL_COPY_VALUE(&generator->value, value);
4844                if (Z_OPT_REFCOUNTED(generator->value)) Z_SET_REFCOUNT(generator->value, 1);
4845
4846                /* Temporary variables don't need ctor copying */
4847                if (!0) {
4848                    zval_copy_ctor(&generator->value);
4849                }
4850            } else {
4851                zval *value_ptr = NULL;
4852
4853                if (IS_CONST == IS_VAR && UNEXPECTED(Z_TYPE_P(value_ptr) == IS_STR_OFFSET)) {
4854                    zend_error_noreturn(E_ERROR, "Cannot yield string offsets by reference");
4855                }
4856
4857                /* If a function call result is yielded and the function did
4858                 * not return by reference we throw a notice. */
4859                if (IS_CONST == IS_VAR && !Z_ISREF_P(value_ptr)
4860                    && !(opline->extended_value == ZEND_RETURNS_FUNCTION
4861                         && (Z_VAR_FLAGS_P(value_ptr) & IS_VAR_RET_REF))) {
4862                    zend_error(E_NOTICE, "Only variable references should be yielded by reference");
4863                } else {
4864                    ZVAL_MAKE_REF(value_ptr);
4865                }
4866                ZVAL_COPY(&generator->value, value_ptr);
4867
4868            }
4869        } else {
4870            zval *value = opline->op1.zv;
4871
4872            /* Consts, temporary variables and references need copying */
4873            if (IS_CONST == IS_CONST) {
4874                ZVAL_DUP(&generator->value, value);
4875            } else if (IS_CONST == IS_TMP_VAR) {
4876                ZVAL_COPY_VALUE(&generator->value, value);
4877            } else if (Z_ISREF_P(value)) {
4878                ZVAL_DUP(&generator->value, Z_REFVAL_P(value));
4879
4880            } else {
4881                if (IS_CONST == IS_CV) {
4882                    if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
4883                }
4884                ZVAL_COPY_VALUE(&generator->value, value);
4885            }
4886        }
4887    } else {
4888        /* If no value was specified yield null */
4889        ZVAL_NULL(&generator->value);
4890    }
4891
4892    /* Set the new yielded key */
4893    if (IS_CONST != IS_UNUSED) {
4894
4895        zval *key = opline->op2.zv;
4896
4897        /* Consts, temporary variables and references need copying */
4898        if (IS_CONST == IS_CONST) {
4899            ZVAL_DUP(&generator->key, key);
4900        } else if (IS_CONST == IS_TMP_VAR) {
4901            ZVAL_COPY_VALUE(&generator->key, key);
4902        } else if (Z_ISREF_P(key)) {
4903            ZVAL_DUP(&generator->key, Z_REFVAL_P(key));
4904
4905        } else {
4906            if (IS_CONST == IS_CV) {
4907                if (Z_REFCOUNTED_P(key)) Z_ADDREF_P(key);
4908            }
4909            ZVAL_COPY_VALUE(&generator->key, key);
4910        }
4911
4912        if (Z_TYPE(generator->key) == IS_LONG
4913            && Z_LVAL(generator->key) > generator->largest_used_integer_key
4914        ) {
4915            generator->largest_used_integer_key = Z_LVAL(generator->key);
4916        }
4917    } else {
4918        /* If no key was specified we use auto-increment keys */
4919        generator->largest_used_integer_key++;
4920        ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
4921    }
4922
4923    if (RETURN_VALUE_USED(opline)) {
4924        /* If the return value of yield is used set the send
4925         * target and initialize it to NULL */
4926        generator->send_target = EX_VAR(opline->result.var);
4927        ZVAL_NULL(generator->send_target);
4928    } else {
4929        generator->send_target = NULL;
4930    }
4931
4932    /* We increment to the next op, so we are at the correct position when the
4933     * generator is resumed. */
4934    ZEND_VM_INC_OPCODE();
4935
4936    /* The GOTO VM uses a local opline variable. We need to set the opline
4937     * variable in execute_data so we don't resume at an old position. */
4938    SAVE_OPLINE();
4939
4940    ZEND_VM_RETURN();
4941}
4942
4943static int ZEND_FASTCALL  ZEND_POW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4944{
4945    USE_OPLINE
4946
4947
4948    SAVE_OPLINE();
4949    pow_function(EX_VAR(opline->result.var),
4950        opline->op1.zv,
4951        opline->op2.zv TSRMLS_CC);
4952
4953
4954    CHECK_EXCEPTION();
4955    ZEND_VM_NEXT_OPCODE();
4956}
4957
4958static int ZEND_FASTCALL  ZEND_ADD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4959{
4960    USE_OPLINE
4961    zend_free_op free_op2;
4962
4963    SAVE_OPLINE();
4964    fast_add_function(EX_VAR(opline->result.var),
4965        opline->op1.zv,
4966        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
4967
4968    zval_dtor(free_op2.var);
4969    CHECK_EXCEPTION();
4970    ZEND_VM_NEXT_OPCODE();
4971}
4972
4973static int ZEND_FASTCALL  ZEND_SUB_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4974{
4975    USE_OPLINE
4976    zend_free_op free_op2;
4977
4978    SAVE_OPLINE();
4979    fast_sub_function(EX_VAR(opline->result.var),
4980        opline->op1.zv,
4981        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
4982
4983    zval_dtor(free_op2.var);
4984    CHECK_EXCEPTION();
4985    ZEND_VM_NEXT_OPCODE();
4986}
4987
4988static int ZEND_FASTCALL  ZEND_MUL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4989{
4990    USE_OPLINE
4991    zend_free_op free_op2;
4992
4993    SAVE_OPLINE();
4994    fast_mul_function(EX_VAR(opline->result.var),
4995        opline->op1.zv,
4996        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
4997
4998    zval_dtor(free_op2.var);
4999    CHECK_EXCEPTION();
5000    ZEND_VM_NEXT_OPCODE();
5001}
5002
5003static int ZEND_FASTCALL  ZEND_DIV_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5004{
5005    USE_OPLINE
5006    zend_free_op free_op2;
5007
5008    SAVE_OPLINE();
5009    fast_div_function(EX_VAR(opline->result.var),
5010        opline->op1.zv,
5011        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
5012
5013    zval_dtor(free_op2.var);
5014    CHECK_EXCEPTION();
5015    ZEND_VM_NEXT_OPCODE();
5016}
5017
5018static int ZEND_FASTCALL  ZEND_MOD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5019{
5020    USE_OPLINE
5021    zend_free_op free_op2;
5022
5023    SAVE_OPLINE();
5024    fast_mod_function(EX_VAR(opline->result.var),
5025        opline->op1.zv,
5026        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
5027
5028    zval_dtor(free_op2.var);
5029    CHECK_EXCEPTION();
5030    ZEND_VM_NEXT_OPCODE();
5031}
5032
5033static int ZEND_FASTCALL  ZEND_SL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5034{
5035    USE_OPLINE
5036    zend_free_op free_op2;
5037
5038    SAVE_OPLINE();
5039    shift_left_function(EX_VAR(opline->result.var),
5040        opline->op1.zv,
5041        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
5042
5043    zval_dtor(free_op2.var);
5044    CHECK_EXCEPTION();
5045    ZEND_VM_NEXT_OPCODE();
5046}
5047
5048static int ZEND_FASTCALL  ZEND_SR_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5049{
5050    USE_OPLINE
5051    zend_free_op free_op2;
5052
5053    SAVE_OPLINE();
5054    shift_right_function(EX_VAR(opline->result.var),
5055        opline->op1.zv,
5056        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
5057
5058    zval_dtor(free_op2.var);
5059    CHECK_EXCEPTION();
5060    ZEND_VM_NEXT_OPCODE();
5061}
5062
5063static int ZEND_FASTCALL  ZEND_CONCAT_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5064{
5065    USE_OPLINE
5066    zend_free_op free_op2;
5067
5068    SAVE_OPLINE();
5069    concat_function(EX_VAR(opline->result.var),
5070        opline->op1.zv,
5071        _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC) TSRMLS_CC);
5072
5073    zval_dtor(free_op2.var);
5074    CHECK_EXCEPTION();
5075    ZEND_VM_NEXT_OPCODE();
5076}
5077
5078static int ZEND_FASTCALL  ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5079{
5080    USE_OPLINE
5081    zend_free_op free_op2;
5082
5083    SAVE_OPLINE();
5084    fast_is_identical_function(EX_VAR(opline->result.var),
5085        opline->op1.zv,
5086