1/*
2   +----------------------------------------------------------------------+
3   | Zend Engine                                                          |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1998-2016 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
309#define SPEC_START_MASK        0x0000ffff
310#define SPEC_RULE_OP1          0x00010000
311#define SPEC_RULE_OP2          0x00020000
312#define SPEC_RULE_OP_DATA      0x00040000
313#define SPEC_RULE_RETVAL       0x00080000
314#define SPEC_RULE_QUICK_ARG    0x00100000
315#define SPEC_RULE_SMART_BRANCH 0x00200000
316
317static const uint32_t *zend_spec_handlers;
318static const void **zend_opcode_handlers;
319static int zend_handlers_count;
320static const void *zend_vm_get_opcode_handler(zend_uchar opcode, const zend_op* op);
321
322
323#ifdef ZEND_VM_FP_GLOBAL_REG
324#pragma GCC diagnostic ignored "-Wvolatile-register-var"
325register zend_execute_data* volatile execute_data __asm__(ZEND_VM_FP_GLOBAL_REG);
326#pragma GCC diagnostic warning "-Wvolatile-register-var"
327#endif
328
329#ifdef ZEND_VM_IP_GLOBAL_REG
330#pragma GCC diagnostic ignored "-Wvolatile-register-var"
331register const zend_op* volatile opline __asm__(ZEND_VM_IP_GLOBAL_REG);
332#pragma GCC diagnostic warning "-Wvolatile-register-var"
333#endif
334
335#ifdef ZEND_VM_FP_GLOBAL_REG
336# define ZEND_OPCODE_HANDLER_ARGS void
337# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU
338# define ZEND_OPCODE_HANDLER_ARGS_DC
339# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC
340#else
341# define ZEND_OPCODE_HANDLER_ARGS zend_execute_data *execute_data
342# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU execute_data
343# define ZEND_OPCODE_HANDLER_ARGS_DC , ZEND_OPCODE_HANDLER_ARGS
344# define ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC , ZEND_OPCODE_HANDLER_ARGS_PASSTHRU
345#endif
346
347#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)
348# define ZEND_OPCODE_HANDLER_RET void
349# define ZEND_VM_TAIL_CALL(call) call; return
350# ifdef ZEND_VM_TAIL_CALL_DISPATCH
351#  define ZEND_VM_CONTINUE()     ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU); return
352# else
353#  define ZEND_VM_CONTINUE()     return
354# endif
355# define ZEND_VM_RETURN()        opline = NULL; return
356#else
357# define ZEND_OPCODE_HANDLER_RET int
358# define ZEND_VM_TAIL_CALL(call) return call
359# define ZEND_VM_CONTINUE()      return  0
360# define ZEND_VM_RETURN()        return -1
361#endif
362
363typedef ZEND_OPCODE_HANDLER_RET (ZEND_FASTCALL *opcode_handler_t) (ZEND_OPCODE_HANDLER_ARGS);
364
365#undef OPLINE
366#undef DCL_OPLINE
367#undef USE_OPLINE
368#undef LOAD_OPLINE
369#undef LOAD_OPLINE_EX
370#undef SAVE_OPLINE
371#define DCL_OPLINE
372#ifdef ZEND_VM_IP_GLOBAL_REG
373# define OPLINE opline
374# define USE_OPLINE
375# define LOAD_OPLINE() opline = EX(opline)
376# define LOAD_NEXT_OPLINE() opline = EX(opline) + 1
377# define SAVE_OPLINE() EX(opline) = opline
378#else
379# define OPLINE EX(opline)
380# define USE_OPLINE const zend_op *opline = EX(opline);
381# define LOAD_OPLINE()
382# define LOAD_NEXT_OPLINE() ZEND_VM_INC_OPCODE()
383# define SAVE_OPLINE()
384#endif
385#undef HANDLE_EXCEPTION
386#undef HANDLE_EXCEPTION_LEAVE
387#define HANDLE_EXCEPTION() LOAD_OPLINE(); ZEND_VM_CONTINUE()
388#define HANDLE_EXCEPTION_LEAVE() LOAD_OPLINE(); ZEND_VM_LEAVE()
389#if defined(ZEND_VM_FP_GLOBAL_REG)
390# define ZEND_VM_ENTER()           execute_data = EG(current_execute_data); LOAD_OPLINE(); ZEND_VM_INTERRUPT_CHECK(); ZEND_VM_CONTINUE()
391# define ZEND_VM_LEAVE()           ZEND_VM_CONTINUE()
392#elif defined(ZEND_VM_IP_GLOBAL_REG)
393# define ZEND_VM_ENTER()           opline = EG(current_execute_data)->opline; return 1
394# define ZEND_VM_LEAVE()           return  2
395#else
396# define ZEND_VM_ENTER()           return  1
397# define ZEND_VM_LEAVE()           return  2
398#endif
399#define ZEND_VM_DISPATCH(opcode, opline) ZEND_VM_TAIL_CALL(((opcode_handler_t)zend_vm_get_opcode_handler(opcode, opline))(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
400
401
402ZEND_API void execute_ex(zend_execute_data *ex)
403{
404	DCL_OPLINE
405
406#ifdef ZEND_VM_IP_GLOBAL_REG
407	const zend_op *orig_opline = opline;
408#endif
409#ifdef ZEND_VM_FP_GLOBAL_REG
410	zend_execute_data *orig_execute_data = execute_data;
411	execute_data = ex;
412#else
413	zend_execute_data *execute_data = ex;
414#endif
415
416
417	LOAD_OPLINE();
418	ZEND_VM_INTERRUPT_CHECK();
419
420	while (1) {
421#if !defined(ZEND_VM_FP_GLOBAL_REG) || !defined(ZEND_VM_IP_GLOBAL_REG)
422			int ret;
423#endif
424#if defined(ZEND_VM_FP_GLOBAL_REG) && defined(ZEND_VM_IP_GLOBAL_REG)
425		((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
426		if (UNEXPECTED(!OPLINE)) {
427#else
428		if (UNEXPECTED((ret = ((opcode_handler_t)OPLINE->handler)(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU)) != 0)) {
429#endif
430#ifdef ZEND_VM_FP_GLOBAL_REG
431			execute_data = orig_execute_data;
432# ifdef ZEND_VM_IP_GLOBAL_REG
433			opline = orig_opline;
434# endif
435			return;
436#else
437			if (EXPECTED(ret > 0)) {
438				execute_data = EG(current_execute_data);
439				ZEND_VM_INTERRUPT_CHECK();
440			} else {
441# ifdef ZEND_VM_IP_GLOBAL_REG
442				opline = orig_opline;
443# endif
444				return;
445			}
446#endif
447		}
448
449	}
450	zend_error_noreturn(E_CORE_ERROR, "Arrived at end of main loop which shouldn't happen");
451}
452
453ZEND_API void zend_execute(zend_op_array *op_array, zval *return_value)
454{
455	zend_execute_data *execute_data;
456
457	if (EG(exception) != NULL) {
458		return;
459	}
460
461	execute_data = zend_vm_stack_push_call_frame(ZEND_CALL_TOP_CODE | ZEND_CALL_HAS_SYMBOL_TABLE,
462		(zend_function*)op_array, 0, zend_get_called_scope(EG(current_execute_data)), zend_get_this_object(EG(current_execute_data)));
463	if (EG(current_execute_data)) {
464		execute_data->symbol_table = zend_rebuild_symbol_table();
465	} else {
466		execute_data->symbol_table = &EG(symbol_table);
467	}
468	EX(prev_execute_data) = EG(current_execute_data);
469	i_init_execute_data(execute_data, op_array, return_value);
470	zend_execute_ex(execute_data);
471	zend_vm_stack_free_call_frame(execute_data);
472}
473
474static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS)
475{
476	zend_execute_data *old_execute_data;
477	uint32_t call_info = EX_CALL_INFO();
478
479	if (EXPECTED(ZEND_CALL_KIND_EX(call_info) == ZEND_CALL_NESTED_FUNCTION)) {
480		i_free_compiled_variables(execute_data);
481		if (UNEXPECTED(call_info & (ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED))) {
482			if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
483				zend_clean_and_cache_symbol_table(EX(symbol_table));
484			}
485			EG(current_execute_data) = EX(prev_execute_data);
486			if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
487				zend_object *object = Z_OBJ(execute_data->This);
488#if 0
489				if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
490#else
491				if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
492#endif
493					GC_REFCOUNT(object)--;
494					if (GC_REFCOUNT(object) == 1) {
495						zend_object_store_ctor_failed(object);
496					}
497				}
498				OBJ_RELEASE(object);
499			} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
500				OBJ_RELEASE((zend_object*)execute_data->func->op_array.prototype);
501			}
502
503			zend_vm_stack_free_extra_args_ex(call_info, execute_data);
504			old_execute_data = execute_data;
505			execute_data = EX(prev_execute_data);
506			zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
507		} else {
508			EG(current_execute_data) = EX(prev_execute_data);
509			if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
510				zend_object *object = Z_OBJ(execute_data->This);
511#if 0
512				if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) {
513#else
514				if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) {
515#endif
516					GC_REFCOUNT(object)--;
517					if (GC_REFCOUNT(object) == 1) {
518						zend_object_store_ctor_failed(object);
519					}
520				}
521				OBJ_RELEASE(object);
522			} else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
523				OBJ_RELEASE((zend_object*)execute_data->func->op_array.prototype);
524			}
525			EG(vm_stack_top) = (zval*)execute_data;
526			execute_data = EX(prev_execute_data);
527		}
528
529		if (UNEXPECTED(EG(exception) != NULL)) {
530			const zend_op *old_opline = EX(opline);
531			zend_throw_exception_internal(NULL);
532			if (RETURN_VALUE_USED(old_opline)) {
533				zval_ptr_dtor(EX_VAR(old_opline->result.var));
534			}
535			HANDLE_EXCEPTION_LEAVE();
536		}
537
538		LOAD_NEXT_OPLINE();
539		ZEND_VM_LEAVE();
540	} else if (EXPECTED((ZEND_CALL_KIND_EX(call_info) & ZEND_CALL_TOP) == 0)) {
541		zend_detach_symbol_table(execute_data);
542		destroy_op_array(&EX(func)->op_array);
543		efree_size(EX(func), sizeof(zend_op_array));
544		old_execute_data = execute_data;
545		execute_data = EG(current_execute_data) = EX(prev_execute_data);
546		zend_vm_stack_free_call_frame_ex(call_info, old_execute_data);
547
548		zend_attach_symbol_table(execute_data);
549		if (UNEXPECTED(EG(exception) != NULL)) {
550			zend_throw_exception_internal(NULL);
551			HANDLE_EXCEPTION_LEAVE();
552		}
553
554		LOAD_NEXT_OPLINE();
555		ZEND_VM_LEAVE();
556	} else {
557		if (ZEND_CALL_KIND_EX(call_info) == ZEND_CALL_TOP_FUNCTION) {
558			i_free_compiled_variables(execute_data);
559			if (UNEXPECTED(call_info & (ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS))) {
560				if (UNEXPECTED(call_info & ZEND_CALL_HAS_SYMBOL_TABLE)) {
561					zend_clean_and_cache_symbol_table(EX(symbol_table));
562				}
563				zend_vm_stack_free_extra_args_ex(call_info, execute_data);
564			}
565			EG(current_execute_data) = EX(prev_execute_data);
566			if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) {
567				OBJ_RELEASE((zend_object*)EX(func)->op_array.prototype);
568			}
569			ZEND_VM_RETURN();
570		} else /* if (call_kind == ZEND_CALL_TOP_CODE) */ {
571			zend_array *symbol_table = EX(symbol_table);
572
573			zend_detach_symbol_table(execute_data);
574			old_execute_data = EX(prev_execute_data);
575			while (old_execute_data) {
576				if (old_execute_data->func && (ZEND_CALL_INFO(old_execute_data) & ZEND_CALL_HAS_SYMBOL_TABLE)) {
577					if (old_execute_data->symbol_table == symbol_table) {
578						zend_attach_symbol_table(old_execute_data);
579					}
580					break;
581				}
582				old_execute_data = old_execute_data->prev_execute_data;
583			}
584			EG(current_execute_data) = EX(prev_execute_data);
585			ZEND_VM_RETURN();
586		}
587	}
588}
589
590static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
591{
592	USE_OPLINE
593
594	ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op1));
595	ZEND_VM_CONTINUE();
596}
597
598static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
599{
600	USE_OPLINE
601	zend_execute_data *call = EX(call);
602	zend_function *fbc = call->func;
603	zval *ret;
604	zval retval;
605
606	SAVE_OPLINE();
607	EX(call) = call->prev_execute_data;
608
609	call->prev_execute_data = execute_data;
610	EG(current_execute_data) = call;
611
612	ret = 0 ? EX_VAR(opline->result.var) : &retval;
613	ZVAL_NULL(ret);
614
615	fbc->internal_function.handler(call, ret);
616
617#if ZEND_DEBUG
618	ZEND_ASSERT(
619		EG(exception) || !call->func ||
620		!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
621		zend_verify_internal_return_type(call->func, ret));
622	ZEND_ASSERT(!Z_ISREF_P(ret));
623#endif
624
625	EG(current_execute_data) = call->prev_execute_data;
626	zend_vm_stack_free_args(call);
627	zend_vm_stack_free_call_frame(call);
628
629	if (!0) {
630		zval_ptr_dtor(ret);
631	}
632
633	if (UNEXPECTED(EG(exception) != NULL)) {
634		zend_throw_exception_internal(NULL);
635		if (0) {
636			zval_ptr_dtor(EX_VAR(opline->result.var));
637		}
638		HANDLE_EXCEPTION();
639	}
640
641	ZEND_VM_SET_OPCODE(opline + 1);
642	ZEND_VM_CONTINUE();
643}
644
645static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
646{
647	USE_OPLINE
648	zend_execute_data *call = EX(call);
649	zend_function *fbc = call->func;
650	zval *ret;
651	zval retval;
652
653	SAVE_OPLINE();
654	EX(call) = call->prev_execute_data;
655
656	call->prev_execute_data = execute_data;
657	EG(current_execute_data) = call;
658
659	ret = 1 ? EX_VAR(opline->result.var) : &retval;
660	ZVAL_NULL(ret);
661
662	fbc->internal_function.handler(call, ret);
663
664#if ZEND_DEBUG
665	ZEND_ASSERT(
666		EG(exception) || !call->func ||
667		!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
668		zend_verify_internal_return_type(call->func, ret));
669	ZEND_ASSERT(!Z_ISREF_P(ret));
670#endif
671
672	EG(current_execute_data) = call->prev_execute_data;
673	zend_vm_stack_free_args(call);
674	zend_vm_stack_free_call_frame(call);
675
676	if (!1) {
677		zval_ptr_dtor(ret);
678	}
679
680	if (UNEXPECTED(EG(exception) != NULL)) {
681		zend_throw_exception_internal(NULL);
682		if (1) {
683			zval_ptr_dtor(EX_VAR(opline->result.var));
684		}
685		HANDLE_EXCEPTION();
686	}
687
688	ZEND_VM_SET_OPCODE(opline + 1);
689	ZEND_VM_CONTINUE();
690}
691
692static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_UCALL_SPEC_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
693{
694	USE_OPLINE
695	zend_execute_data *call = EX(call);
696	zend_function *fbc = call->func;
697	zval *ret;
698
699	SAVE_OPLINE();
700	EX(call) = call->prev_execute_data;
701
702	ret = NULL;
703	if (0) {
704		ret = EX_VAR(opline->result.var);
705		ZVAL_NULL(ret);
706	}
707
708	call->prev_execute_data = execute_data;
709	i_init_func_execute_data(call, &fbc->op_array, ret, 0);
710
711	ZEND_VM_ENTER();
712}
713
714static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_UCALL_SPEC_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
715{
716	USE_OPLINE
717	zend_execute_data *call = EX(call);
718	zend_function *fbc = call->func;
719	zval *ret;
720
721	SAVE_OPLINE();
722	EX(call) = call->prev_execute_data;
723
724	ret = NULL;
725	if (1) {
726		ret = EX_VAR(opline->result.var);
727		ZVAL_NULL(ret);
728	}
729
730	call->prev_execute_data = execute_data;
731	i_init_func_execute_data(call, &fbc->op_array, ret, 0);
732
733	ZEND_VM_ENTER();
734}
735
736static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
737{
738	USE_OPLINE
739	zend_execute_data *call = EX(call);
740	zend_function *fbc = call->func;
741	zval *ret;
742
743	SAVE_OPLINE();
744	EX(call) = call->prev_execute_data;
745
746	if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
747		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
748			if (EXPECTED(0)) {
749				ret = EX_VAR(opline->result.var);
750				zend_generator_create_zval(call, &fbc->op_array, ret);
751			} else {
752				zend_vm_stack_free_args(call);
753			}
754
755			zend_vm_stack_free_call_frame(call);
756		} else {
757			ret = NULL;
758			if (0) {
759				ret = EX_VAR(opline->result.var);
760				ZVAL_NULL(ret);
761			}
762
763			call->prev_execute_data = execute_data;
764			i_init_func_execute_data(call, &fbc->op_array, ret, 0);
765
766			ZEND_VM_ENTER();
767		}
768	} else {
769		zval retval;
770		ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
771
772		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
773			zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
774				fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
775				fbc->common.scope ? "::" : "",
776				ZSTR_VAL(fbc->common.function_name));
777			if (UNEXPECTED(EG(exception) != NULL)) {
778				HANDLE_EXCEPTION();
779			}
780		}
781
782		call->prev_execute_data = execute_data;
783		EG(current_execute_data) = call;
784
785		if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
786		 && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
787			zend_vm_stack_free_call_frame(call);
788			zend_throw_exception_internal(NULL);
789			HANDLE_EXCEPTION();
790		}
791
792		ret = 0 ? EX_VAR(opline->result.var) : &retval;
793		ZVAL_NULL(ret);
794
795		fbc->internal_function.handler(call, ret);
796
797#if ZEND_DEBUG
798		if (!EG(exception) && call->func) {
799			ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
800				zend_verify_internal_return_type(call->func, ret));
801			ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
802				? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
803		}
804#endif
805
806		EG(current_execute_data) = call->prev_execute_data;
807		zend_vm_stack_free_args(call);
808		zend_vm_stack_free_call_frame(call);
809
810		if (!0) {
811			zval_ptr_dtor(ret);
812		}
813	}
814
815	if (UNEXPECTED(EG(exception) != NULL)) {
816		zend_throw_exception_internal(NULL);
817		if (0) {
818			zval_ptr_dtor(EX_VAR(opline->result.var));
819		}
820		HANDLE_EXCEPTION();
821	}
822	ZEND_VM_SET_OPCODE(opline + 1);
823	ZEND_VM_CONTINUE();
824}
825
826static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_BY_NAME_SPEC_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
827{
828	USE_OPLINE
829	zend_execute_data *call = EX(call);
830	zend_function *fbc = call->func;
831	zval *ret;
832
833	SAVE_OPLINE();
834	EX(call) = call->prev_execute_data;
835
836	if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
837		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
838			if (EXPECTED(1)) {
839				ret = EX_VAR(opline->result.var);
840				zend_generator_create_zval(call, &fbc->op_array, ret);
841			} else {
842				zend_vm_stack_free_args(call);
843			}
844
845			zend_vm_stack_free_call_frame(call);
846		} else {
847			ret = NULL;
848			if (1) {
849				ret = EX_VAR(opline->result.var);
850				ZVAL_NULL(ret);
851			}
852
853			call->prev_execute_data = execute_data;
854			i_init_func_execute_data(call, &fbc->op_array, ret, 0);
855
856			ZEND_VM_ENTER();
857		}
858	} else {
859		zval retval;
860		ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
861
862		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
863			zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
864				fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
865				fbc->common.scope ? "::" : "",
866				ZSTR_VAL(fbc->common.function_name));
867			if (UNEXPECTED(EG(exception) != NULL)) {
868				HANDLE_EXCEPTION();
869			}
870		}
871
872		call->prev_execute_data = execute_data;
873		EG(current_execute_data) = call;
874
875		if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
876		 && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
877			zend_vm_stack_free_call_frame(call);
878			zend_throw_exception_internal(NULL);
879			HANDLE_EXCEPTION();
880		}
881
882		ret = 1 ? EX_VAR(opline->result.var) : &retval;
883		ZVAL_NULL(ret);
884
885		fbc->internal_function.handler(call, ret);
886
887#if ZEND_DEBUG
888		if (!EG(exception) && call->func) {
889			ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
890				zend_verify_internal_return_type(call->func, ret));
891			ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
892				? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
893		}
894#endif
895
896		EG(current_execute_data) = call->prev_execute_data;
897		zend_vm_stack_free_args(call);
898		zend_vm_stack_free_call_frame(call);
899
900		if (!1) {
901			zval_ptr_dtor(ret);
902		}
903	}
904
905	if (UNEXPECTED(EG(exception) != NULL)) {
906		zend_throw_exception_internal(NULL);
907		if (1) {
908			zval_ptr_dtor(EX_VAR(opline->result.var));
909		}
910		HANDLE_EXCEPTION();
911	}
912	ZEND_VM_SET_OPCODE(opline + 1);
913	ZEND_VM_CONTINUE();
914}
915
916static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
917{
918	USE_OPLINE
919	zend_execute_data *call = EX(call);
920	zend_function *fbc = call->func;
921	zend_object *object;
922	zval *ret;
923
924	SAVE_OPLINE();
925	EX(call) = call->prev_execute_data;
926	if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
927		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
928			zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
929			HANDLE_EXCEPTION();
930		}
931		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
932			zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
933				fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
934				fbc->common.scope ? "::" : "",
935				ZSTR_VAL(fbc->common.function_name));
936			if (UNEXPECTED(EG(exception) != NULL)) {
937				HANDLE_EXCEPTION();
938			}
939		}
940	}
941
942	LOAD_OPLINE();
943
944	if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
945		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
946			if (EXPECTED(0)) {
947				ret = EX_VAR(opline->result.var);
948				zend_generator_create_zval(call, &fbc->op_array, ret);
949			} else {
950				if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_CLOSURE)) {
951					OBJ_RELEASE((zend_object*)fbc->op_array.prototype);
952				}
953				zend_vm_stack_free_args(call);
954			}
955		} else {
956			ret = NULL;
957			if (0) {
958				ret = EX_VAR(opline->result.var);
959				ZVAL_NULL(ret);
960			}
961
962			call->prev_execute_data = execute_data;
963			i_init_func_execute_data(call, &fbc->op_array, ret, 1);
964
965			if (EXPECTED(zend_execute_ex == execute_ex)) {
966				ZEND_VM_ENTER();
967			} else {
968				ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
969				zend_execute_ex(call);
970			}
971		}
972	} else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
973		zval retval;
974
975		call->prev_execute_data = execute_data;
976		EG(current_execute_data) = call;
977
978		if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
979		  && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
980			if (0) {
981				ZVAL_UNDEF(EX_VAR(opline->result.var));
982			}
983			goto fcall_end;
984		}
985
986		ret = 0 ? EX_VAR(opline->result.var) : &retval;
987		ZVAL_NULL(ret);
988
989		if (!zend_execute_internal) {
990			/* saves one function call if zend_execute_internal is not used */
991			fbc->internal_function.handler(call, ret);
992		} else {
993			zend_execute_internal(call, ret);
994		}
995
996#if ZEND_DEBUG
997		if (!EG(exception) && call->func) {
998			ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
999				zend_verify_internal_return_type(call->func, ret));
1000			ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
1001				? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
1002		}
1003#endif
1004
1005		EG(current_execute_data) = call->prev_execute_data;
1006		zend_vm_stack_free_args(call);
1007
1008		if (!0) {
1009			zval_ptr_dtor(ret);
1010		}
1011
1012	} else { /* ZEND_OVERLOADED_FUNCTION */
1013		zval retval;
1014
1015		ret = 0 ? EX_VAR(opline->result.var) : &retval;
1016
1017		call->prev_execute_data = execute_data;
1018
1019		if (UNEXPECTED(!zend_do_fcall_overloaded(fbc, call, ret))) {
1020			HANDLE_EXCEPTION();
1021		}
1022
1023		if (!0) {
1024			zval_ptr_dtor(ret);
1025		}
1026	}
1027
1028fcall_end:
1029	if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
1030		object = Z_OBJ(call->This);
1031#if 0
1032		if (UNEXPECTED(EG(exception) != NULL) && (opline->op1.num & ZEND_CALL_CTOR)) {
1033#else
1034		if (UNEXPECTED(EG(exception) != NULL) && (ZEND_CALL_INFO(call) & ZEND_CALL_CTOR)) {
1035#endif
1036			GC_REFCOUNT(object)--;
1037			if (GC_REFCOUNT(object) == 1) {
1038				zend_object_store_ctor_failed(object);
1039			}
1040		}
1041		OBJ_RELEASE(object);
1042	}
1043
1044	zend_vm_stack_free_call_frame(call);
1045	if (UNEXPECTED(EG(exception) != NULL)) {
1046		zend_throw_exception_internal(NULL);
1047		if (0) {
1048			zval_ptr_dtor(EX_VAR(opline->result.var));
1049		}
1050		HANDLE_EXCEPTION();
1051	}
1052
1053	ZEND_VM_SET_OPCODE(opline + 1);
1054	ZEND_VM_CONTINUE();
1055}
1056
1057static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1058{
1059	USE_OPLINE
1060	zend_execute_data *call = EX(call);
1061	zend_function *fbc = call->func;
1062	zend_object *object;
1063	zval *ret;
1064
1065	SAVE_OPLINE();
1066	EX(call) = call->prev_execute_data;
1067	if (UNEXPECTED((fbc->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) != 0)) {
1068		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_ABSTRACT) != 0)) {
1069			zend_throw_error(NULL, "Cannot call abstract method %s::%s()", ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
1070			HANDLE_EXCEPTION();
1071		}
1072		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_DEPRECATED) != 0)) {
1073			zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",
1074				fbc->common.scope ? ZSTR_VAL(fbc->common.scope->name) : "",
1075				fbc->common.scope ? "::" : "",
1076				ZSTR_VAL(fbc->common.function_name));
1077			if (UNEXPECTED(EG(exception) != NULL)) {
1078				HANDLE_EXCEPTION();
1079			}
1080		}
1081	}
1082
1083	LOAD_OPLINE();
1084
1085	if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
1086		if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1087			if (EXPECTED(1)) {
1088				ret = EX_VAR(opline->result.var);
1089				zend_generator_create_zval(call, &fbc->op_array, ret);
1090			} else {
1091				if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_CLOSURE)) {
1092					OBJ_RELEASE((zend_object*)fbc->op_array.prototype);
1093				}
1094				zend_vm_stack_free_args(call);
1095			}
1096		} else {
1097			ret = NULL;
1098			if (1) {
1099				ret = EX_VAR(opline->result.var);
1100				ZVAL_NULL(ret);
1101			}
1102
1103			call->prev_execute_data = execute_data;
1104			i_init_func_execute_data(call, &fbc->op_array, ret, 1);
1105
1106			if (EXPECTED(zend_execute_ex == execute_ex)) {
1107				ZEND_VM_ENTER();
1108			} else {
1109				ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
1110				zend_execute_ex(call);
1111			}
1112		}
1113	} else if (EXPECTED(fbc->type < ZEND_USER_FUNCTION)) {
1114		zval retval;
1115
1116		call->prev_execute_data = execute_data;
1117		EG(current_execute_data) = call;
1118
1119		if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
1120		  && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
1121			if (1) {
1122				ZVAL_UNDEF(EX_VAR(opline->result.var));
1123			}
1124			goto fcall_end;
1125		}
1126
1127		ret = 1 ? EX_VAR(opline->result.var) : &retval;
1128		ZVAL_NULL(ret);
1129
1130		if (!zend_execute_internal) {
1131			/* saves one function call if zend_execute_internal is not used */
1132			fbc->internal_function.handler(call, ret);
1133		} else {
1134			zend_execute_internal(call, ret);
1135		}
1136
1137#if ZEND_DEBUG
1138		if (!EG(exception) && call->func) {
1139			ZEND_ASSERT(!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
1140				zend_verify_internal_return_type(call->func, ret));
1141			ZEND_ASSERT((call->func->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)
1142				? Z_ISREF_P(ret) : !Z_ISREF_P(ret));
1143		}
1144#endif
1145
1146		EG(current_execute_data) = call->prev_execute_data;
1147		zend_vm_stack_free_args(call);
1148
1149		if (!1) {
1150			zval_ptr_dtor(ret);
1151		}
1152
1153	} else { /* ZEND_OVERLOADED_FUNCTION */
1154		zval retval;
1155
1156		ret = 1 ? EX_VAR(opline->result.var) : &retval;
1157
1158		call->prev_execute_data = execute_data;
1159
1160		if (UNEXPECTED(!zend_do_fcall_overloaded(fbc, call, ret))) {
1161			HANDLE_EXCEPTION();
1162		}
1163
1164		if (!1) {
1165			zval_ptr_dtor(ret);
1166		}
1167	}
1168
1169fcall_end:
1170	if (UNEXPECTED(ZEND_CALL_INFO(call) & ZEND_CALL_RELEASE_THIS)) {
1171		object = Z_OBJ(call->This);
1172#if 0
1173		if (UNEXPECTED(EG(exception) != NULL) && (opline->op1.num & ZEND_CALL_CTOR)) {
1174#else
1175		if (UNEXPECTED(EG(exception) != NULL) && (ZEND_CALL_INFO(call) & ZEND_CALL_CTOR)) {
1176#endif
1177			GC_REFCOUNT(object)--;
1178			if (GC_REFCOUNT(object) == 1) {
1179				zend_object_store_ctor_failed(object);
1180			}
1181		}
1182		OBJ_RELEASE(object);
1183	}
1184
1185	zend_vm_stack_free_call_frame(call);
1186	if (UNEXPECTED(EG(exception) != NULL)) {
1187		zend_throw_exception_internal(NULL);
1188		if (1) {
1189			zval_ptr_dtor(EX_VAR(opline->result.var));
1190		}
1191		HANDLE_EXCEPTION();
1192	}
1193
1194	ZEND_VM_SET_OPCODE(opline + 1);
1195	ZEND_VM_CONTINUE();
1196}
1197
1198static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_UNPACK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1199{
1200	USE_OPLINE
1201	zend_free_op free_op1;
1202	zval *args;
1203	int arg_num;
1204
1205	SAVE_OPLINE();
1206	args = get_zval_ptr_undef(opline->op1_type, opline->op1, execute_data, &free_op1, BP_VAR_R);
1207	arg_num = ZEND_CALL_NUM_ARGS(EX(call)) + 1;
1208
1209send_again:
1210	if (EXPECTED(Z_TYPE_P(args) == IS_ARRAY)) {
1211		HashTable *ht = Z_ARRVAL_P(args);
1212		zval *arg, *top;
1213		zend_string *name;
1214
1215		zend_vm_stack_extend_call_frame(&EX(call), arg_num - 1, zend_hash_num_elements(ht));
1216
1217		if ((opline->op1_type & (IS_VAR|IS_CV)) && Z_REFCOUNT_P(args) > 1) {
1218			uint32_t i;
1219			int separate = 0;
1220
1221			/* check if any of arguments are going to be passed by reference */
1222			for (i = 0; i < zend_hash_num_elements(ht); i++) {
1223				if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num + i)) {
1224					separate = 1;
1225					break;
1226				}
1227			}
1228			if (separate) {
1229				SEPARATE_ARRAY(args);
1230				ht = Z_ARRVAL_P(args);
1231			}
1232		}
1233
1234		ZEND_HASH_FOREACH_STR_KEY_VAL(ht, name, arg) {
1235			if (name) {
1236				zend_throw_error(NULL, "Cannot unpack array with string keys");
1237				FREE_OP(free_op1);
1238				HANDLE_EXCEPTION();
1239			}
1240
1241			top = ZEND_CALL_ARG(EX(call), arg_num);
1242			if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
1243				if (Z_REFCOUNT_P(args) == 1) {
1244					ZVAL_MAKE_REF(arg);
1245					Z_ADDREF_P(arg);
1246					ZVAL_REF(top, Z_REF_P(arg));
1247				} else {
1248					ZVAL_DUP(top, arg);
1249				}
1250			} else if (Z_ISREF_P(arg)) {
1251				ZVAL_COPY(top, Z_REFVAL_P(arg));
1252			} else {
1253				ZVAL_COPY(top, arg);
1254			}
1255
1256			ZEND_CALL_NUM_ARGS(EX(call))++;
1257			arg_num++;
1258		} ZEND_HASH_FOREACH_END();
1259
1260	} else if (EXPECTED(Z_TYPE_P(args) == IS_OBJECT)) {
1261		zend_class_entry *ce = Z_OBJCE_P(args);
1262		zend_object_iterator *iter;
1263
1264		if (!ce || !ce->get_iterator) {
1265			zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
1266		} else {
1267
1268			iter = ce->get_iterator(ce, args, 0);
1269			if (UNEXPECTED(!iter)) {
1270				FREE_OP(free_op1);
1271				if (!EG(exception)) {
1272					zend_throw_exception_ex(
1273						NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name)
1274					);
1275				}
1276				HANDLE_EXCEPTION();
1277			}
1278
1279			if (iter->funcs->rewind) {
1280				iter->funcs->rewind(iter);
1281				if (UNEXPECTED(EG(exception) != NULL)) {
1282					goto unpack_iter_dtor;
1283				}
1284			}
1285
1286			for (; iter->funcs->valid(iter) == SUCCESS; ++arg_num) {
1287				zval *arg, *top;
1288
1289				if (UNEXPECTED(EG(exception) != NULL)) {
1290					goto unpack_iter_dtor;
1291				}
1292
1293				arg = iter->funcs->get_current_data(iter);
1294				if (UNEXPECTED(EG(exception) != NULL)) {
1295					goto unpack_iter_dtor;
1296				}
1297
1298				if (iter->funcs->get_current_key) {
1299					zval key;
1300					iter->funcs->get_current_key(iter, &key);
1301					if (UNEXPECTED(EG(exception) != NULL)) {
1302						goto unpack_iter_dtor;
1303					}
1304
1305					if (Z_TYPE(key) == IS_STRING) {
1306						zend_throw_error(NULL,
1307							"Cannot unpack Traversable with string keys");
1308						zend_string_release(Z_STR(key));
1309						goto unpack_iter_dtor;
1310					}
1311
1312					zval_dtor(&key);
1313				}
1314
1315				if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
1316					zend_error(
1317						E_WARNING, "Cannot pass by-reference argument %d of %s%s%s()"
1318						" by unpacking a Traversable, passing by-value instead", arg_num,
1319						EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
1320						EX(call)->func->common.scope ? "::" : "",
1321						ZSTR_VAL(EX(call)->func->common.function_name)
1322					);
1323				}
1324
1325				if (Z_ISREF_P(arg)) {
1326					ZVAL_DUP(arg, Z_REFVAL_P(arg));
1327				} else {
1328					if (Z_REFCOUNTED_P(arg)) Z_ADDREF_P(arg);
1329				}
1330
1331				zend_vm_stack_extend_call_frame(&EX(call), arg_num - 1, 1);
1332				top = ZEND_CALL_ARG(EX(call), arg_num);
1333				ZVAL_COPY_VALUE(top, arg);
1334				ZEND_CALL_NUM_ARGS(EX(call))++;
1335
1336				iter->funcs->move_forward(iter);
1337				if (UNEXPECTED(EG(exception) != NULL)) {
1338					goto unpack_iter_dtor;
1339				}
1340			}
1341
1342unpack_iter_dtor:
1343			zend_iterator_dtor(iter);
1344		}
1345	} else if (EXPECTED(Z_ISREF_P(args))) {
1346		args = Z_REFVAL_P(args);
1347		goto send_again;
1348	} else {
1349		if (opline->op1_type == IS_CV && UNEXPECTED(Z_TYPE_P(args) == IS_UNDEF)) {
1350			GET_OP1_UNDEF_CV(args, BP_VAR_R);
1351		}
1352		zend_error(E_WARNING, "Only arrays and Traversables can be unpacked");
1353	}
1354
1355	FREE_OP(free_op1);
1356	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1357}
1358
1359static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_ARRAY_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1360{
1361	USE_OPLINE
1362	zend_free_op free_op1;
1363	zval *args;
1364	SAVE_OPLINE();
1365
1366	SAVE_OPLINE();
1367	args = get_zval_ptr(opline->op1_type, opline->op1, execute_data, &free_op1, BP_VAR_R);
1368
1369	if (UNEXPECTED(Z_TYPE_P(args) != IS_ARRAY)) {
1370		if ((opline->op1_type & (IS_VAR|IS_CV)) && Z_ISREF_P(args)) {
1371			args = Z_REFVAL_P(args);
1372			if (EXPECTED(Z_TYPE_P(args) == IS_ARRAY)) {
1373				goto send_array;
1374			}
1375		}
1376		zend_internal_type_error(EX_USES_STRICT_TYPES(), "call_user_func_array() expects parameter 2 to be array, %s given", zend_get_type_by_const(Z_TYPE_P(args)));
1377		if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
1378			OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
1379		}
1380		if (Z_TYPE(EX(call)->This) == IS_OBJECT) {
1381			OBJ_RELEASE(Z_OBJ(EX(call)->This));
1382		}
1383		EX(call)->func = (zend_function*)&zend_pass_function;
1384		Z_OBJ(EX(call)->This) = NULL;
1385		ZEND_SET_CALL_INFO(EX(call), 0, ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
1386	} else {
1387		uint32_t arg_num;
1388		HashTable *ht;
1389		zval *arg, *param;
1390
1391send_array:
1392		ht = Z_ARRVAL_P(args);
1393		zend_vm_stack_extend_call_frame(&EX(call), 0, zend_hash_num_elements(ht));
1394
1395		arg_num = 1;
1396		param = ZEND_CALL_ARG(EX(call), 1);
1397		ZEND_HASH_FOREACH_VAL(ht, arg) {
1398			if (ARG_SHOULD_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
1399				if (UNEXPECTED(!Z_ISREF_P(arg))) {
1400					if (!ARG_MAY_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
1401
1402						zend_error(E_WARNING, "Parameter %d to %s%s%s() expected to be a reference, value given",
1403							arg_num,
1404							EX(call)->func->common.scope ? ZSTR_VAL(EX(call)->func->common.scope->name) : "",
1405							EX(call)->func->common.scope ? "::" : "",
1406							ZSTR_VAL(EX(call)->func->common.function_name));
1407
1408						if (ZEND_CALL_INFO(EX(call)) & ZEND_CALL_CLOSURE) {
1409							OBJ_RELEASE((zend_object*)EX(call)->func->common.prototype);
1410						}
1411						if (Z_TYPE(EX(call)->This) == IS_OBJECT) {
1412							OBJ_RELEASE(Z_OBJ(EX(call)->This));
1413						}
1414						EX(call)->func = (zend_function*)&zend_pass_function;
1415						Z_OBJ(EX(call)->This) = NULL;
1416						ZEND_SET_CALL_INFO(EX(call), 0, ZEND_CALL_INFO(EX(call)) & ~ZEND_CALL_RELEASE_THIS);
1417						break;
1418					}
1419				}
1420			} else {
1421				if (Z_ISREF_P(arg) &&
1422				    !(EX(call)->func->common.fn_flags & ZEND_ACC_CALL_VIA_TRAMPOLINE)) {
1423					/* don't separate references for __call */
1424					arg = Z_REFVAL_P(arg);
1425				}
1426			}
1427			ZVAL_COPY(param, arg);
1428			ZEND_CALL_NUM_ARGS(EX(call))++;
1429			arg_num++;
1430			param++;
1431		} ZEND_HASH_FOREACH_END();
1432	}
1433	FREE_OP(free_op1);
1434	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1435}
1436
1437static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1438{
1439	USE_OPLINE
1440	uint32_t arg_num = opline->op1.num;
1441
1442	if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
1443		SAVE_OPLINE();
1444		zend_verify_missing_arg(execute_data, arg_num, CACHE_ADDR(opline->op2.num));
1445		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1446	} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
1447		zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
1448
1449		SAVE_OPLINE();
1450		if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num)) || EG(exception))) {
1451			HANDLE_EXCEPTION();
1452		}
1453	}
1454
1455	ZEND_VM_NEXT_OPCODE();
1456}
1457
1458static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_VARIADIC_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1459{
1460	USE_OPLINE
1461	uint32_t arg_num = opline->op1.num;
1462	uint32_t arg_count = EX_NUM_ARGS();
1463	zval *params;
1464
1465	SAVE_OPLINE();
1466
1467	params = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
1468
1469	if (arg_num <= arg_count) {
1470		zval *param;
1471
1472		array_init_size(params, arg_count - arg_num + 1);
1473		zend_hash_real_init(Z_ARRVAL_P(params), 1);
1474		ZEND_HASH_FILL_PACKED(Z_ARRVAL_P(params)) {
1475			param = EX_VAR_NUM(EX(func)->op_array.last_var + EX(func)->op_array.T);
1476			if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
1477				do {
1478					zend_verify_arg_type(EX(func), arg_num, param, NULL, CACHE_ADDR(opline->op2.num));
1479					if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
1480					ZEND_HASH_FILL_ADD(param);
1481					param++;
1482				} while (++arg_num <= arg_count);
1483			} else {
1484				do {
1485					if (Z_OPT_REFCOUNTED_P(param)) Z_ADDREF_P(param);
1486					ZEND_HASH_FILL_ADD(param);
1487					param++;
1488				} while (++arg_num <= arg_count);
1489			}
1490		} ZEND_HASH_FILL_END();
1491	} else {
1492		array_init(params);
1493	}
1494
1495	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1496}
1497
1498static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BEGIN_SILENCE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1499{
1500	USE_OPLINE
1501
1502	ZVAL_LONG(EX_VAR(opline->result.var), EG(error_reporting));
1503
1504	if (EG(error_reporting)) {
1505		do {
1506			EG(error_reporting) = 0;
1507			if (!EG(error_reporting_ini_entry)) {
1508				zend_ini_entry *p = zend_hash_str_find_ptr(EG(ini_directives), "error_reporting", sizeof("error_reporting")-1);
1509				if (p) {
1510					EG(error_reporting_ini_entry) = p;
1511				} else {
1512					break;
1513				}
1514			}
1515			if (!EG(error_reporting_ini_entry)->modified) {
1516				if (!EG(modified_ini_directives)) {
1517					ALLOC_HASHTABLE(EG(modified_ini_directives));
1518					zend_hash_init(EG(modified_ini_directives), 8, NULL, NULL, 0);
1519				}
1520				if (EXPECTED(zend_hash_str_add_ptr(EG(modified_ini_directives), "error_reporting", sizeof("error_reporting")-1, EG(error_reporting_ini_entry)) != NULL)) {
1521					EG(error_reporting_ini_entry)->orig_value = EG(error_reporting_ini_entry)->value;
1522					EG(error_reporting_ini_entry)->orig_modifiable = EG(error_reporting_ini_entry)->modifiable;
1523					EG(error_reporting_ini_entry)->modified = 1;
1524				}
1525			}
1526		} while (0);
1527	}
1528	ZEND_VM_NEXT_OPCODE();
1529}
1530
1531static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_STMT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1532{
1533	USE_OPLINE
1534
1535	if (!EG(no_extensions)) {
1536		SAVE_OPLINE();
1537		zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_statement_handler, EX(func));
1538		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1539	}
1540	ZEND_VM_NEXT_OPCODE();
1541}
1542
1543static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_FCALL_BEGIN_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1544{
1545	USE_OPLINE
1546
1547	if (!EG(no_extensions)) {
1548		SAVE_OPLINE();
1549		zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_begin_handler, EX(func));
1550		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1551	}
1552	ZEND_VM_NEXT_OPCODE();
1553}
1554
1555static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_FCALL_END_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1556{
1557	USE_OPLINE
1558
1559	if (!EG(no_extensions)) {
1560		SAVE_OPLINE();
1561		zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_fcall_end_handler, EX(func));
1562		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1563	}
1564	ZEND_VM_NEXT_OPCODE();
1565}
1566
1567static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1568{
1569	USE_OPLINE
1570
1571	SAVE_OPLINE();
1572	Z_CE_P(EX_VAR(opline->result.var)) = do_bind_class(&EX(func)->op_array, opline, EG(class_table), 0);
1573	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1574}
1575
1576static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1577{
1578	zend_class_entry *ce;
1579	USE_OPLINE
1580
1581	SAVE_OPLINE();
1582	ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(EX_CONSTANT(opline->op1)));
1583	Z_CE_P(EX_VAR(opline->result.var)) = ce;
1584	ZEND_ASSERT(ce != NULL);
1585
1586	if (ce->ce_flags & ZEND_ACC_ANON_BOUND) {
1587		ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
1588		ZEND_VM_CONTINUE();
1589	}
1590
1591	if (!(ce->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLEMENT_INTERFACES|ZEND_ACC_IMPLEMENT_TRAITS))) {
1592		zend_verify_abstract_class(ce);
1593	}
1594	ce->ce_flags |= ZEND_ACC_ANON_BOUND;
1595	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1596}
1597
1598static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_FUNCTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1599{
1600	USE_OPLINE
1601
1602	SAVE_OPLINE();
1603	do_bind_function(&EX(func)->op_array, opline, EG(function_table), 0);
1604	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1605}
1606
1607static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TICKS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1608{
1609	USE_OPLINE
1610
1611	if ((uint32_t)++EG(ticks_count) >= opline->extended_value) {
1612		EG(ticks_count) = 0;
1613		if (zend_ticks_function) {
1614			SAVE_OPLINE();
1615			zend_ticks_function(opline->extended_value);
1616			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1617		}
1618	}
1619	ZEND_VM_NEXT_OPCODE();
1620}
1621
1622static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXT_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1623{
1624	USE_OPLINE
1625
1626	ZEND_VM_NEXT_OPCODE();
1627}
1628
1629static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NOP_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1630{
1631	USE_OPLINE
1632
1633	ZEND_VM_NEXT_OPCODE();
1634}
1635
1636static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_TRAIT_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1637{
1638	USE_OPLINE
1639	zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
1640	zend_class_entry *trait;
1641
1642	SAVE_OPLINE();
1643	trait = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
1644	if (UNEXPECTED(trait == NULL)) {
1645		trait = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)),
1646		                                 EX_CONSTANT(opline->op2) + 1,
1647		                                 ZEND_FETCH_CLASS_TRAIT);
1648		if (UNEXPECTED(trait == NULL)) {
1649			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1650		}
1651		if (!(trait->ce_flags & ZEND_ACC_TRAIT)) {
1652			zend_error_noreturn(E_ERROR, "%s cannot use %s - it is not a trait", ZSTR_VAL(ce->name), ZSTR_VAL(trait->name));
1653		}
1654		CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), trait);
1655	}
1656
1657	zend_do_implement_trait(ce, trait);
1658
1659	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1660}
1661
1662static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BIND_TRAITS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1663{
1664	USE_OPLINE
1665	zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
1666
1667	SAVE_OPLINE();
1668	zend_do_bind_traits(ce);
1669	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1670}
1671
1672static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_HANDLE_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1673{
1674	uint32_t op_num = EG(opline_before_exception) - EX(func)->op_array.opcodes;
1675	int i;
1676	uint32_t catch_op_num = 0, finally_op_num = 0, finally_op_end = 0;
1677	int in_finally = 0;
1678
1679	{
1680		const zend_op *exc_opline = EG(opline_before_exception);
1681		if ((exc_opline->opcode == ZEND_FREE || exc_opline->opcode == ZEND_FE_FREE)
1682			&& exc_opline->extended_value & ZEND_FREE_ON_RETURN) {
1683			/* exceptions thrown because of loop var destruction on return/break/...
1684			 * are logically thrown at the end of the foreach loop, so adjust the
1685			 * op_num.
1686			 */
1687			op_num = EX(func)->op_array.live_range[exc_opline->op2.num].end;
1688		}
1689	}
1690
1691	for (i = 0; i < EX(func)->op_array.last_try_catch; i++) {
1692		if (EX(func)->op_array.try_catch_array[i].try_op > op_num) {
1693			/* further blocks will not be relevant... */
1694			break;
1695		}
1696		in_finally = 0;
1697		if (op_num < EX(func)->op_array.try_catch_array[i].catch_op) {
1698			catch_op_num = EX(func)->op_array.try_catch_array[i].catch_op;
1699		}
1700		if (op_num < EX(func)->op_array.try_catch_array[i].finally_op) {
1701			finally_op_num = EX(func)->op_array.try_catch_array[i].finally_op;
1702			finally_op_end = EX(func)->op_array.try_catch_array[i].finally_end;
1703		}
1704		if (op_num >= EX(func)->op_array.try_catch_array[i].finally_op &&
1705				op_num < EX(func)->op_array.try_catch_array[i].finally_end) {
1706			finally_op_end = EX(func)->op_array.try_catch_array[i].finally_end;
1707			in_finally = 1;
1708		}
1709	}
1710
1711	cleanup_unfinished_calls(execute_data, op_num);
1712
1713	if (finally_op_num && (!catch_op_num || catch_op_num >= finally_op_num)) {
1714		zval *fast_call = EX_VAR(EX(func)->op_array.opcodes[finally_op_end].op1.var);
1715
1716		cleanup_live_vars(execute_data, op_num, finally_op_num);
1717		if (in_finally && Z_OBJ_P(fast_call)) {
1718			zend_exception_set_previous(EG(exception), Z_OBJ_P(fast_call));
1719		}
1720		Z_OBJ_P(fast_call) = EG(exception);
1721		EG(exception) = NULL;
1722		fast_call->u2.lineno = (uint32_t)-1;
1723		ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[finally_op_num]);
1724		ZEND_VM_CONTINUE();
1725	} else {
1726		cleanup_live_vars(execute_data, op_num, catch_op_num);
1727		if (in_finally) {
1728			/* we are going out of current finally scope */
1729			zval *fast_call = EX_VAR(EX(func)->op_array.opcodes[finally_op_end].op1.var);
1730
1731			if (Z_OBJ_P(fast_call)) {
1732				zend_exception_set_previous(EG(exception), Z_OBJ_P(fast_call));
1733				Z_OBJ_P(fast_call) = NULL;
1734			}
1735		}
1736		if (catch_op_num) {
1737			ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[catch_op_num]);
1738			ZEND_VM_CONTINUE();
1739		} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1740			zend_generator *generator = zend_get_running_generator(execute_data);
1741			zend_generator_close(generator, 1);
1742			ZEND_VM_RETURN();
1743		} else {
1744			ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
1745		}
1746	}
1747}
1748
1749static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_VERIFY_ABSTRACT_CLASS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1750{
1751	USE_OPLINE
1752
1753	SAVE_OPLINE();
1754	zend_verify_abstract_class(Z_CE_P(EX_VAR(opline->op1.var)));
1755	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
1756}
1757
1758static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_USER_OPCODE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1759{
1760	USE_OPLINE
1761	int ret;
1762
1763	SAVE_OPLINE();
1764	ret = zend_user_opcode_handlers[opline->opcode](execute_data);
1765	opline = EX(opline);
1766
1767	switch (ret) {
1768		case ZEND_USER_OPCODE_CONTINUE:
1769			ZEND_VM_CONTINUE();
1770		case ZEND_USER_OPCODE_RETURN:
1771			if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1772				zend_generator *generator = zend_get_running_generator(execute_data);
1773				zend_generator_close(generator, 1);
1774				ZEND_VM_RETURN();
1775			} else {
1776				ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
1777			}
1778		case ZEND_USER_OPCODE_ENTER:
1779			ZEND_VM_ENTER();
1780		case ZEND_USER_OPCODE_LEAVE:
1781			ZEND_VM_LEAVE();
1782		case ZEND_USER_OPCODE_DISPATCH:
1783			ZEND_VM_DISPATCH(opline->opcode, opline);
1784		default:
1785			ZEND_VM_DISPATCH((zend_uchar)(ret & 0xff), opline);
1786	}
1787}
1788
1789static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DISCARD_EXCEPTION_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1790{
1791	USE_OPLINE
1792	zval *fast_call = EX_VAR(opline->op1.var);
1793
1794	/* check for delayed exception */
1795	if (Z_OBJ_P(fast_call) != NULL) {
1796		SAVE_OPLINE();
1797		/* discard the previously thrown exception */
1798		OBJ_RELEASE(Z_OBJ_P(fast_call));
1799		Z_OBJ_P(fast_call) = NULL;
1800	}
1801
1802	ZEND_VM_NEXT_OPCODE();
1803}
1804
1805static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1806{
1807	USE_OPLINE
1808	zval *fast_call = EX_VAR(opline->result.var);
1809
1810	if (opline->extended_value == ZEND_FAST_CALL_FROM_FINALLY && UNEXPECTED(Z_OBJ_P(fast_call) != NULL)) {
1811		fast_call->u2.lineno = (uint32_t)-1;
1812	} else {
1813		Z_OBJ_P(fast_call) = NULL;
1814		/* set return address */
1815		fast_call->u2.lineno = opline - EX(func)->op_array.opcodes;
1816	}
1817	ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op1));
1818	ZEND_VM_CONTINUE();
1819}
1820
1821static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_RET_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1822{
1823	USE_OPLINE
1824	zval *fast_call = EX_VAR(opline->op1.var);
1825
1826	if (fast_call->u2.lineno != (uint32_t)-1) {
1827		const zend_op *fast_ret = EX(func)->op_array.opcodes + fast_call->u2.lineno;
1828		if (fast_ret->extended_value & ZEND_FAST_CALL_FROM_FINALLY) {
1829			fast_call->u2.lineno = EX(func)->op_array.try_catch_array[fast_ret->op2.num].finally_op - 2;
1830		}
1831		ZEND_VM_SET_OPCODE(fast_ret + 1);
1832		ZEND_VM_CONTINUE();
1833	} else {
1834		/* special case for unhandled exceptions */
1835		USE_OPLINE
1836
1837		if (opline->extended_value == ZEND_FAST_RET_TO_FINALLY) {
1838			uint32_t finally_op = EX(func)->op_array.try_catch_array[opline->op2.num].finally_op;
1839
1840			cleanup_live_vars(execute_data, opline - EX(func)->op_array.opcodes, finally_op);
1841			ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[finally_op]);
1842			ZEND_VM_CONTINUE();
1843		} else {
1844			EG(exception) = Z_OBJ_P(fast_call);
1845			Z_OBJ_P(fast_call) = NULL;
1846			if (opline->extended_value == ZEND_FAST_RET_TO_CATCH) {
1847				uint32_t catch_op = EX(func)->op_array.try_catch_array[opline->op2.num].catch_op;
1848
1849				cleanup_live_vars(execute_data, opline - EX(func)->op_array.opcodes, catch_op);
1850				ZEND_VM_SET_OPCODE(&EX(func)->op_array.opcodes[catch_op]);
1851				ZEND_VM_CONTINUE();
1852			} else {
1853				cleanup_live_vars(execute_data, opline - EX(func)->op_array.opcodes, 0);
1854				if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0)) {
1855					zend_generator *generator = zend_get_running_generator(execute_data);
1856					zend_generator_close(generator, 1);
1857					ZEND_VM_RETURN();
1858				} else {
1859					ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
1860				}
1861			}
1862		}
1863	}
1864}
1865
1866static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSERT_CHECK_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1867{
1868	USE_OPLINE
1869
1870	if (EG(assertions) <= 0) {
1871		zend_op *target = OP_JMP_ADDR(opline, opline->op2);
1872		if (RETURN_VALUE_USED(opline)) {
1873			ZVAL_TRUE(EX_VAR(opline->result.var));
1874		}
1875		ZEND_VM_JMP(target);
1876	} else {
1877		ZEND_VM_NEXT_OPCODE();
1878	}
1879}
1880
1881static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_NAME_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1882{
1883	uint32_t fetch_type;
1884	zend_class_entry *called_scope, *scope;
1885	USE_OPLINE
1886
1887	SAVE_OPLINE();
1888	fetch_type = opline->extended_value;
1889
1890	scope = EX(func)->op_array.scope;
1891	if (UNEXPECTED(scope == NULL)) {
1892		zend_throw_error(NULL, "Cannot use \"%s\" when no class scope is active",
1893			fetch_type == ZEND_FETCH_CLASS_SELF ? "self" :
1894			fetch_type == ZEND_FETCH_CLASS_PARENT ? "parent" : "static");
1895		HANDLE_EXCEPTION();
1896	}
1897
1898	switch (fetch_type) {
1899		case ZEND_FETCH_CLASS_SELF:
1900			ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->name);
1901			break;
1902		case ZEND_FETCH_CLASS_PARENT:
1903			if (UNEXPECTED(scope->parent == NULL)) {
1904				zend_throw_error(NULL,
1905					"Cannot use \"parent\" when current class scope has no parent");
1906				HANDLE_EXCEPTION();
1907			}
1908			ZVAL_STR_COPY(EX_VAR(opline->result.var), scope->parent->name);
1909			break;
1910		case ZEND_FETCH_CLASS_STATIC:
1911			if (Z_TYPE(EX(This)) == IS_OBJECT) {
1912				called_scope = Z_OBJCE(EX(This));
1913			} else {
1914				called_scope = Z_CE(EX(This));
1915			}
1916			ZVAL_STR_COPY(EX_VAR(opline->result.var), called_scope->name);
1917			break;
1918		EMPTY_SWITCH_DEFAULT_CASE()
1919	}
1920	ZEND_VM_NEXT_OPCODE();
1921}
1922
1923static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
1924{
1925	zend_array *args;
1926	zend_function *fbc = EX(func);
1927	zval *ret = EX(return_value);
1928	uint32_t call_info = EX_CALL_INFO() & (ZEND_CALL_NESTED | ZEND_CALL_TOP | ZEND_CALL_RELEASE_THIS);
1929	uint32_t num_args = EX_NUM_ARGS();
1930	zend_execute_data *call;
1931	USE_OPLINE
1932
1933	args = emalloc(sizeof(zend_array));
1934	zend_hash_init(args, num_args, NULL, ZVAL_PTR_DTOR, 0);
1935	if (num_args) {
1936		zval *p = ZEND_CALL_ARG(execute_data, 1);
1937		zval *end = p + num_args;
1938
1939		zend_hash_real_init(args, 1);
1940		ZEND_HASH_FILL_PACKED(args) {
1941			do {
1942				ZEND_HASH_FILL_ADD(p);
1943				p++;
1944			} while (p != end);
1945		} ZEND_HASH_FILL_END();
1946	}
1947
1948	SAVE_OPLINE();
1949	call = execute_data;
1950	execute_data = EG(current_execute_data) = EX(prev_execute_data);
1951
1952	ZEND_ASSERT(zend_vm_calc_used_stack(2, fbc->common.prototype) <= (size_t)(((char*)EG(vm_stack_end)) - (char*)call));
1953
1954	call->func = fbc->common.prototype;
1955	ZEND_CALL_NUM_ARGS(call) = 2;
1956
1957	ZVAL_STR(ZEND_CALL_ARG(call, 1), fbc->common.function_name);
1958	ZVAL_ARR(ZEND_CALL_ARG(call, 2), args);
1959	zend_free_trampoline(fbc);
1960	fbc = call->func;
1961
1962	if (EXPECTED(fbc->type == ZEND_USER_FUNCTION)) {
1963
1964		ZEND_ASSERT(!(fbc->common.fn_flags & ZEND_ACC_GENERATOR));
1965
1966		if (UNEXPECTED(!fbc->op_array.run_time_cache)) {
1967			init_func_run_time_cache(&fbc->op_array);
1968		}
1969		i_init_func_execute_data(call, &fbc->op_array,
1970				ret, (fbc->common.fn_flags & ZEND_ACC_STATIC) == 0);
1971		if (EXPECTED(zend_execute_ex == execute_ex)) {
1972			ZEND_VM_ENTER();
1973		} else {
1974			ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
1975			zend_execute_ex(call);
1976		}
1977	} else {
1978		zval retval;
1979
1980		ZEND_ASSERT(fbc->type == ZEND_INTERNAL_FUNCTION);
1981
1982		EG(current_execute_data) = call;
1983
1984		if (UNEXPECTED(fbc->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)
1985		 && UNEXPECTED(!zend_verify_internal_arg_types(fbc, call))) {
1986			zend_vm_stack_free_call_frame(call);
1987			if (ret) {
1988				ZVAL_UNDEF(ret);
1989			}
1990			goto call_trampoline_end;
1991		}
1992
1993		if (ret == NULL) {
1994			ZVAL_NULL(&retval);
1995			ret = &retval;
1996		}
1997
1998		if (!zend_execute_internal) {
1999			/* saves one function call if zend_execute_internal is not used */
2000			fbc->internal_function.handler(call, ret);
2001		} else {
2002			zend_execute_internal(call, ret);
2003		}
2004
2005#if ZEND_DEBUG
2006		ZEND_ASSERT(
2007			EG(exception) || !call->func ||
2008			!(call->func->common.fn_flags & ZEND_ACC_HAS_RETURN_TYPE) ||
2009			zend_verify_internal_return_type(call->func, ret));
2010#endif
2011
2012		EG(current_execute_data) = call->prev_execute_data;
2013
2014		zend_vm_stack_free_args(call);
2015
2016		if (ret == &retval) {
2017			zval_ptr_dtor(ret);
2018		}
2019	}
2020
2021call_trampoline_end:
2022	execute_data = EG(current_execute_data);
2023
2024	if (!EX(func) || !ZEND_USER_CODE(EX(func)->type) || (call_info & ZEND_CALL_TOP)) {
2025		ZEND_VM_RETURN();
2026	}
2027
2028	opline = EX(opline);
2029
2030	if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) {
2031		zend_object *object = Z_OBJ(call->This);
2032		OBJ_RELEASE(object);
2033	}
2034	zend_vm_stack_free_call_frame(call);
2035
2036	if (UNEXPECTED(EG(exception) != NULL)) {
2037		zend_throw_exception_internal(NULL);
2038		if (RETURN_VALUE_USED(opline)) {
2039			zval_ptr_dtor(EX_VAR(opline->result.var));
2040		}
2041		HANDLE_EXCEPTION_LEAVE();
2042	}
2043
2044	ZEND_VM_INC_OPCODE();
2045	ZEND_VM_LEAVE();
2046}
2047
2048static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2049{
2050	USE_OPLINE
2051
2052	SAVE_OPLINE();
2053	if (IS_CONST == IS_UNUSED) {
2054		Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value);
2055		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2056	} else {
2057
2058		zval *class_name = EX_CONSTANT(opline->op2);
2059
2060try_class_name:
2061		if (IS_CONST == IS_CONST) {
2062			zend_class_entry *ce = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2063
2064			if (UNEXPECTED(ce == NULL)) {
2065				ce = zend_fetch_class_by_name(Z_STR_P(class_name), EX_CONSTANT(opline->op2) + 1, opline->extended_value);
2066				CACHE_PTR(Z_CACHE_SLOT_P(class_name), ce);
2067			}
2068			Z_CE_P(EX_VAR(opline->result.var)) = ce;
2069		} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2070			Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2071		} else if (Z_TYPE_P(class_name) == IS_STRING) {
2072			Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value);
2073		} else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(class_name) == IS_REFERENCE) {
2074			class_name = Z_REFVAL_P(class_name);
2075			goto try_class_name;
2076		} else {
2077			if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(class_name) == IS_UNDEF)) {
2078				GET_OP2_UNDEF_CV(class_name, BP_VAR_R);
2079				if (UNEXPECTED(EG(exception) != NULL)) {
2080					HANDLE_EXCEPTION();
2081				}
2082			}
2083			zend_throw_error(NULL, "Class name must be a valid object or a string");
2084		}
2085
2086		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2087	}
2088}
2089
2090static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2091{
2092	USE_OPLINE
2093	zend_function *fbc;
2094	zval *function_name, *func;
2095	zend_execute_data *call;
2096
2097	function_name = (zval*)EX_CONSTANT(opline->op2);
2098	fbc = CACHED_PTR(Z_CACHE_SLOT_P(function_name));
2099	if (UNEXPECTED(fbc == NULL)) {
2100		func = zend_hash_find(EG(function_table), Z_STR_P(function_name+1));
2101		if (UNEXPECTED(func == NULL)) {
2102			SAVE_OPLINE();
2103			zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(function_name));
2104			HANDLE_EXCEPTION();
2105		}
2106		fbc = Z_FUNC_P(func);
2107		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
2108			init_func_run_time_cache(&fbc->op_array);
2109		}
2110		CACHE_PTR(Z_CACHE_SLOT_P(function_name), fbc);
2111	}
2112	call = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
2113		fbc, opline->extended_value, NULL, NULL);
2114	call->prev_execute_data = EX(call);
2115	EX(call) = call;
2116
2117	ZEND_VM_NEXT_OPCODE();
2118}
2119
2120static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2121{
2122	USE_OPLINE
2123
2124	zval *function_name;
2125	zend_execute_data *call;
2126
2127	SAVE_OPLINE();
2128	function_name = EX_CONSTANT(opline->op2);
2129
2130try_function_name:
2131	if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
2132		call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
2133	} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
2134		call = zend_init_dynamic_call_object(function_name, opline->extended_value);
2135	} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
2136		call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
2137	} else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
2138		function_name = Z_REFVAL_P(function_name);
2139		goto try_function_name;
2140	} else {
2141		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
2142			GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
2143			if (UNEXPECTED(EG(exception) != NULL)) {
2144				HANDLE_EXCEPTION();
2145			}
2146		}
2147		zend_throw_error(NULL, "Function name must be a string");
2148		call = NULL;
2149	}
2150
2151	if (UNEXPECTED(!call)) {
2152		HANDLE_EXCEPTION();
2153	}
2154
2155	call->prev_execute_data = EX(call);
2156	EX(call) = call;
2157
2158	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2159}
2160
2161static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2162{
2163	USE_OPLINE
2164	zval *func_name;
2165	zval *func;
2166	zend_function *fbc;
2167	zend_execute_data *call;
2168
2169	func_name = EX_CONSTANT(opline->op2) + 1;
2170	fbc = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
2171	if (UNEXPECTED(fbc == NULL)) {
2172		func = zend_hash_find(EG(function_table), Z_STR_P(func_name));
2173		if (func == NULL) {
2174			func_name++;
2175			func = zend_hash_find(EG(function_table), Z_STR_P(func_name));
2176			if (UNEXPECTED(func == NULL)) {
2177				SAVE_OPLINE();
2178				zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
2179				HANDLE_EXCEPTION();
2180			}
2181		}
2182		fbc = Z_FUNC_P(func);
2183		CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), fbc);
2184		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
2185			init_func_run_time_cache(&fbc->op_array);
2186		}
2187	}
2188
2189	call = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
2190		fbc, opline->extended_value, NULL, NULL);
2191	call->prev_execute_data = EX(call);
2192	EX(call) = call;
2193
2194	ZEND_VM_NEXT_OPCODE();
2195}
2196
2197static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_FCALL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2198{
2199	USE_OPLINE
2200
2201	zval *fname = EX_CONSTANT(opline->op2);
2202	zval *func;
2203	zend_function *fbc;
2204	zend_execute_data *call;
2205
2206	fbc = CACHED_PTR(Z_CACHE_SLOT_P(fname));
2207	if (UNEXPECTED(fbc == NULL)) {
2208		func = zend_hash_find(EG(function_table), Z_STR_P(fname));
2209		if (UNEXPECTED(func == NULL)) {
2210		    SAVE_OPLINE();
2211			zend_throw_error(NULL, "Call to undefined function %s()", Z_STRVAL_P(fname));
2212			HANDLE_EXCEPTION();
2213		}
2214		fbc = Z_FUNC_P(func);
2215		CACHE_PTR(Z_CACHE_SLOT_P(fname), fbc);
2216		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
2217			init_func_run_time_cache(&fbc->op_array);
2218		}
2219	}
2220
2221	call = zend_vm_stack_push_call_frame_ex(
2222		opline->op1.num, ZEND_CALL_NESTED_FUNCTION,
2223		fbc, opline->extended_value, NULL, NULL);
2224	call->prev_execute_data = EX(call);
2225	EX(call) = call;
2226
2227	ZEND_VM_NEXT_OPCODE();
2228}
2229
2230static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_INIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2231{
2232	USE_OPLINE
2233	uint32_t arg_num;
2234	zval *param;
2235
2236	ZEND_VM_REPEATABLE_OPCODE
2237
2238	arg_num = opline->op1.num;
2239	param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
2240	if (arg_num > EX_NUM_ARGS()) {
2241		ZVAL_COPY(param, EX_CONSTANT(opline->op2));
2242		if (Z_OPT_CONSTANT_P(param)) {
2243			SAVE_OPLINE();
2244			if (UNEXPECTED(zval_update_constant_ex(param, EX(func)->op_array.scope) != SUCCESS)) {
2245				ZVAL_UNDEF(param);
2246				HANDLE_EXCEPTION();
2247			}
2248		}
2249	}
2250
2251	if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
2252		zval *default_value = EX_CONSTANT(opline->op2);
2253
2254		SAVE_OPLINE();
2255		if (UNEXPECTED(!zend_verify_arg_type(EX(func), arg_num, param, default_value, CACHE_ADDR(Z_CACHE_SLOT_P(default_value))) || EG(exception))) {
2256			HANDLE_EXCEPTION();
2257		}
2258	}
2259
2260	ZEND_VM_REPEAT_OPCODE(ZEND_RECV_INIT);
2261	ZEND_VM_NEXT_OPCODE();
2262}
2263
2264static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_INTERFACE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2265{
2266	USE_OPLINE
2267	zend_class_entry *ce = Z_CE_P(EX_VAR(opline->op1.var));
2268	zend_class_entry *iface;
2269
2270	SAVE_OPLINE();
2271	iface = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
2272	if (UNEXPECTED(iface == NULL)) {
2273		iface = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_INTERFACE);
2274		if (UNEXPECTED(iface == NULL)) {
2275			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2276		}
2277		CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), iface);
2278	}
2279
2280	if (UNEXPECTED((iface->ce_flags & ZEND_ACC_INTERFACE) == 0)) {
2281		zend_error_noreturn(E_ERROR, "%s cannot implement %s - it is not an interface", ZSTR_VAL(ce->name), ZSTR_VAL(iface->name));
2282	}
2283	zend_do_implement_interface(ce, iface);
2284
2285	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2286}
2287
2288static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2289{
2290	USE_OPLINE
2291
2292	SAVE_OPLINE();
2293	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->op2.var)), 0);
2294	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2295}
2296
2297static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_INHERITED_CLASS_DELAYED_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2298{
2299	USE_OPLINE
2300	zval *zce, *orig_zce;
2301
2302	SAVE_OPLINE();
2303	if ((zce = zend_hash_find(EG(class_table), Z_STR_P(EX_CONSTANT(opline->op1)))) == NULL ||
2304	    ((orig_zce = zend_hash_find(EG(class_table), Z_STR_P(EX_CONSTANT(opline->op1)+1))) != NULL &&
2305	     Z_CE_P(zce) != Z_CE_P(orig_zce))) {
2306		do_bind_inherited_class(&EX(func)->op_array, opline, EG(class_table), Z_CE_P(EX_VAR(opline->op2.var)), 0);
2307	}
2308	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2309}
2310
2311static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_ANON_INHERITED_CLASS_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2312{
2313	zend_class_entry *ce;
2314	USE_OPLINE
2315
2316	SAVE_OPLINE();
2317	ce = zend_hash_find_ptr(EG(class_table), Z_STR_P(EX_CONSTANT(opline->op1)));
2318	Z_CE_P(EX_VAR(opline->result.var)) = ce;
2319	ZEND_ASSERT(ce != NULL);
2320
2321	if (ce->ce_flags & ZEND_ACC_ANON_BOUND) {
2322		ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
2323		ZEND_VM_CONTINUE();
2324	}
2325
2326	zend_do_inheritance(ce, Z_CE_P(EX_VAR(opline->op2.var)));
2327	ce->ce_flags |= ZEND_ACC_ANON_BOUND;
2328	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2329}
2330
2331static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2332{
2333	USE_OPLINE
2334
2335	SAVE_OPLINE();
2336	if (IS_UNUSED == IS_UNUSED) {
2337		Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value);
2338		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2339	} else {
2340
2341		zval *class_name = NULL;
2342
2343try_class_name:
2344		if (IS_UNUSED == IS_CONST) {
2345			zend_class_entry *ce = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2346
2347			if (UNEXPECTED(ce == NULL)) {
2348				ce = zend_fetch_class_by_name(Z_STR_P(class_name), EX_CONSTANT(opline->op2) + 1, opline->extended_value);
2349				CACHE_PTR(Z_CACHE_SLOT_P(class_name), ce);
2350			}
2351			Z_CE_P(EX_VAR(opline->result.var)) = ce;
2352		} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2353			Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2354		} else if (Z_TYPE_P(class_name) == IS_STRING) {
2355			Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value);
2356		} else if ((IS_UNUSED & (IS_VAR|IS_CV)) && Z_TYPE_P(class_name) == IS_REFERENCE) {
2357			class_name = Z_REFVAL_P(class_name);
2358			goto try_class_name;
2359		} else {
2360			if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(class_name) == IS_UNDEF)) {
2361				GET_OP2_UNDEF_CV(class_name, BP_VAR_R);
2362				if (UNEXPECTED(EG(exception) != NULL)) {
2363					HANDLE_EXCEPTION();
2364				}
2365			}
2366			zend_throw_error(NULL, "Class name must be a valid object or a string");
2367		}
2368
2369		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2370	}
2371}
2372
2373static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2374{
2375	USE_OPLINE
2376
2377	SAVE_OPLINE();
2378	if (IS_CV == IS_UNUSED) {
2379		Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value);
2380		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2381	} else {
2382
2383		zval *class_name = _get_zval_ptr_cv_undef(execute_data, opline->op2.var);
2384
2385try_class_name:
2386		if (IS_CV == IS_CONST) {
2387			zend_class_entry *ce = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2388
2389			if (UNEXPECTED(ce == NULL)) {
2390				ce = zend_fetch_class_by_name(Z_STR_P(class_name), EX_CONSTANT(opline->op2) + 1, opline->extended_value);
2391				CACHE_PTR(Z_CACHE_SLOT_P(class_name), ce);
2392			}
2393			Z_CE_P(EX_VAR(opline->result.var)) = ce;
2394		} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2395			Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2396		} else if (Z_TYPE_P(class_name) == IS_STRING) {
2397			Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value);
2398		} else if ((IS_CV & (IS_VAR|IS_CV)) && Z_TYPE_P(class_name) == IS_REFERENCE) {
2399			class_name = Z_REFVAL_P(class_name);
2400			goto try_class_name;
2401		} else {
2402			if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(class_name) == IS_UNDEF)) {
2403				GET_OP2_UNDEF_CV(class_name, BP_VAR_R);
2404				if (UNEXPECTED(EG(exception) != NULL)) {
2405					HANDLE_EXCEPTION();
2406				}
2407			}
2408			zend_throw_error(NULL, "Class name must be a valid object or a string");
2409		}
2410
2411		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2412	}
2413}
2414
2415static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2416{
2417	USE_OPLINE
2418
2419	zval *function_name;
2420	zend_execute_data *call;
2421
2422	SAVE_OPLINE();
2423	function_name = _get_zval_ptr_cv_undef(execute_data, opline->op2.var);
2424
2425try_function_name:
2426	if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
2427		call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
2428	} else if (IS_CV != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
2429		call = zend_init_dynamic_call_object(function_name, opline->extended_value);
2430	} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
2431		call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
2432	} else if ((IS_CV & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
2433		function_name = Z_REFVAL_P(function_name);
2434		goto try_function_name;
2435	} else {
2436		if (IS_CV == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
2437			GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
2438			if (UNEXPECTED(EG(exception) != NULL)) {
2439				HANDLE_EXCEPTION();
2440			}
2441		}
2442		zend_throw_error(NULL, "Function name must be a string");
2443		call = NULL;
2444	}
2445
2446	if (UNEXPECTED(!call)) {
2447		HANDLE_EXCEPTION();
2448	}
2449
2450	call->prev_execute_data = EX(call);
2451	EX(call) = call;
2452
2453	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2454}
2455
2456static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2457{
2458	USE_OPLINE
2459
2460	SAVE_OPLINE();
2461	if ((IS_TMP_VAR|IS_VAR) == IS_UNUSED) {
2462		Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(NULL, opline->extended_value);
2463		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2464	} else {
2465		zend_free_op free_op2;
2466		zval *class_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
2467
2468try_class_name:
2469		if ((IS_TMP_VAR|IS_VAR) == IS_CONST) {
2470			zend_class_entry *ce = CACHED_PTR(Z_CACHE_SLOT_P(class_name));
2471
2472			if (UNEXPECTED(ce == NULL)) {
2473				ce = zend_fetch_class_by_name(Z_STR_P(class_name), EX_CONSTANT(opline->op2) + 1, opline->extended_value);
2474				CACHE_PTR(Z_CACHE_SLOT_P(class_name), ce);
2475			}
2476			Z_CE_P(EX_VAR(opline->result.var)) = ce;
2477		} else if (Z_TYPE_P(class_name) == IS_OBJECT) {
2478			Z_CE_P(EX_VAR(opline->result.var)) = Z_OBJCE_P(class_name);
2479		} else if (Z_TYPE_P(class_name) == IS_STRING) {
2480			Z_CE_P(EX_VAR(opline->result.var)) = zend_fetch_class(Z_STR_P(class_name), opline->extended_value);
2481		} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && Z_TYPE_P(class_name) == IS_REFERENCE) {
2482			class_name = Z_REFVAL_P(class_name);
2483			goto try_class_name;
2484		} else {
2485			if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(class_name) == IS_UNDEF)) {
2486				GET_OP2_UNDEF_CV(class_name, BP_VAR_R);
2487				if (UNEXPECTED(EG(exception) != NULL)) {
2488					HANDLE_EXCEPTION();
2489				}
2490			}
2491			zend_throw_error(NULL, "Class name must be a valid object or a string");
2492		}
2493
2494		zval_ptr_dtor_nogc(free_op2);
2495		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2496	}
2497}
2498
2499static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_DYNAMIC_CALL_SPEC_TMPVAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2500{
2501	USE_OPLINE
2502	zend_free_op free_op2;
2503	zval *function_name;
2504	zend_execute_data *call;
2505
2506	SAVE_OPLINE();
2507	function_name = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
2508
2509try_function_name:
2510	if ((IS_TMP_VAR|IS_VAR) != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
2511		call = zend_init_dynamic_call_string(Z_STR_P(function_name), opline->extended_value);
2512	} else if ((IS_TMP_VAR|IS_VAR) != IS_CONST && EXPECTED(Z_TYPE_P(function_name) == IS_OBJECT)) {
2513		call = zend_init_dynamic_call_object(function_name, opline->extended_value);
2514	} else if (EXPECTED(Z_TYPE_P(function_name) == IS_ARRAY)) {
2515		call = zend_init_dynamic_call_array(Z_ARRVAL_P(function_name), opline->extended_value);
2516	} else if (((IS_TMP_VAR|IS_VAR) & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(function_name) == IS_REFERENCE)) {
2517		function_name = Z_REFVAL_P(function_name);
2518		goto try_function_name;
2519	} else {
2520		if ((IS_TMP_VAR|IS_VAR) == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
2521			GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
2522			if (UNEXPECTED(EG(exception) != NULL)) {
2523				HANDLE_EXCEPTION();
2524			}
2525		}
2526		zend_throw_error(NULL, "Function name must be a string");
2527		call = NULL;
2528	}
2529
2530	zval_ptr_dtor_nogc(free_op2);
2531
2532	if (UNEXPECTED(!call)) {
2533		HANDLE_EXCEPTION();
2534	}
2535
2536	call->prev_execute_data = EX(call);
2537	EX(call) = call;
2538
2539	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2540}
2541
2542static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2543{
2544	USE_OPLINE
2545
2546
2547	SAVE_OPLINE();
2548	bitwise_not_function(EX_VAR(opline->result.var),
2549		EX_CONSTANT(opline->op1));
2550
2551	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2552}
2553
2554static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_NOT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2555{
2556	USE_OPLINE
2557	zval *val;
2558
2559
2560	val = EX_CONSTANT(opline->op1);
2561	if (Z_TYPE_INFO_P(val) == IS_TRUE) {
2562		ZVAL_FALSE(EX_VAR(opline->result.var));
2563	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
2564		ZVAL_TRUE(EX_VAR(opline->result.var));
2565		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
2566			SAVE_OPLINE();
2567			GET_OP1_UNDEF_CV(val, BP_VAR_R);
2568			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2569		}
2570	} else {
2571		SAVE_OPLINE();
2572		ZVAL_BOOL(EX_VAR(opline->result.var), !i_zend_is_true(val));
2573
2574		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2575	}
2576	ZEND_VM_NEXT_OPCODE();
2577}
2578
2579static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ECHO_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2580{
2581	USE_OPLINE
2582
2583	zval *z;
2584
2585	SAVE_OPLINE();
2586	z = EX_CONSTANT(opline->op1);
2587
2588	if (Z_TYPE_P(z) == IS_STRING) {
2589		zend_string *str = Z_STR_P(z);
2590
2591		if (ZSTR_LEN(str) != 0) {
2592			zend_write(ZSTR_VAL(str), ZSTR_LEN(str));
2593		}
2594	} else {
2595		zend_string *str = _zval_get_string_func(z);
2596
2597		if (ZSTR_LEN(str) != 0) {
2598			zend_write(ZSTR_VAL(str), ZSTR_LEN(str));
2599		} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(z) == IS_UNDEF)) {
2600			GET_OP1_UNDEF_CV(z, BP_VAR_R);
2601		}
2602		zend_string_release(str);
2603	}
2604
2605	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2606}
2607
2608static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2609{
2610	USE_OPLINE
2611
2612	zval *val;
2613
2614	val = EX_CONSTANT(opline->op1);
2615
2616	if (Z_TYPE_INFO_P(val) == IS_TRUE) {
2617		ZEND_VM_SET_NEXT_OPCODE(opline + 1);
2618		ZEND_VM_CONTINUE();
2619	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
2620		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
2621			SAVE_OPLINE();
2622			GET_OP1_UNDEF_CV(val, BP_VAR_R);
2623			ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
2624		} else {
2625			ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op2));
2626			ZEND_VM_CONTINUE();
2627		}
2628	}
2629
2630	SAVE_OPLINE();
2631	if (i_zend_is_true(val)) {
2632		opline++;
2633	} else {
2634		opline = OP_JMP_ADDR(opline, opline->op2);
2635	}
2636
2637	if (UNEXPECTED(EG(exception) != NULL)) {
2638		HANDLE_EXCEPTION();
2639	}
2640	ZEND_VM_JMP(opline);
2641}
2642
2643static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2644{
2645	USE_OPLINE
2646
2647	zval *val;
2648
2649	val = EX_CONSTANT(opline->op1);
2650
2651	if (Z_TYPE_INFO_P(val) == IS_TRUE) {
2652		ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op2));
2653		ZEND_VM_CONTINUE();
2654	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
2655		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
2656			SAVE_OPLINE();
2657			GET_OP1_UNDEF_CV(val, BP_VAR_R);
2658			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2659		} else {
2660			ZEND_VM_NEXT_OPCODE();
2661		}
2662	}
2663
2664	SAVE_OPLINE();
2665	if (i_zend_is_true(val)) {
2666		opline = OP_JMP_ADDR(opline, opline->op2);
2667	} else {
2668		opline++;
2669	}
2670
2671	if (UNEXPECTED(EG(exception) != NULL)) {
2672		HANDLE_EXCEPTION();
2673	}
2674	ZEND_VM_JMP(opline);
2675}
2676
2677static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZNZ_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2678{
2679	USE_OPLINE
2680
2681	zval *val;
2682
2683	val = EX_CONSTANT(opline->op1);
2684
2685	if (EXPECTED(Z_TYPE_INFO_P(val) == IS_TRUE)) {
2686		ZEND_VM_SET_RELATIVE_OPCODE(opline, opline->extended_value);
2687		ZEND_VM_CONTINUE();
2688	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
2689		if (IS_CONST == IS_CV) {
2690			if (UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
2691				SAVE_OPLINE();
2692				GET_OP1_UNDEF_CV(val, BP_VAR_R);
2693			}
2694			ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
2695		} else {
2696			ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op2));
2697			ZEND_VM_CONTINUE();
2698		}
2699	}
2700
2701	SAVE_OPLINE();
2702	if (i_zend_is_true(val)) {
2703		opline = ZEND_OFFSET_TO_OPLINE(opline, opline->extended_value);
2704	} else {
2705		opline = OP_JMP_ADDR(opline, opline->op2);
2706	}
2707
2708	if (UNEXPECTED(EG(exception) != NULL)) {
2709		HANDLE_EXCEPTION();
2710	}
2711	ZEND_VM_JMP(opline);
2712}
2713
2714static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2715{
2716	USE_OPLINE
2717
2718	zval *val;
2719	int ret;
2720
2721	val = EX_CONSTANT(opline->op1);
2722
2723	if (Z_TYPE_INFO_P(val) == IS_TRUE) {
2724		ZVAL_TRUE(EX_VAR(opline->result.var));
2725		ZEND_VM_SET_NEXT_OPCODE(opline + 1);
2726		ZEND_VM_CONTINUE();
2727	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
2728		ZVAL_FALSE(EX_VAR(opline->result.var));
2729		if (IS_CONST == IS_CV) {
2730			if (UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
2731				SAVE_OPLINE();
2732				GET_OP1_UNDEF_CV(val, BP_VAR_R);
2733			}
2734			ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
2735		} else {
2736			ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op2));
2737			ZEND_VM_CONTINUE();
2738		}
2739	}
2740
2741	SAVE_OPLINE();
2742	ret = i_zend_is_true(val);
2743
2744	if (ret) {
2745		ZVAL_TRUE(EX_VAR(opline->result.var));
2746		opline++;
2747	} else {
2748		ZVAL_FALSE(EX_VAR(opline->result.var));
2749		opline = OP_JMP_ADDR(opline, opline->op2);
2750	}
2751	if (UNEXPECTED(EG(exception) != NULL)) {
2752		HANDLE_EXCEPTION();
2753	}
2754	ZEND_VM_JMP(opline);
2755}
2756
2757static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMPNZ_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2758{
2759	USE_OPLINE
2760
2761	zval *val;
2762	int ret;
2763
2764	val = EX_CONSTANT(opline->op1);
2765
2766	if (Z_TYPE_INFO_P(val) == IS_TRUE) {
2767		ZVAL_TRUE(EX_VAR(opline->result.var));
2768		ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline, opline->op2));
2769		ZEND_VM_CONTINUE();
2770	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
2771		ZVAL_FALSE(EX_VAR(opline->result.var));
2772		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
2773			SAVE_OPLINE();
2774			GET_OP1_UNDEF_CV(val, BP_VAR_R);
2775			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
2776		} else {
2777			ZEND_VM_NEXT_OPCODE();
2778		}
2779	}
2780
2781	SAVE_OPLINE();
2782	ret = i_zend_is_true(val);
2783
2784	if (ret) {
2785		ZVAL_TRUE(EX_VAR(opline->result.var));
2786		opline = OP_JMP_ADDR(opline, opline->op2);
2787	} else {
2788		ZVAL_FALSE(EX_VAR(opline->result.var));
2789		opline++;
2790	}
2791	if (UNEXPECTED(EG(exception) != NULL)) {
2792		HANDLE_EXCEPTION();
2793	}
2794	ZEND_VM_JMP(opline);
2795}
2796
2797static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2798{
2799	USE_OPLINE
2800	zval *retval_ptr;
2801	zval *return_value;
2802	zend_free_op free_op1;
2803
2804	retval_ptr = EX_CONSTANT(opline->op1);
2805	return_value = EX(return_value);
2806	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(retval_ptr) == IS_UNDEF)) {
2807		SAVE_OPLINE();
2808		retval_ptr = GET_OP1_UNDEF_CV(retval_ptr, BP_VAR_R);
2809		if (return_value) {
2810			ZVAL_NULL(return_value);
2811		}
2812	} else if (!return_value) {
2813		if (IS_CONST & (IS_VAR|IS_TMP_VAR)) {
2814			if (Z_REFCOUNTED_P(free_op1) && !Z_DELREF_P(free_op1)) {
2815				SAVE_OPLINE();
2816				zval_dtor_func_for_ptr(Z_COUNTED_P(free_op1));
2817			}
2818		}
2819	} else {
2820		if ((IS_CONST & (IS_CONST|IS_TMP_VAR))) {
2821			ZVAL_COPY_VALUE(return_value, retval_ptr);
2822			if (IS_CONST == IS_CONST) {
2823				if (UNEXPECTED(Z_OPT_REFCOUNTED_P(return_value))) {
2824					Z_ADDREF_P(return_value);
2825				}
2826			}
2827		} else if (IS_CONST == IS_CV) {
2828			if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
2829				if (EXPECTED(!Z_OPT_ISREF_P(retval_ptr))) {
2830					ZVAL_COPY_VALUE(return_value, retval_ptr);
2831					if (EXPECTED(!(EX_CALL_INFO() & ZEND_CALL_CODE))) {
2832						ZVAL_NULL(retval_ptr);
2833					} else {
2834						Z_ADDREF_P(return_value);
2835					}
2836				} else {
2837					retval_ptr = Z_REFVAL_P(retval_ptr);
2838					ZVAL_COPY(return_value, retval_ptr);
2839				}
2840			} else {
2841				ZVAL_COPY_VALUE(return_value, retval_ptr);
2842			}
2843		} else /* if (IS_CONST == IS_VAR) */ {
2844			if (UNEXPECTED(Z_ISREF_P(retval_ptr))) {
2845				zend_refcounted *ref = Z_COUNTED_P(retval_ptr);
2846
2847				retval_ptr = Z_REFVAL_P(retval_ptr);
2848				ZVAL_COPY_VALUE(return_value, retval_ptr);
2849				if (UNEXPECTED(--GC_REFCOUNT(ref) == 0)) {
2850					efree_size(ref, sizeof(zend_reference));
2851				} else if (Z_OPT_REFCOUNTED_P(retval_ptr)) {
2852					Z_ADDREF_P(retval_ptr);
2853				}
2854			} else {
2855				ZVAL_COPY_VALUE(return_value, retval_ptr);
2856			}
2857		}
2858	}
2859	ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
2860}
2861
2862static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RETURN_BY_REF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2863{
2864	USE_OPLINE
2865	zval *retval_ptr;
2866
2867
2868	SAVE_OPLINE();
2869
2870	do {
2871		if ((IS_CONST & (IS_CONST|IS_TMP_VAR)) ||
2872		    (IS_CONST == IS_VAR && opline->extended_value == ZEND_RETURNS_VALUE)) {
2873			/* Not supposed to happen, but we'll allow it */
2874			zend_error(E_NOTICE, "Only variable references should be returned by reference");
2875
2876			retval_ptr = EX_CONSTANT(opline->op1);
2877			if (!EX(return_value)) {
2878
2879			} else {
2880				if (IS_CONST == IS_VAR && UNEXPECTED(Z_ISREF_P(retval_ptr))) {
2881					ZVAL_COPY_VALUE(EX(return_value), retval_ptr);
2882					break;
2883				}
2884
2885				ZVAL_NEW_REF(EX(return_value), retval_ptr);
2886				if (IS_CONST == IS_CONST) {
2887					if (Z_REFCOUNTED_P(retval_ptr)) Z_ADDREF_P(retval_ptr);
2888				}
2889			}
2890			break;
2891		}
2892
2893		retval_ptr = NULL;
2894
2895		if (IS_CONST == IS_VAR) {
2896			if (retval_ptr == &EG(uninitialized_zval) ||
2897			    (opline->extended_value == ZEND_RETURNS_FUNCTION && !Z_ISREF_P(retval_ptr))) {
2898				zend_error(E_NOTICE, "Only variable references should be returned by reference");
2899				if (EX(return_value)) {
2900					ZVAL_NEW_REF(EX(return_value), retval_ptr);
2901				} else {
2902
2903				}
2904				break;
2905			}
2906		}
2907
2908		if (EX(return_value)) {
2909			ZVAL_MAKE_REF(retval_ptr);
2910			Z_ADDREF_P(retval_ptr);
2911			ZVAL_REF(EX(return_value), Z_REF_P(retval_ptr));
2912		}
2913
2914	} while (0);
2915
2916	ZEND_VM_TAIL_CALL(zend_leave_helper_SPEC(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
2917}
2918
2919static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GENERATOR_RETURN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2920{
2921	USE_OPLINE
2922	zval *retval;
2923
2924
2925	zend_generator *generator = zend_get_running_generator(execute_data);
2926
2927	SAVE_OPLINE();
2928	retval = EX_CONSTANT(opline->op1);
2929
2930	/* Copy return value into generator->retval */
2931	if ((IS_CONST & (IS_CONST|IS_TMP_VAR))) {
2932		ZVAL_COPY_VALUE(&generator->retval, retval);
2933		if (IS_CONST == IS_CONST) {
2934			if (UNEXPECTED(Z_OPT_REFCOUNTED(generator->retval))) {
2935				Z_ADDREF(generator->retval);
2936			}
2937		}
2938	} else if (IS_CONST == IS_CV) {
2939		ZVAL_DEREF(retval);
2940		ZVAL_COPY(&generator->retval, retval);
2941	} else /* if (IS_CONST == IS_VAR) */ {
2942		if (UNEXPECTED(Z_ISREF_P(retval))) {
2943			zend_refcounted *ref = Z_COUNTED_P(retval);
2944
2945			retval = Z_REFVAL_P(retval);
2946			ZVAL_COPY_VALUE(&generator->retval, retval);
2947			if (UNEXPECTED(--GC_REFCOUNT(ref) == 0)) {
2948				efree_size(ref, sizeof(zend_reference));
2949			} else if (Z_OPT_REFCOUNTED_P(retval)) {
2950				Z_ADDREF_P(retval);
2951			}
2952		} else {
2953			ZVAL_COPY_VALUE(&generator->retval, retval);
2954		}
2955	}
2956
2957	/* Close the generator to free up resources */
2958	zend_generator_close(generator, 1);
2959
2960	/* Pass execution back to handling code */
2961	ZEND_VM_RETURN();
2962}
2963
2964static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_THROW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
2965{
2966	USE_OPLINE
2967	zval *value;
2968
2969
2970	SAVE_OPLINE();
2971	value = EX_CONSTANT(opline->op1);
2972
2973	do {
2974		if (IS_CONST == IS_CONST || UNEXPECTED(Z_TYPE_P(value) != IS_OBJECT)) {
2975			if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
2976				value = Z_REFVAL_P(value);
2977				if (EXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
2978					break;
2979				}
2980			}
2981			if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
2982				GET_OP1_UNDEF_CV(value, BP_VAR_R);
2983				if (UNEXPECTED(EG(exception) != NULL)) {
2984					HANDLE_EXCEPTION();
2985				}
2986			}
2987			zend_throw_error(NULL, "Can only throw objects");
2988
2989			HANDLE_EXCEPTION();
2990		}
2991	} while (0);
2992
2993	zend_exception_save();
2994	if (IS_CONST != IS_TMP_VAR) {
2995		if (Z_REFCOUNTED_P(value)) Z_ADDREF_P(value);
2996	}
2997
2998	zend_throw_exception_object(value);
2999	zend_exception_restore();
3000
3001	HANDLE_EXCEPTION();
3002}
3003
3004static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3005{
3006	USE_OPLINE
3007	zval *value, *arg;
3008
3009
3010	value = EX_CONSTANT(opline->op1);
3011	arg = ZEND_CALL_VAR(EX(call), opline->result.var);
3012	ZVAL_COPY_VALUE(arg, value);
3013	if (IS_CONST == IS_CONST) {
3014		if (UNEXPECTED(Z_OPT_REFCOUNTED_P(arg))) {
3015			Z_ADDREF_P(arg);
3016		}
3017	}
3018	ZEND_VM_NEXT_OPCODE();
3019}
3020
3021static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3022{
3023	USE_OPLINE
3024	zval *value, *arg;
3025
3026	uint32_t arg_num = opline->op2.num;
3027
3028	if (EXPECTED(0)) {
3029		if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
3030			goto send_val_by_ref;
3031		}
3032	} else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
3033send_val_by_ref:
3034		SAVE_OPLINE();
3035		zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
3036
3037		arg = ZEND_CALL_VAR(EX(call), opline->result.var);
3038		ZVAL_UNDEF(arg);
3039		HANDLE_EXCEPTION();
3040	}
3041	value = EX_CONSTANT(opline->op1);
3042	arg = ZEND_CALL_VAR(EX(call), opline->result.var);
3043	ZVAL_COPY_VALUE(arg, value);
3044	if (IS_CONST == IS_CONST) {
3045		if (UNEXPECTED(Z_OPT_REFCOUNTED_P(arg))) {
3046			Z_ADDREF_P(arg);
3047		}
3048	}
3049	ZEND_VM_NEXT_OPCODE();
3050}
3051
3052static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SEND_VAL_EX_SPEC_CONST_QUICK_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3053{
3054	USE_OPLINE
3055	zval *value, *arg;
3056
3057	uint32_t arg_num = opline->op2.num;
3058
3059	if (EXPECTED(1)) {
3060		if (QUICK_ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
3061			goto send_val_by_ref;
3062		}
3063	} else if (ARG_MUST_BE_SENT_BY_REF(EX(call)->func, arg_num)) {
3064send_val_by_ref:
3065		SAVE_OPLINE();
3066		zend_throw_error(NULL, "Cannot pass parameter %d by reference", arg_num);
3067
3068		arg = ZEND_CALL_VAR(EX(call), opline->result.var);
3069		ZVAL_UNDEF(arg);
3070		HANDLE_EXCEPTION();
3071	}
3072	value = EX_CONSTANT(opline->op1);
3073	arg = ZEND_CALL_VAR(EX(call), opline->result.var);
3074	ZVAL_COPY_VALUE(arg, value);
3075	if (IS_CONST == IS_CONST) {
3076		if (UNEXPECTED(Z_OPT_REFCOUNTED_P(arg))) {
3077			Z_ADDREF_P(arg);
3078		}
3079	}
3080	ZEND_VM_NEXT_OPCODE();
3081}
3082
3083static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3084{
3085	USE_OPLINE
3086	zval *val;
3087
3088
3089	val = EX_CONSTANT(opline->op1);
3090	if (Z_TYPE_INFO_P(val) == IS_TRUE) {
3091		ZVAL_TRUE(EX_VAR(opline->result.var));
3092	} else if (EXPECTED(Z_TYPE_INFO_P(val) <= IS_TRUE)) {
3093		ZVAL_FALSE(EX_VAR(opline->result.var));
3094		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(val) == IS_UNDEF)) {
3095			SAVE_OPLINE();
3096			GET_OP1_UNDEF_CV(val, BP_VAR_R);
3097			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3098		}
3099	} else {
3100		SAVE_OPLINE();
3101		ZVAL_BOOL(EX_VAR(opline->result.var), i_zend_is_true(val));
3102
3103		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3104	}
3105	ZEND_VM_NEXT_OPCODE();
3106}
3107
3108static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_NEW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3109{
3110	USE_OPLINE
3111	zval *result;
3112	zend_function *constructor;
3113	zend_class_entry *ce;
3114	zend_execute_data *call;
3115
3116	SAVE_OPLINE();
3117	if (IS_CONST == IS_CONST) {
3118		ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)));
3119		if (UNEXPECTED(ce == NULL)) {
3120			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
3121			if (UNEXPECTED(ce == NULL)) {
3122				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3123			}
3124			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
3125		}
3126	} else if (IS_CONST == IS_UNUSED) {
3127		ce = zend_fetch_class(NULL, opline->op1.num);
3128		if (UNEXPECTED(ce == NULL)) {
3129			ZEND_ASSERT(EG(exception));
3130			HANDLE_EXCEPTION();
3131		}
3132	} else {
3133		ce = Z_CE_P(EX_VAR(opline->op1.var));
3134	}
3135
3136	result = EX_VAR(opline->result.var);
3137	if (UNEXPECTED(object_init_ex(result, ce) != SUCCESS)) {
3138		HANDLE_EXCEPTION();
3139	}
3140
3141	constructor = Z_OBJ_HT_P(result)->get_constructor(Z_OBJ_P(result));
3142	if (constructor == NULL) {
3143		/* If there are no arguments, skip over the DO_FCALL opcode. We check if the next
3144		 * opcode is DO_FCALL in case EXT instructions are used. */
3145		if (EXPECTED(opline->extended_value == 0 && (opline+1)->opcode == ZEND_DO_FCALL)) {
3146			ZEND_VM_NEXT_OPCODE_EX(1, 2);
3147		}
3148
3149		/* Perform a dummy function call */
3150		call = zend_vm_stack_push_call_frame(
3151			ZEND_CALL_FUNCTION, (zend_function *) &zend_pass_function,
3152			opline->extended_value, NULL, NULL);
3153	} else {
3154		if (EXPECTED(constructor->type == ZEND_USER_FUNCTION) && UNEXPECTED(!constructor->op_array.run_time_cache)) {
3155			init_func_run_time_cache(&constructor->op_array);
3156		}
3157		/* We are not handling overloaded classes right now */
3158		call = zend_vm_stack_push_call_frame(
3159			ZEND_CALL_FUNCTION | ZEND_CALL_RELEASE_THIS | ZEND_CALL_CTOR,
3160			constructor,
3161			opline->extended_value,
3162			ce,
3163			Z_OBJ_P(result));
3164		Z_ADDREF_P(result);
3165	}
3166
3167	call->prev_execute_data = EX(call);
3168	EX(call) = call;
3169	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3170}
3171
3172static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CLONE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3173{
3174	USE_OPLINE
3175
3176	zval *obj;
3177	zend_class_entry *ce, *scope;
3178	zend_function *clone;
3179	zend_object_clone_obj_t clone_call;
3180
3181	SAVE_OPLINE();
3182	obj = EX_CONSTANT(opline->op1);
3183
3184	if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
3185		zend_throw_error(NULL, "Using $this when not in object context");
3186		HANDLE_EXCEPTION();
3187	}
3188
3189	do {
3190		if (IS_CONST == IS_CONST ||
3191		    (IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(obj) != IS_OBJECT))) {
3192		    if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(obj)) {
3193		    	obj = Z_REFVAL_P(obj);
3194		    	if (EXPECTED(Z_TYPE_P(obj) == IS_OBJECT)) {
3195		    		break;
3196				}
3197			}
3198			if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(obj) == IS_UNDEF)) {
3199				GET_OP1_UNDEF_CV(obj, BP_VAR_R);
3200				if (UNEXPECTED(EG(exception) != NULL)) {
3201					HANDLE_EXCEPTION();
3202				}
3203			}
3204			zend_throw_error(NULL, "__clone method called on non-object");
3205
3206			HANDLE_EXCEPTION();
3207		}
3208	} while (0);
3209
3210	ce = Z_OBJCE_P(obj);
3211	clone = ce->clone;
3212	clone_call = Z_OBJ_HT_P(obj)->clone_obj;
3213	if (UNEXPECTED(clone_call == NULL)) {
3214		zend_throw_error(NULL, "Trying to clone an uncloneable object of class %s", ZSTR_VAL(ce->name));
3215
3216		HANDLE_EXCEPTION();
3217	}
3218
3219	if (clone) {
3220		if (clone->op_array.fn_flags & ZEND_ACC_PRIVATE) {
3221			/* Ensure that if we're calling a private function, we're allowed to do so.
3222			 */
3223			scope = EX(func)->op_array.scope;
3224			if (UNEXPECTED(ce != scope)) {
3225				zend_throw_error(NULL, "Call to private %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
3226
3227				HANDLE_EXCEPTION();
3228			}
3229		} else if ((clone->common.fn_flags & ZEND_ACC_PROTECTED)) {
3230			/* Ensure that if we're calling a protected function, we're allowed to do so.
3231			 */
3232			scope = EX(func)->op_array.scope;
3233			if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(clone), scope))) {
3234				zend_throw_error(NULL, "Call to protected %s::__clone() from context '%s'", ZSTR_VAL(ce->name), scope ? ZSTR_VAL(scope->name) : "");
3235
3236				HANDLE_EXCEPTION();
3237			}
3238		}
3239	}
3240
3241	ZVAL_OBJ(EX_VAR(opline->result.var), clone_call(obj));
3242	if (UNEXPECTED(EG(exception) != NULL)) {
3243		OBJ_RELEASE(Z_OBJ_P(EX_VAR(opline->result.var)));
3244	}
3245
3246	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3247}
3248
3249static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CAST_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3250{
3251	USE_OPLINE
3252
3253	zval *expr;
3254	zval *result = EX_VAR(opline->result.var);
3255
3256	SAVE_OPLINE();
3257	expr = EX_CONSTANT(opline->op1);
3258
3259	switch (opline->extended_value) {
3260		case IS_NULL:
3261			/* This code is taken from convert_to_null. However, it does not seems very useful,
3262			 * because a conversion to null always results in the same value. This could only
3263			 * be relevant if a cast_object handler for IS_NULL has some kind of side-effect. */
3264#if 0
3265			if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
3266				ZVAL_DEREF(expr);
3267			}
3268			if (Z_TYPE_P(expr) == IS_OBJECT && Z_OBJ_HT_P(expr)->cast_object) {
3269				if (Z_OBJ_HT_P(expr)->cast_object(expr, result, IS_NULL) == SUCCESS) {
3270					break;
3271				}
3272			}
3273#endif
3274
3275			ZVAL_NULL(result);
3276			break;
3277		case _IS_BOOL:
3278			ZVAL_BOOL(result, zend_is_true(expr));
3279			break;
3280		case IS_LONG:
3281			ZVAL_LONG(result, zval_get_long(expr));
3282			break;
3283		case IS_DOUBLE:
3284			ZVAL_DOUBLE(result, zval_get_double(expr));
3285			break;
3286		case IS_STRING:
3287			ZVAL_STR(result, zval_get_string(expr));
3288			break;
3289		default:
3290			if (IS_CONST & (IS_VAR|IS_CV)) {
3291				ZVAL_DEREF(expr);
3292			}
3293			/* If value is already of correct type, return it directly */
3294			if (Z_TYPE_P(expr) == opline->extended_value) {
3295				ZVAL_COPY_VALUE(result, expr);
3296				if (IS_CONST == IS_CONST) {
3297					if (UNEXPECTED(Z_OPT_COPYABLE_P(result))) {
3298						zval_copy_ctor_func(result);
3299					}
3300				} else if (IS_CONST != IS_TMP_VAR) {
3301					if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
3302				}
3303
3304				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3305			}
3306
3307			if (opline->extended_value == IS_ARRAY) {
3308				if (Z_TYPE_P(expr) != IS_OBJECT) {
3309					ZVAL_NEW_ARR(result);
3310					zend_hash_init(Z_ARRVAL_P(result), 8, NULL, ZVAL_PTR_DTOR, 0);
3311					if (Z_TYPE_P(expr) != IS_NULL) {
3312						expr = zend_hash_index_add_new(Z_ARRVAL_P(result), 0, expr);
3313						if (IS_CONST == IS_CONST) {
3314							if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
3315								zval_copy_ctor_func(expr);
3316							}
3317						} else {
3318							if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
3319						}
3320					}
3321				} else {
3322					ZVAL_COPY_VALUE(result, expr);
3323					Z_ADDREF_P(result);
3324					convert_to_array(result);
3325				}
3326			} else {
3327				if (Z_TYPE_P(expr) != IS_ARRAY) {
3328					object_init(result);
3329					if (Z_TYPE_P(expr) != IS_NULL) {
3330						expr = zend_hash_str_add_new(Z_OBJPROP_P(result), "scalar", sizeof("scalar")-1, expr);
3331						if (IS_CONST == IS_CONST) {
3332							if (UNEXPECTED(Z_OPT_COPYABLE_P(expr))) {
3333								zval_copy_ctor_func(expr);
3334							}
3335						} else {
3336							if (Z_OPT_REFCOUNTED_P(expr)) Z_ADDREF_P(expr);
3337						}
3338					}
3339				} else {
3340					ZVAL_COPY(result, expr);
3341					convert_to_object(result);
3342				}
3343			}
3344	}
3345
3346	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3347}
3348
3349static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3350{
3351	USE_OPLINE
3352	zend_op_array *new_op_array;
3353
3354	zval *inc_filename;
3355
3356	SAVE_OPLINE();
3357	inc_filename = EX_CONSTANT(opline->op1);
3358	new_op_array = zend_include_or_eval(inc_filename, opline->extended_value);
3359
3360	if (UNEXPECTED(EG(exception) != NULL)) {
3361		HANDLE_EXCEPTION();
3362	} else if (new_op_array == ZEND_FAKE_OP_ARRAY) {
3363		if (RETURN_VALUE_USED(opline)) {
3364			ZVAL_TRUE(EX_VAR(opline->result.var));
3365		}
3366	} else if (EXPECTED(new_op_array != NULL)) {
3367		zval *return_value = NULL;
3368		zend_execute_data *call;
3369
3370		if (RETURN_VALUE_USED(opline)) {
3371			return_value = EX_VAR(opline->result.var);
3372		}
3373
3374		new_op_array->scope = EX(func)->op_array.scope;
3375
3376		call = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_CODE | ZEND_CALL_HAS_SYMBOL_TABLE,
3377			(zend_function*)new_op_array, 0,
3378			Z_TYPE(EX(This)) != IS_OBJECT ? Z_CE(EX(This)) : NULL,
3379			Z_TYPE(EX(This)) == IS_OBJECT ? Z_OBJ(EX(This)) : NULL);
3380
3381		if (EX_CALL_INFO() & ZEND_CALL_HAS_SYMBOL_TABLE) {
3382			call->symbol_table = EX(symbol_table);
3383		} else {
3384			call->symbol_table = zend_rebuild_symbol_table();
3385		}
3386
3387		call->prev_execute_data = execute_data;
3388		i_init_code_execute_data(call, new_op_array, return_value);
3389		if (EXPECTED(zend_execute_ex == execute_ex)) {
3390			ZEND_VM_ENTER();
3391		} else {
3392			ZEND_ADD_CALL_FLAG(call, ZEND_CALL_TOP);
3393			zend_execute_ex(call);
3394			zend_vm_stack_free_call_frame(call);
3395		}
3396
3397		destroy_op_array(new_op_array);
3398		efree_size(new_op_array, sizeof(zend_op_array));
3399		if (UNEXPECTED(EG(exception) != NULL)) {
3400			zend_throw_exception_internal(NULL);
3401			HANDLE_EXCEPTION();
3402		}
3403	} else if (RETURN_VALUE_USED(opline)) {
3404		ZVAL_FALSE(EX_VAR(opline->result.var));
3405	}
3406	ZEND_VM_SET_OPCODE(opline + 1);
3407	ZEND_VM_CONTINUE();
3408}
3409
3410static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_R_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3411{
3412	USE_OPLINE
3413
3414	zval *array_ptr, *result;
3415	HashTable *fe_ht;
3416
3417	SAVE_OPLINE();
3418
3419	array_ptr = EX_CONSTANT(opline->op1);
3420	if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
3421		result = EX_VAR(opline->result.var);
3422		ZVAL_COPY_VALUE(result, array_ptr);
3423		if (IS_CONST != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(result)) {
3424			Z_ADDREF_P(array_ptr);
3425		}
3426		Z_FE_POS_P(result) = 0;
3427
3428		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3429	} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
3430		if (!Z_OBJCE_P(array_ptr)->get_iterator) {
3431			HashPosition pos = 0;
3432			Bucket *p;
3433
3434			result = EX_VAR(opline->result.var);
3435			ZVAL_COPY_VALUE(result, array_ptr);
3436			if (IS_CONST != IS_TMP_VAR) {
3437				Z_ADDREF_P(array_ptr);
3438			}
3439			fe_ht = Z_OBJPROP_P(array_ptr);
3440			pos = 0;
3441			p = fe_ht->arData;
3442			while (1) {
3443				if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
3444
3445					Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3446					ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3447				}
3448				if ((EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
3449				     (EXPECTED(Z_TYPE(p->val) != IS_INDIRECT) ||
3450				      EXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) != IS_UNDEF))) &&
3451				    (UNEXPECTED(!p->key) ||
3452				     EXPECTED(zend_check_property_access(Z_OBJ_P(array_ptr), p->key) == SUCCESS))) {
3453					break;
3454				}
3455				pos++;
3456				p++;
3457			}
3458			Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
3459
3460			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3461		} else {
3462			zend_class_entry *ce = Z_OBJCE_P(array_ptr);
3463			zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 0);
3464			zend_bool is_empty;
3465
3466			if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
3467
3468				if (!EG(exception)) {
3469					zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
3470				}
3471				zend_throw_exception_internal(NULL);
3472				HANDLE_EXCEPTION();
3473			}
3474
3475			iter->index = 0;
3476			if (iter->funcs->rewind) {
3477				iter->funcs->rewind(iter);
3478				if (UNEXPECTED(EG(exception) != NULL)) {
3479					OBJ_RELEASE(&iter->std);
3480
3481					HANDLE_EXCEPTION();
3482				}
3483			}
3484
3485			is_empty = iter->funcs->valid(iter) != SUCCESS;
3486
3487			if (UNEXPECTED(EG(exception) != NULL)) {
3488				OBJ_RELEASE(&iter->std);
3489
3490				HANDLE_EXCEPTION();
3491			}
3492			iter->index = -1; /* will be set to 0 before using next handler */
3493
3494			ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
3495			Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3496
3497			if (is_empty) {
3498				ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3499			} else {
3500				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3501			}
3502		}
3503	} else {
3504		zend_error(E_WARNING, "Invalid argument supplied for foreach()");
3505		ZVAL_UNDEF(EX_VAR(opline->result.var));
3506		Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3507
3508		ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3509	}
3510}
3511
3512static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FE_RESET_RW_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3513{
3514	USE_OPLINE
3515
3516	zval *array_ptr, *array_ref;
3517	HashTable *fe_ht;
3518	HashPosition pos = 0;
3519	Bucket *p;
3520
3521	SAVE_OPLINE();
3522
3523	if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
3524		array_ref = array_ptr = NULL;
3525		if (Z_ISREF_P(array_ref)) {
3526			array_ptr = Z_REFVAL_P(array_ref);
3527		}
3528	} else {
3529		array_ref = array_ptr = EX_CONSTANT(opline->op1);
3530	}
3531
3532	if (EXPECTED(Z_TYPE_P(array_ptr) == IS_ARRAY)) {
3533		if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
3534			if (array_ptr == array_ref) {
3535				ZVAL_NEW_REF(array_ref, array_ref);
3536				array_ptr = Z_REFVAL_P(array_ref);
3537			}
3538			Z_ADDREF_P(array_ref);
3539			ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ref);
3540		} else {
3541			array_ref = EX_VAR(opline->result.var);
3542			ZVAL_NEW_REF(array_ref, array_ptr);
3543			array_ptr = Z_REFVAL_P(array_ref);
3544		}
3545		if (IS_CONST == IS_CONST) {
3546			zval_copy_ctor_func(array_ptr);
3547		} else {
3548			SEPARATE_ARRAY(array_ptr);
3549		}
3550		fe_ht = Z_ARRVAL_P(array_ptr);
3551		p = fe_ht->arData;
3552		while (1) {
3553			if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
3554
3555				Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3556				ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3557			}
3558			if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
3559			    (EXPECTED(Z_TYPE(p->val) != IS_INDIRECT) ||
3560			     EXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) != IS_UNDEF))) {
3561				break;
3562			}
3563			pos++;
3564			p++;
3565		}
3566		Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
3567
3568		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3569	} else if (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(array_ptr) == IS_OBJECT)) {
3570		if (!Z_OBJCE_P(array_ptr)->get_iterator) {
3571			if (IS_CONST == IS_VAR || IS_CONST == IS_CV) {
3572				if (array_ptr == array_ref) {
3573					ZVAL_NEW_REF(array_ref, array_ref);
3574					array_ptr = Z_REFVAL_P(array_ref);
3575				}
3576				Z_ADDREF_P(array_ref);
3577				ZVAL_COPY_VALUE(EX_VAR(opline->result.var), array_ref);
3578			} else {
3579				array_ptr = EX_VAR(opline->result.var);
3580				ZVAL_COPY_VALUE(array_ptr, array_ref);
3581			}
3582			fe_ht = Z_OBJPROP_P(array_ptr);
3583			p = fe_ht->arData;
3584			while (1) {
3585				if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
3586
3587					Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3588					ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3589				}
3590				if ((EXPECTED(Z_TYPE(p->val) != IS_UNDEF) &&
3591				     (EXPECTED(Z_TYPE(p->val) != IS_INDIRECT) ||
3592				      EXPECTED(Z_TYPE_P(Z_INDIRECT(p->val)) != IS_UNDEF))) &&
3593				    (UNEXPECTED(!p->key) ||
3594				     EXPECTED(zend_check_property_access(Z_OBJ_P(array_ptr), p->key) == SUCCESS))) {
3595					break;
3596				}
3597				pos++;
3598				p++;
3599			}
3600			Z_FE_ITER_P(EX_VAR(opline->result.var)) = zend_hash_iterator_add(fe_ht, pos);
3601
3602			ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3603		} else {
3604			zend_class_entry *ce = Z_OBJCE_P(array_ptr);
3605			zend_object_iterator *iter = ce->get_iterator(ce, array_ptr, 1);
3606			zend_bool is_empty;
3607
3608			if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
3609				if (IS_CONST == IS_VAR) {
3610
3611				} else {
3612
3613				}
3614				if (!EG(exception)) {
3615					zend_throw_exception_ex(NULL, 0, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
3616				}
3617				zend_throw_exception_internal(NULL);
3618				HANDLE_EXCEPTION();
3619			}
3620
3621			iter->index = 0;
3622			if (iter->funcs->rewind) {
3623				iter->funcs->rewind(iter);
3624				if (UNEXPECTED(EG(exception) != NULL)) {
3625					OBJ_RELEASE(&iter->std);
3626					if (IS_CONST == IS_VAR) {
3627
3628					} else {
3629
3630					}
3631					HANDLE_EXCEPTION();
3632				}
3633			}
3634
3635			is_empty = iter->funcs->valid(iter) != SUCCESS;
3636
3637			if (UNEXPECTED(EG(exception) != NULL)) {
3638				OBJ_RELEASE(&iter->std);
3639				if (IS_CONST == IS_VAR) {
3640
3641				} else {
3642
3643				}
3644				HANDLE_EXCEPTION();
3645			}
3646			iter->index = -1; /* will be set to 0 before using next handler */
3647
3648			ZVAL_OBJ(EX_VAR(opline->result.var), &iter->std);
3649			Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3650
3651			if (IS_CONST == IS_VAR) {
3652
3653			} else {
3654
3655			}
3656			if (is_empty) {
3657				ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3658			} else {
3659				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3660			}
3661		}
3662	} else {
3663		zend_error(E_WARNING, "Invalid argument supplied for foreach()");
3664		ZVAL_UNDEF(EX_VAR(opline->result.var));
3665		Z_FE_ITER_P(EX_VAR(opline->result.var)) = (uint32_t)-1;
3666		if (IS_CONST == IS_VAR) {
3667
3668		} else {
3669
3670		}
3671		ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3672	}
3673}
3674
3675static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_EXIT_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3676{
3677	USE_OPLINE
3678
3679	SAVE_OPLINE();
3680	if (IS_CONST != IS_UNUSED) {
3681
3682		zval *ptr = EX_CONSTANT(opline->op1);
3683
3684		do {
3685			if (Z_TYPE_P(ptr) == IS_LONG) {
3686				EG(exit_status) = Z_LVAL_P(ptr);
3687			} else {
3688				if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(ptr)) {
3689					ptr = Z_REFVAL_P(ptr);
3690					if (Z_TYPE_P(ptr) == IS_LONG) {
3691						EG(exit_status) = Z_LVAL_P(ptr);
3692						break;
3693					}
3694				}
3695				zend_print_variable(ptr);
3696			}
3697		} while (0);
3698
3699	}
3700	zend_bailout();
3701	ZEND_VM_NEXT_OPCODE(); /* Never reached */
3702}
3703
3704static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_JMP_SET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3705{
3706	USE_OPLINE
3707
3708	zval *value;
3709	zval *ref = NULL;
3710
3711	SAVE_OPLINE();
3712	value = EX_CONSTANT(opline->op1);
3713
3714	if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(value)) {
3715		if (IS_CONST == IS_VAR) {
3716			ref = value;
3717		}
3718		value = Z_REFVAL_P(value);
3719	}
3720	if (i_zend_is_true(value)) {
3721		ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
3722		if (IS_CONST == IS_CONST) {
3723			if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3724				zval_copy_ctor_func(EX_VAR(opline->result.var));
3725			}
3726		} else if (IS_CONST == IS_CV) {
3727			if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
3728		} else if (IS_CONST == IS_VAR && ref) {
3729			zend_reference *r = Z_REF_P(ref);
3730
3731			if (UNEXPECTED(--GC_REFCOUNT(r) == 0)) {
3732				efree_size(r, sizeof(zend_reference));
3733			} else if (Z_OPT_REFCOUNTED_P(value)) {
3734				Z_ADDREF_P(value);
3735			}
3736		}
3737		ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3738	}
3739
3740	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3741}
3742
3743static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_COALESCE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3744{
3745	USE_OPLINE
3746
3747	zval *value;
3748	zval *ref = NULL;
3749
3750	SAVE_OPLINE();
3751	value = EX_CONSTANT(opline->op1);
3752
3753	if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) && Z_ISREF_P(value)) {
3754		if (IS_CONST == IS_VAR) {
3755			ref = value;
3756		}
3757		value = Z_REFVAL_P(value);
3758	}
3759
3760	if (Z_TYPE_P(value) > IS_NULL) {
3761		ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
3762		if (IS_CONST == IS_CONST) {
3763			if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3764				zval_copy_ctor_func(EX_VAR(opline->result.var));
3765			}
3766		} else if (IS_CONST == IS_CV) {
3767			if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
3768		} else if (IS_CONST == IS_VAR && ref) {
3769			zend_reference *r = Z_REF_P(ref);
3770
3771			if (UNEXPECTED(--GC_REFCOUNT(r) == 0)) {
3772				efree_size(r, sizeof(zend_reference));
3773			} else if (Z_OPT_REFCOUNTED_P(value)) {
3774				Z_ADDREF_P(value);
3775			}
3776		}
3777		ZEND_VM_JMP(OP_JMP_ADDR(opline, opline->op2));
3778	}
3779
3780	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3781}
3782
3783static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3784{
3785	USE_OPLINE
3786
3787	zval *value;
3788	zval *result = EX_VAR(opline->result.var);
3789
3790	value = EX_CONSTANT(opline->op1);
3791	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
3792		SAVE_OPLINE();
3793		GET_OP1_UNDEF_CV(value, BP_VAR_R);
3794		ZVAL_NULL(result);
3795		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3796	}
3797
3798	if (IS_CONST == IS_CV) {
3799		ZVAL_DEREF(value);
3800		ZVAL_COPY(result, value);
3801	} else if (IS_CONST == IS_VAR) {
3802		if (UNEXPECTED(Z_ISREF_P(value))) {
3803			ZVAL_COPY_VALUE(result, Z_REFVAL_P(value));
3804			if (UNEXPECTED(Z_DELREF_P(value) == 0)) {
3805				efree_size(Z_REF_P(value), sizeof(zend_reference));
3806			} else if (Z_OPT_REFCOUNTED_P(result)) {
3807				Z_ADDREF_P(result);
3808			}
3809		} else {
3810			ZVAL_COPY_VALUE(result, value);
3811		}
3812	} else {
3813		ZVAL_COPY_VALUE(result, value);
3814		if (IS_CONST == IS_CONST) {
3815			if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
3816				zval_copy_ctor_func(result);
3817			}
3818		}
3819	}
3820	ZEND_VM_NEXT_OPCODE();
3821}
3822
3823static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3824{
3825	USE_OPLINE
3826
3827	zend_generator *generator = zend_get_running_generator(execute_data);
3828
3829	zval *val;
3830
3831
3832	SAVE_OPLINE();
3833	val = EX_CONSTANT(opline->op1);
3834
3835	if (Z_TYPE_P(val) == IS_ARRAY) {
3836		ZVAL_COPY_VALUE(&generator->values, val);
3837		if (IS_CONST != IS_TMP_VAR && Z_OPT_REFCOUNTED_P(val)) {
3838			Z_ADDREF_P(val);
3839		}
3840		Z_FE_POS(generator->values) = 0;
3841
3842	} else if (IS_CONST != IS_CONST && Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val)->get_iterator) {
3843		zend_class_entry *ce = Z_OBJCE_P(val);
3844		if (ce == zend_ce_generator) {
3845			zend_generator *new_gen = (zend_generator *) Z_OBJ_P(val);
3846
3847			if (IS_CONST != IS_TMP_VAR) {
3848				Z_ADDREF_P(val);
3849			}
3850
3851			if (Z_ISUNDEF(new_gen->retval)) {
3852				if (UNEXPECTED(zend_generator_get_current(new_gen) == generator)) {
3853					zend_throw_error(NULL, "Impossible to yield from the Generator being currently run");
3854					HANDLE_EXCEPTION();
3855				} else {
3856					zend_generator_yield_from(generator, new_gen);
3857				}
3858			} else if (UNEXPECTED(new_gen->execute_data == NULL)) {
3859				zend_throw_error(NULL, "Generator passed to yield from was aborted without proper return and is unable to continue");
3860				HANDLE_EXCEPTION();
3861			} else {
3862				if (RETURN_VALUE_USED(opline)) {
3863					ZVAL_COPY(EX_VAR(opline->result.var), &new_gen->retval);
3864				}
3865				ZEND_VM_NEXT_OPCODE();
3866			}
3867		} else {
3868			zend_object_iterator *iter = ce->get_iterator(ce, val, 0);
3869
3870			if (UNEXPECTED(!iter) || UNEXPECTED(EG(exception))) {
3871				if (!EG(exception)) {
3872					zend_throw_error(NULL, "Object of type %s did not create an Iterator", ZSTR_VAL(ce->name));
3873				}
3874				HANDLE_EXCEPTION();
3875			}
3876
3877			iter->index = 0;
3878			if (iter->funcs->rewind) {
3879				iter->funcs->rewind(iter);
3880				if (UNEXPECTED(EG(exception) != NULL)) {
3881					OBJ_RELEASE(&iter->std);
3882					HANDLE_EXCEPTION();
3883				}
3884			}
3885
3886			ZVAL_OBJ(&generator->values, &iter->std);
3887		}
3888	} else {
3889		zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables", 0);
3890		HANDLE_EXCEPTION();
3891	}
3892
3893	/* This is the default return value
3894	 * when the expression is a Generator, it will be overwritten in zend_generator_resume() */
3895	if (RETURN_VALUE_USED(opline)) {
3896		ZVAL_NULL(EX_VAR(opline->result.var));
3897	}
3898
3899	/* This generator has no send target (though the generator we delegate to might have one) */
3900	generator->send_target = NULL;
3901
3902	/* We increment to the next op, so we are at the correct position when the
3903	 * generator is resumed. */
3904	ZEND_VM_INC_OPCODE();
3905
3906	/* The GOTO VM uses a local opline variable. We need to set the opline
3907	 * variable in execute_data so we don't resume at an old position. */
3908	SAVE_OPLINE();
3909
3910	ZEND_VM_RETURN();
3911}
3912
3913static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_STRLEN_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3914{
3915	USE_OPLINE
3916	zval *value;
3917
3918
3919	SAVE_OPLINE();
3920	value = EX_CONSTANT(opline->op1);
3921try_strlen:
3922	if (EXPECTED(Z_TYPE_P(value) == IS_STRING)) {
3923		ZVAL_LONG(EX_VAR(opline->result.var), Z_STRLEN_P(value));
3924	} else {
3925		zend_bool strict;
3926
3927		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(value) == IS_UNDEF)) {
3928			value = GET_OP1_UNDEF_CV(value, BP_VAR_R);
3929		}
3930		if ((IS_CONST & (IS_VAR|IS_CV)) && Z_TYPE_P(value) == IS_REFERENCE) {
3931			value = Z_REFVAL_P(value);
3932			goto try_strlen;
3933		}
3934		strict = EX_USES_STRICT_TYPES();
3935		do {
3936			if (EXPECTED(!strict)) {
3937				zend_string *str;
3938				zval tmp;
3939
3940				ZVAL_COPY(&tmp, value);
3941				if (zend_parse_arg_str_weak(&tmp, &str)) {
3942					ZVAL_LONG(EX_VAR(opline->result.var), ZSTR_LEN(str));
3943					zval_ptr_dtor(&tmp);
3944					break;
3945				}
3946				zval_ptr_dtor(&tmp);
3947			}
3948			zend_internal_type_error(strict, "strlen() expects parameter 1 to be string, %s given", zend_get_type_by_const(Z_TYPE_P(value)));
3949			ZVAL_NULL(EX_VAR(opline->result.var));
3950		} while (0);
3951	}
3952
3953	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3954}
3955
3956static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_TYPE_CHECK_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3957{
3958	USE_OPLINE
3959	zval *value;
3960	int result = 0;
3961
3962
3963	SAVE_OPLINE();
3964	value = EX_CONSTANT(opline->op1);
3965	if (EXPECTED(Z_TYPE_P(value) == opline->extended_value)) {
3966		if (IS_CONST != IS_CONST && UNEXPECTED(Z_TYPE_P(value) == IS_OBJECT)) {
3967			zend_class_entry *ce = Z_OBJCE_P(value);
3968
3969			if (EXPECTED(ZSTR_LEN(ce->name) != sizeof("__PHP_Incomplete_Class") - 1) ||
3970			    EXPECTED(memcmp(ZSTR_VAL(ce->name), "__PHP_Incomplete_Class", sizeof("__PHP_Incomplete_Class") - 1) != 0)) {
3971				result = 1;
3972			}
3973		} else if (UNEXPECTED(Z_TYPE_P(value) == IS_RESOURCE)) {
3974			const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(value));
3975
3976			if (EXPECTED(type_name != NULL)) {
3977				result = 1;
3978			}
3979		} else {
3980			result = 1;
3981		}
3982	} else if (UNEXPECTED(opline->extended_value == _IS_BOOL) &&
3983			   EXPECTED(Z_TYPE_P(value) == IS_TRUE || Z_TYPE_P(value) == IS_FALSE)) {
3984		result = 1;
3985	}
3986
3987	ZEND_VM_SMART_BRANCH(result, 1);
3988	ZVAL_BOOL(EX_VAR(opline->result.var), result);
3989	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
3990}
3991
3992static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DEFINED_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
3993{
3994	USE_OPLINE
3995	zend_constant *c;
3996	int result;
3997
3998	if (EXPECTED(CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1))))) {
3999		result = 1;
4000	} else if ((c = zend_quick_get_constant(EX_CONSTANT(opline->op1), 0)) == NULL) {
4001		result = 0;
4002	} else {
4003		CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), c);
4004		result = 1;
4005	}
4006	ZEND_VM_SMART_BRANCH(result, 0);
4007	ZVAL_BOOL(EX_VAR(opline->result.var), result);
4008	ZEND_VM_NEXT_OPCODE();
4009}
4010
4011static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_DOUBLE_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4012{
4013	USE_OPLINE
4014
4015	zval *value;
4016
4017	value = EX_CONSTANT(opline->op1);
4018	ZVAL_DOUBLE(EX_VAR(opline->result.var), Z_DVAL_P(value));
4019	ZEND_VM_NEXT_OPCODE();
4020}
4021
4022static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_QM_ASSIGN_NOREF_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4023{
4024	USE_OPLINE
4025
4026	zval *value;
4027
4028	value = EX_CONSTANT(opline->op1);
4029	ZVAL_COPY_VALUE(EX_VAR(opline->result.var), value);
4030	ZEND_VM_NEXT_OPCODE();
4031}
4032
4033static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4034{
4035	USE_OPLINE
4036
4037	zval *op1, *op2, *result;
4038
4039	op1 = EX_CONSTANT(opline->op1);
4040	op2 = EX_CONSTANT(opline->op2);
4041	if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
4042		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4043			result = EX_VAR(opline->result.var);
4044			fast_long_add_function(result, op1, op2);
4045			ZEND_VM_NEXT_OPCODE();
4046		} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4047			result = EX_VAR(opline->result.var);
4048			ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) + Z_DVAL_P(op2));
4049			ZEND_VM_NEXT_OPCODE();
4050		}
4051	} else if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_DOUBLE)) {
4052		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4053			result = EX_VAR(opline->result.var);
4054			ZVAL_DOUBLE(result, Z_DVAL_P(op1) + Z_DVAL_P(op2));
4055			ZEND_VM_NEXT_OPCODE();
4056		} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4057			result = EX_VAR(opline->result.var);
4058			ZVAL_DOUBLE(result, Z_DVAL_P(op1) + ((double)Z_LVAL_P(op2)));
4059			ZEND_VM_NEXT_OPCODE();
4060		}
4061	}
4062
4063	SAVE_OPLINE();
4064	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op1) == IS_UNDEF)) {
4065		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4066	}
4067	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op2) == IS_UNDEF)) {
4068		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4069	}
4070	add_function(EX_VAR(opline->result.var), op1, op2);
4071
4072
4073	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4074}
4075
4076static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SUB_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4077{
4078	USE_OPLINE
4079
4080	zval *op1, *op2, *result;
4081
4082	op1 = EX_CONSTANT(opline->op1);
4083	op2 = EX_CONSTANT(opline->op2);
4084	if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
4085		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4086			result = EX_VAR(opline->result.var);
4087			fast_long_sub_function(result, op1, op2);
4088			ZEND_VM_NEXT_OPCODE();
4089		} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4090			result = EX_VAR(opline->result.var);
4091			ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) - Z_DVAL_P(op2));
4092			ZEND_VM_NEXT_OPCODE();
4093		}
4094	} else if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_DOUBLE)) {
4095		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4096			result = EX_VAR(opline->result.var);
4097			ZVAL_DOUBLE(result, Z_DVAL_P(op1) - Z_DVAL_P(op2));
4098			ZEND_VM_NEXT_OPCODE();
4099		} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4100			result = EX_VAR(opline->result.var);
4101			ZVAL_DOUBLE(result, Z_DVAL_P(op1) - ((double)Z_LVAL_P(op2)));
4102			ZEND_VM_NEXT_OPCODE();
4103		}
4104	}
4105
4106	SAVE_OPLINE();
4107	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op1) == IS_UNDEF)) {
4108		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4109	}
4110	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op2) == IS_UNDEF)) {
4111		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4112	}
4113	sub_function(EX_VAR(opline->result.var), op1, op2);
4114
4115
4116	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4117}
4118
4119static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MUL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4120{
4121	USE_OPLINE
4122
4123	zval *op1, *op2, *result;
4124
4125	op1 = EX_CONSTANT(opline->op1);
4126	op2 = EX_CONSTANT(opline->op2);
4127	if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
4128		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4129			zend_long overflow;
4130
4131			result = EX_VAR(opline->result.var);
4132			ZEND_SIGNED_MULTIPLY_LONG(Z_LVAL_P(op1), Z_LVAL_P(op2), Z_LVAL_P(result), Z_DVAL_P(result), overflow);
4133			Z_TYPE_INFO_P(result) = overflow ? IS_DOUBLE : IS_LONG;
4134			ZEND_VM_NEXT_OPCODE();
4135		} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4136			result = EX_VAR(opline->result.var);
4137			ZVAL_DOUBLE(result, ((double)Z_LVAL_P(op1)) * Z_DVAL_P(op2));
4138			ZEND_VM_NEXT_OPCODE();
4139		}
4140	} else if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_DOUBLE)) {
4141		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4142			result = EX_VAR(opline->result.var);
4143			ZVAL_DOUBLE(result, Z_DVAL_P(op1) * Z_DVAL_P(op2));
4144			ZEND_VM_NEXT_OPCODE();
4145		} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4146			result = EX_VAR(opline->result.var);
4147			ZVAL_DOUBLE(result, Z_DVAL_P(op1) * ((double)Z_LVAL_P(op2)));
4148			ZEND_VM_NEXT_OPCODE();
4149		}
4150	}
4151
4152	SAVE_OPLINE();
4153	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op1) == IS_UNDEF)) {
4154		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4155	}
4156	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op2) == IS_UNDEF)) {
4157		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4158	}
4159	mul_function(EX_VAR(opline->result.var), op1, op2);
4160
4161
4162	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4163}
4164
4165static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DIV_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4166{
4167	USE_OPLINE
4168
4169	zval *op1, *op2;
4170
4171	SAVE_OPLINE();
4172	op1 = EX_CONSTANT(opline->op1);
4173	op2 = EX_CONSTANT(opline->op2);
4174	fast_div_function(EX_VAR(opline->result.var), op1, op2);
4175
4176
4177	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4178}
4179
4180static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_MOD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4181{
4182	USE_OPLINE
4183
4184	zval *op1, *op2, *result;
4185
4186	op1 = EX_CONSTANT(opline->op1);
4187	op2 = EX_CONSTANT(opline->op2);
4188	if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
4189		if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4190			result = EX_VAR(opline->result.var);
4191			if (UNEXPECTED(Z_LVAL_P(op2) == 0)) {
4192				SAVE_OPLINE();
4193				zend_throw_exception_ex(zend_ce_division_by_zero_error, 0, "Modulo by zero");
4194				HANDLE_EXCEPTION();
4195			} else if (UNEXPECTED(Z_LVAL_P(op2) == -1)) {
4196				/* Prevent overflow error/crash if op1==ZEND_LONG_MIN */
4197				ZVAL_LONG(result, 0);
4198			} else {
4199				ZVAL_LONG(result, Z_LVAL_P(op1) % Z_LVAL_P(op2));
4200			}
4201			ZEND_VM_NEXT_OPCODE();
4202		}
4203	}
4204
4205	SAVE_OPLINE();
4206	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op1) == IS_UNDEF)) {
4207		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4208	}
4209	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op2) == IS_UNDEF)) {
4210		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4211	}
4212	mod_function(EX_VAR(opline->result.var), op1, op2);
4213
4214
4215	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4216}
4217
4218static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4219{
4220	USE_OPLINE
4221
4222	zval *op1, *op2;
4223
4224	SAVE_OPLINE();
4225	op1 = EX_CONSTANT(opline->op1);
4226	op2 = EX_CONSTANT(opline->op2);
4227	shift_left_function(EX_VAR(opline->result.var), op1, op2);
4228
4229
4230	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4231}
4232
4233static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4234{
4235	USE_OPLINE
4236
4237	zval *op1, *op2;
4238
4239	SAVE_OPLINE();
4240	op1 = EX_CONSTANT(opline->op1);
4241	op2 = EX_CONSTANT(opline->op2);
4242	shift_right_function(EX_VAR(opline->result.var), op1, op2);
4243
4244
4245	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4246}
4247
4248static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4249{
4250	USE_OPLINE
4251
4252	zval *op1, *op2;
4253
4254	SAVE_OPLINE();
4255	op1 = EX_CONSTANT(opline->op1);
4256	op2 = EX_CONSTANT(opline->op2);
4257	pow_function(EX_VAR(opline->result.var), op1, op2);
4258
4259
4260	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4261}
4262
4263static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4264{
4265	USE_OPLINE
4266
4267	zval *op1, *op2;
4268
4269	SAVE_OPLINE();
4270	op1 = EX_CONSTANT(opline->op1);
4271	op2 = EX_CONSTANT(opline->op2);
4272
4273	do {
4274		if ((IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op1) == IS_STRING)) &&
4275		    (IS_CONST == IS_CONST || EXPECTED(Z_TYPE_P(op2) == IS_STRING))) {
4276			zend_string *op1_str = Z_STR_P(op1);
4277			zend_string *op2_str = Z_STR_P(op2);
4278			zend_string *str;
4279
4280			if (IS_CONST != IS_CONST) {
4281				if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) {
4282					ZVAL_STR_COPY(EX_VAR(opline->result.var), op2_str);
4283
4284					break;
4285				}
4286			}
4287			if (IS_CONST != IS_CONST) {
4288				if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) {
4289					ZVAL_STR_COPY(EX_VAR(opline->result.var), op1_str);
4290
4291					break;
4292				}
4293			}
4294			if (IS_CONST != IS_CONST && IS_CONST != IS_CV &&
4295			    !ZSTR_IS_INTERNED(op1_str) && GC_REFCOUNT(op1_str) == 1) {
4296			    size_t len = ZSTR_LEN(op1_str);
4297
4298				str = zend_string_realloc(op1_str, len + ZSTR_LEN(op2_str), 0);
4299				memcpy(ZSTR_VAL(str) + len, ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1);
4300				ZVAL_NEW_STR(EX_VAR(opline->result.var), str);
4301				break;
4302			} else {
4303				str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0);
4304				memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str));
4305				memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1);
4306				ZVAL_NEW_STR(EX_VAR(opline->result.var), str);
4307			}
4308		} else {
4309			if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
4310				op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4311			}
4312			if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
4313				op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4314			}
4315			concat_function(EX_VAR(opline->result.var), op1, op2);
4316		}
4317
4318	} while (0);
4319
4320	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4321}
4322
4323static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4324{
4325	USE_OPLINE
4326
4327	zval *op1, *op2;
4328	int result;
4329
4330	SAVE_OPLINE();
4331	op1 = EX_CONSTANT(opline->op1);
4332	op2 = EX_CONSTANT(opline->op2);
4333	result = fast_is_identical_function(op1, op2);
4334
4335
4336	ZEND_VM_SMART_BRANCH(result, 1);
4337	ZVAL_BOOL(EX_VAR(opline->result.var), result);
4338	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4339}
4340
4341static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4342{
4343	USE_OPLINE
4344
4345	zval *op1, *op2;
4346	int result;
4347
4348	SAVE_OPLINE();
4349	op1 = EX_CONSTANT(opline->op1);
4350	op2 = EX_CONSTANT(opline->op2);
4351	result = fast_is_not_identical_function(op1, op2);
4352
4353
4354	ZEND_VM_SMART_BRANCH(result, 1);
4355	ZVAL_BOOL(EX_VAR(opline->result.var), result);
4356	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4357}
4358
4359static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4360{
4361	USE_OPLINE
4362
4363	zval *op1, *op2, *result;
4364
4365	op1 = EX_CONSTANT(opline->op1);
4366	op2 = EX_CONSTANT(opline->op2);
4367	do {
4368		int result;
4369
4370		if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
4371			if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
4372				result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
4373			} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
4374				result = ((double)Z_LVAL_P(op1) == Z_DVAL_P(op2));
4375			} else {
4376				break;
4377			}
4378		} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
4379			if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
4380				result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
4381			} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
4382				result = (Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)));
4383			} else {
4384				break;
4385			}
4386		} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
4387			if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
4388				if (Z_STR_P(op1) == Z_STR_P(op2)) {
4389					result = 1;
4390				} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
4391					if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
4392						result = 0;
4393					} else {
4394						result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
4395					}
4396				} else {
4397					result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
4398				}
4399
4400
4401			} else {
4402				break;
4403			}
4404		} else {
4405			break;
4406		}
4407		ZEND_VM_SMART_BRANCH(result, 0);
4408		ZVAL_BOOL(EX_VAR(opline->result.var), result);
4409		ZEND_VM_NEXT_OPCODE();
4410	} while (0);
4411
4412	SAVE_OPLINE();
4413	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
4414		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4415	}
4416	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
4417		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4418	}
4419	result = EX_VAR(opline->result.var);
4420	compare_function(result, op1, op2);
4421	ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
4422
4423
4424	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4425}
4426
4427static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4428{
4429	USE_OPLINE
4430
4431	zval *op1, *op2, *result;
4432
4433	op1 = EX_CONSTANT(opline->op1);
4434	op2 = EX_CONSTANT(opline->op2);
4435	do {
4436		int result;
4437
4438		if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
4439			if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
4440				result = (Z_LVAL_P(op1) != Z_LVAL_P(op2));
4441			} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
4442				result = ((double)Z_LVAL_P(op1) != Z_DVAL_P(op2));
4443			} else {
4444				break;
4445			}
4446		} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
4447			if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
4448				result = (Z_DVAL_P(op1) != Z_DVAL_P(op2));
4449			} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
4450				result = (Z_DVAL_P(op1) != ((double)Z_LVAL_P(op2)));
4451			} else {
4452				break;
4453			}
4454		} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
4455			if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
4456				if (Z_STR_P(op1) == Z_STR_P(op2)) {
4457					result = 0;
4458				} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
4459					if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
4460						result = 1;
4461					} else {
4462						result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) != 0);
4463					}
4464				} else {
4465					result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) != 0);
4466				}
4467
4468
4469			} else {
4470				break;
4471			}
4472		} else {
4473			break;
4474		}
4475		ZEND_VM_SMART_BRANCH(result, 0);
4476		ZVAL_BOOL(EX_VAR(opline->result.var), result);
4477		ZEND_VM_NEXT_OPCODE();
4478	} while (0);
4479
4480	SAVE_OPLINE();
4481	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
4482		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4483	}
4484	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
4485		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4486	}
4487	result = EX_VAR(opline->result.var);
4488	compare_function(result, op1, op2);
4489	ZVAL_BOOL(result, Z_LVAL_P(result) != 0);
4490
4491
4492	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4493}
4494
4495static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4496{
4497	USE_OPLINE
4498
4499	zval *op1, *op2, *result;
4500
4501	op1 = EX_CONSTANT(opline->op1);
4502	op2 = EX_CONSTANT(opline->op2);
4503	do {
4504		int result;
4505
4506		if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
4507			if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4508				result = (Z_LVAL_P(op1) < Z_LVAL_P(op2));
4509			} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4510				result = ((double)Z_LVAL_P(op1) < Z_DVAL_P(op2));
4511			} else {
4512				break;
4513			}
4514		} else if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_DOUBLE)) {
4515			if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4516				result = (Z_DVAL_P(op1) < Z_DVAL_P(op2));
4517			} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4518				result = (Z_DVAL_P(op1) < ((double)Z_LVAL_P(op2)));
4519			} else {
4520				break;
4521			}
4522		} else {
4523			break;
4524		}
4525		ZEND_VM_SMART_BRANCH(result, 0);
4526		ZVAL_BOOL(EX_VAR(opline->result.var), result);
4527		ZEND_VM_NEXT_OPCODE();
4528	} while (0);
4529
4530	SAVE_OPLINE();
4531	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op1) == IS_UNDEF)) {
4532		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4533	}
4534	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op2) == IS_UNDEF)) {
4535		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4536	}
4537	result = EX_VAR(opline->result.var);
4538	compare_function(result, op1, op2);
4539	ZVAL_BOOL(result, Z_LVAL_P(result) < 0);
4540
4541
4542	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4543}
4544
4545static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_SMALLER_OR_EQUAL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4546{
4547	USE_OPLINE
4548
4549	zval *op1, *op2, *result;
4550
4551	op1 = EX_CONSTANT(opline->op1);
4552	op2 = EX_CONSTANT(opline->op2);
4553	do {
4554		int result;
4555
4556		if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_LONG)) {
4557			if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4558				result = (Z_LVAL_P(op1) <= Z_LVAL_P(op2));
4559			} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4560				result = ((double)Z_LVAL_P(op1) <= Z_DVAL_P(op2));
4561			} else {
4562				break;
4563			}
4564		} else if (EXPECTED(Z_TYPE_INFO_P(op1) == IS_DOUBLE)) {
4565			if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_DOUBLE)) {
4566				result = (Z_DVAL_P(op1) <= Z_DVAL_P(op2));
4567			} else if (EXPECTED(Z_TYPE_INFO_P(op2) == IS_LONG)) {
4568				result = (Z_DVAL_P(op1) <= ((double)Z_LVAL_P(op2)));
4569			} else {
4570				break;
4571			}
4572		} else {
4573			break;
4574		}
4575		ZEND_VM_SMART_BRANCH(result, 0);
4576		ZVAL_BOOL(EX_VAR(opline->result.var), result);
4577		ZEND_VM_NEXT_OPCODE();
4578	} while (0);
4579
4580	SAVE_OPLINE();
4581	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op1) == IS_UNDEF)) {
4582		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
4583	}
4584	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_INFO_P(op2) == IS_UNDEF)) {
4585		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
4586	}
4587	result = EX_VAR(opline->result.var);
4588	compare_function(result, op1, op2);
4589	ZVAL_BOOL(result, Z_LVAL_P(result) <= 0);
4590
4591
4592	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4593}
4594
4595static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_SPACESHIP_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4596{
4597	USE_OPLINE
4598
4599	zval *op1, *op2;
4600
4601	SAVE_OPLINE();
4602	op1 = EX_CONSTANT(opline->op1);
4603	op2 = EX_CONSTANT(opline->op2);
4604	compare_function(EX_VAR(opline->result.var), op1, op2);
4605
4606
4607	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4608}
4609
4610static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_OR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4611{
4612	USE_OPLINE
4613
4614	zval *op1, *op2;
4615
4616	SAVE_OPLINE();
4617	op1 = EX_CONSTANT(opline->op1);
4618	op2 = EX_CONSTANT(opline->op2);
4619	bitwise_or_function(EX_VAR(opline->result.var), op1, op2);
4620
4621
4622	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4623}
4624
4625static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_AND_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4626{
4627	USE_OPLINE
4628
4629	zval *op1, *op2;
4630
4631	SAVE_OPLINE();
4632	op1 = EX_CONSTANT(opline->op1);
4633	op2 = EX_CONSTANT(opline->op2);
4634	bitwise_and_function(EX_VAR(opline->result.var), op1, op2);
4635
4636
4637	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4638}
4639
4640static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BW_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4641{
4642	USE_OPLINE
4643
4644	zval *op1, *op2;
4645
4646	SAVE_OPLINE();
4647	op1 = EX_CONSTANT(opline->op1);
4648	op2 = EX_CONSTANT(opline->op2);
4649	bitwise_xor_function(EX_VAR(opline->result.var), op1, op2);
4650
4651
4652	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4653}
4654
4655static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_BOOL_XOR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4656{
4657	USE_OPLINE
4658
4659	zval *op1, *op2;
4660
4661	SAVE_OPLINE();
4662	op1 = EX_CONSTANT(opline->op1);
4663	op2 = EX_CONSTANT(opline->op2);
4664	boolean_xor_function(EX_VAR(opline->result.var), op1, op2);
4665
4666
4667	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4668}
4669
4670static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_CONST_CONST(int type ZEND_OPCODE_HANDLER_ARGS_DC)
4671{
4672	USE_OPLINE
4673
4674	zval *varname;
4675	zval *retval;
4676	zend_string *name;
4677	zend_class_entry *ce;
4678
4679	SAVE_OPLINE();
4680	varname = EX_CONSTANT(opline->op1);
4681
4682 	if (IS_CONST == IS_CONST) {
4683		name = Z_STR_P(varname);
4684	} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
4685		name = Z_STR_P(varname);
4686		zend_string_addref(name);
4687	} else {
4688		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
4689			GET_OP1_UNDEF_CV(varname, BP_VAR_R);
4690		}
4691		name = zval_get_string(varname);
4692	}
4693
4694	if (IS_CONST == IS_CONST) {
4695		if (IS_CONST == IS_CONST && EXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)))) != NULL)) {
4696			retval = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)) + sizeof(void*));
4697
4698			/* check if static properties were destoyed */
4699			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
4700				zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
4701
4702				HANDLE_EXCEPTION();
4703			}
4704
4705			goto fetch_static_prop_return;
4706		} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
4707			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
4708			if (UNEXPECTED(ce == NULL)) {
4709				if (IS_CONST != IS_CONST) {
4710					zend_string_release(name);
4711				}
4712
4713				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4714			}
4715			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
4716		}
4717	} else {
4718		if (IS_CONST == IS_UNUSED) {
4719			ce = zend_fetch_class(NULL, opline->op2.num);
4720			if (UNEXPECTED(ce == NULL)) {
4721				ZEND_ASSERT(EG(exception));
4722				if (IS_CONST != IS_CONST) {
4723					zend_string_release(name);
4724				}
4725
4726				HANDLE_EXCEPTION();
4727			}
4728		} else {
4729			ce = Z_CE_P(EX_VAR(opline->op2.var));
4730		}
4731		if (IS_CONST == IS_CONST &&
4732		    (retval = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce)) != NULL) {
4733
4734			/* check if static properties were destoyed */
4735			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
4736				zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
4737
4738				HANDLE_EXCEPTION();
4739			}
4740
4741			goto fetch_static_prop_return;
4742		}
4743	}
4744	retval = zend_std_get_static_property(ce, name, 0);
4745	if (UNEXPECTED(EG(exception))) {
4746		if (IS_CONST != IS_CONST) {
4747			zend_string_release(name);
4748		}
4749
4750		HANDLE_EXCEPTION();
4751	}
4752	if (IS_CONST == IS_CONST && retval) {
4753		CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
4754	}
4755
4756	if (IS_CONST != IS_CONST) {
4757		zend_string_release(name);
4758	}
4759
4760fetch_static_prop_return:
4761	ZEND_ASSERT(retval != NULL);
4762	if (type == BP_VAR_R || type == BP_VAR_IS) {
4763		if (/*type == BP_VAR_R &&*/ Z_ISREF_P(retval) && Z_REFCOUNT_P(retval) == 1) {
4764			ZVAL_UNREF(retval);
4765		}
4766		ZVAL_COPY(EX_VAR(opline->result.var), retval);
4767	} else {
4768		ZVAL_INDIRECT(EX_VAR(opline->result.var), retval);
4769	}
4770	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4771}
4772
4773static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4774{
4775	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4776}
4777
4778static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_W_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4779{
4780	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4781}
4782
4783static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_RW_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4784{
4785	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_RW ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4786}
4787
4788static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4789{
4790	USE_OPLINE
4791
4792	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
4793		ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4794	} else {
4795		ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4796	}
4797}
4798
4799static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_UNSET_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4800{
4801	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_UNSET ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4802}
4803
4804static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4805{
4806	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_CONST(BP_VAR_IS ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
4807}
4808
4809static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4810{
4811	USE_OPLINE
4812
4813	zval *container;
4814
4815	SAVE_OPLINE();
4816	container = EX_CONSTANT(opline->op1);
4817	zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
4818
4819
4820	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4821}
4822
4823static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4824{
4825	USE_OPLINE
4826
4827	zval *container;
4828
4829	SAVE_OPLINE();
4830	container = EX_CONSTANT(opline->op1);
4831	zend_fetch_dimension_address_read_IS(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
4832
4833
4834	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4835}
4836
4837static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4838{
4839	USE_OPLINE
4840	zval *container;
4841	zend_free_op free_op1;
4842
4843	SAVE_OPLINE();
4844
4845	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
4846        if ((IS_CONST & (IS_CONST|IS_TMP_VAR))) {
4847            zend_throw_error(NULL, "Cannot use temporary expression in write context");
4848
4849
4850			HANDLE_EXCEPTION();
4851        }
4852		container = NULL;
4853		zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
4854		if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1)) {
4855			EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
4856		}
4857
4858
4859	} else {
4860		if (IS_CONST == IS_UNUSED) {
4861			zend_throw_error(NULL, "Cannot use [] for reading");
4862
4863
4864			HANDLE_EXCEPTION();
4865		}
4866		container = EX_CONSTANT(opline->op1);
4867		zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2), IS_CONST);
4868
4869
4870	}
4871	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4872}
4873
4874static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4875{
4876	USE_OPLINE
4877
4878	zval *container;
4879
4880	zval *offset;
4881
4882	SAVE_OPLINE();
4883	container = EX_CONSTANT(opline->op1);
4884
4885	if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
4886		zend_throw_error(NULL, "Using $this when not in object context");
4887
4888		HANDLE_EXCEPTION();
4889	}
4890
4891	offset = EX_CONSTANT(opline->op2);
4892
4893	if (IS_CONST == IS_CONST ||
4894	    (IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
4895		if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(container)) {
4896			container = Z_REFVAL_P(container);
4897			if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
4898				goto fetch_obj_r_no_object;
4899			}
4900		} else {
4901			goto fetch_obj_r_no_object;
4902		}
4903	}
4904
4905	/* here we are sure we are dealing with an object */
4906	do {
4907		zend_object *zobj = Z_OBJ_P(container);
4908		zval *retval;
4909
4910		if (IS_CONST == IS_CONST &&
4911			EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) {
4912			uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*));
4913
4914			if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) {
4915				retval = OBJ_PROP(zobj, prop_offset);
4916				if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
4917					ZVAL_COPY(EX_VAR(opline->result.var), retval);
4918					break;
4919				}
4920			} else if (EXPECTED(zobj->properties != NULL)) {
4921				retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
4922				if (EXPECTED(retval)) {
4923					ZVAL_COPY(EX_VAR(opline->result.var), retval);
4924					break;
4925				}
4926			}
4927		}
4928
4929		if (UNEXPECTED(zobj->handlers->read_property == NULL)) {
4930fetch_obj_r_no_object:
4931			zend_error(E_NOTICE, "Trying to get property of non-object");
4932			ZVAL_NULL(EX_VAR(opline->result.var));
4933		} else {
4934			retval = zobj->handlers->read_property(container, offset, BP_VAR_R, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var));
4935
4936			if (retval != EX_VAR(opline->result.var)) {
4937				ZVAL_COPY(EX_VAR(opline->result.var), retval);
4938			}
4939		}
4940	} while (0);
4941
4942
4943	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
4944}
4945
4946static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_IS_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
4947{
4948	USE_OPLINE
4949
4950	zval *container;
4951
4952	zval *offset;
4953
4954	SAVE_OPLINE();
4955	container = EX_CONSTANT(opline->op1);
4956
4957	if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
4958		zend_throw_error(NULL, "Using $this when not in object context");
4959
4960		HANDLE_EXCEPTION();
4961	}
4962
4963	offset  = EX_CONSTANT(opline->op2);
4964
4965	if (IS_CONST == IS_CONST ||
4966	    (IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
4967		if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(container)) {
4968			container = Z_REFVAL_P(container);
4969			if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
4970				goto fetch_obj_is_no_object;
4971			}
4972		} else {
4973			goto fetch_obj_is_no_object;
4974		}
4975	}
4976
4977	/* here we are sure we are dealing with an object */
4978	do {
4979		zend_object *zobj = Z_OBJ_P(container);
4980		zval *retval;
4981
4982		if (IS_CONST == IS_CONST &&
4983			EXPECTED(zobj->ce == CACHED_PTR(Z_CACHE_SLOT_P(offset)))) {
4984			uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(offset) + sizeof(void*));
4985
4986			if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) {
4987				retval = OBJ_PROP(zobj, prop_offset);
4988				if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
4989					ZVAL_COPY(EX_VAR(opline->result.var), retval);
4990					break;
4991				}
4992			} else if (EXPECTED(zobj->properties != NULL)) {
4993				retval = zend_hash_find(zobj->properties, Z_STR_P(offset));
4994				if (EXPECTED(retval)) {
4995					ZVAL_COPY(EX_VAR(opline->result.var), retval);
4996					break;
4997				}
4998			}
4999		}
5000
5001		if (UNEXPECTED(zobj->handlers->read_property == NULL)) {
5002fetch_obj_is_no_object:
5003			ZVAL_NULL(EX_VAR(opline->result.var));
5004		} else {
5005
5006			retval = zobj->handlers->read_property(container, offset, BP_VAR_IS, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(offset)) : NULL), EX_VAR(opline->result.var));
5007
5008			if (retval != EX_VAR(opline->result.var)) {
5009				ZVAL_COPY(EX_VAR(opline->result.var), retval);
5010			}
5011		}
5012	} while (0);
5013
5014
5015	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5016}
5017
5018static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5019{
5020	USE_OPLINE
5021	zval *container;
5022
5023	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
5024		/* Behave like FETCH_OBJ_W */
5025		zend_free_op free_op1;
5026		zval *property;
5027
5028		SAVE_OPLINE();
5029		property = EX_CONSTANT(opline->op2);
5030		container = NULL;
5031
5032		if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
5033			zend_throw_error(NULL, "Using $this when not in object context");
5034
5035			HANDLE_EXCEPTION();
5036		}
5037		if ((IS_CONST & (IS_CONST|IS_TMP_VAR))) {
5038			zend_throw_error(NULL, "Cannot use temporary expression in write context");
5039
5040
5041			HANDLE_EXCEPTION();
5042		}
5043		zend_fetch_property_address(EX_VAR(opline->result.var), container, IS_CONST, property, IS_CONST, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property)) : NULL), BP_VAR_W);
5044
5045		if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1)) {
5046			EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
5047		}
5048
5049		ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5050	} else {
5051		ZEND_VM_TAIL_CALL(ZEND_FETCH_OBJ_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
5052	}
5053}
5054
5055static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5056{
5057	USE_OPLINE
5058
5059	zval *container;
5060
5061	SAVE_OPLINE();
5062	container = EX_CONSTANT(opline->op1);
5063	zend_fetch_dimension_address_read_LIST(EX_VAR(opline->result.var), container, EX_CONSTANT(opline->op2));
5064
5065	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5066}
5067
5068static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FAST_CONCAT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5069{
5070	USE_OPLINE
5071
5072	zval *op1, *op2;
5073	zend_string *op1_str, *op2_str, *str;
5074
5075	SAVE_OPLINE();
5076	op1 = EX_CONSTANT(opline->op1);
5077	if (IS_CONST == IS_CONST) {
5078		op1_str = Z_STR_P(op1);
5079	} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
5080		op1_str = zend_string_copy(Z_STR_P(op1));
5081	} else {
5082		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
5083			GET_OP1_UNDEF_CV(op1, BP_VAR_R);
5084		}
5085		op1_str = _zval_get_string_func(op1);
5086	}
5087	op2 = EX_CONSTANT(opline->op2);
5088	if (IS_CONST == IS_CONST) {
5089		op2_str = Z_STR_P(op2);
5090	} else if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
5091		op2_str = zend_string_copy(Z_STR_P(op2));
5092	} else {
5093		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
5094			GET_OP2_UNDEF_CV(op2, BP_VAR_R);
5095		}
5096		op2_str = _zval_get_string_func(op2);
5097	}
5098	do {
5099		if (IS_CONST != IS_CONST) {
5100			if (UNEXPECTED(ZSTR_LEN(op1_str) == 0)) {
5101				if (IS_CONST == IS_CONST) {
5102					zend_string_addref(op2_str);
5103				}
5104				ZVAL_STR(EX_VAR(opline->result.var), op2_str);
5105				zend_string_release(op1_str);
5106				break;
5107			}
5108		}
5109		if (IS_CONST != IS_CONST) {
5110			if (UNEXPECTED(ZSTR_LEN(op2_str) == 0)) {
5111				if (IS_CONST == IS_CONST) {
5112					zend_string_addref(op1_str);
5113				}
5114				ZVAL_STR(EX_VAR(opline->result.var), op1_str);
5115				zend_string_release(op2_str);
5116				break;
5117			}
5118		}
5119		str = zend_string_alloc(ZSTR_LEN(op1_str) + ZSTR_LEN(op2_str), 0);
5120		memcpy(ZSTR_VAL(str), ZSTR_VAL(op1_str), ZSTR_LEN(op1_str));
5121		memcpy(ZSTR_VAL(str) + ZSTR_LEN(op1_str), ZSTR_VAL(op2_str), ZSTR_LEN(op2_str)+1);
5122		ZVAL_NEW_STR(EX_VAR(opline->result.var), str);
5123		if (IS_CONST != IS_CONST) {
5124			zend_string_release(op1_str);
5125		}
5126		if (IS_CONST != IS_CONST) {
5127			zend_string_release(op2_str);
5128		}
5129	} while (0);
5130
5131
5132	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5133}
5134
5135static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5136{
5137	USE_OPLINE
5138	zval *function_name;
5139
5140	zval *object;
5141	zend_function *fbc;
5142	zend_class_entry *called_scope;
5143	zend_object *obj;
5144	zend_execute_data *call;
5145	uint32_t call_info;
5146
5147	SAVE_OPLINE();
5148
5149	function_name = EX_CONSTANT(opline->op2);
5150
5151	if (IS_CONST != IS_CONST &&
5152	    UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
5153		do {
5154			if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(function_name)) {
5155				function_name = Z_REFVAL_P(function_name);
5156				if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
5157					break;
5158				}
5159			} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
5160				GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
5161				if (UNEXPECTED(EG(exception) != NULL)) {
5162					HANDLE_EXCEPTION();
5163				}
5164			}
5165			zend_throw_error(NULL, "Method name must be a string");
5166
5167
5168			HANDLE_EXCEPTION();
5169		} while (0);
5170	}
5171
5172	object = EX_CONSTANT(opline->op1);
5173
5174	if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
5175		zend_throw_error(NULL, "Using $this when not in object context");
5176
5177		HANDLE_EXCEPTION();
5178	}
5179
5180	if (IS_CONST != IS_UNUSED) {
5181		do {
5182			if (IS_CONST == IS_CONST || UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
5183				if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_ISREF_P(object))) {
5184					object = Z_REFVAL_P(object);
5185					if (EXPECTED(Z_TYPE_P(object) == IS_OBJECT)) {
5186						break;
5187					}
5188				}
5189				if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
5190					object = GET_OP1_UNDEF_CV(object, BP_VAR_R);
5191					if (UNEXPECTED(EG(exception) != NULL)) {
5192
5193						HANDLE_EXCEPTION();
5194					}
5195				}
5196				zend_throw_error(NULL, "Call to a member function %s() on %s", Z_STRVAL_P(function_name), zend_get_type_by_const(Z_TYPE_P(object)));
5197
5198
5199				HANDLE_EXCEPTION();
5200			}
5201		} while (0);
5202	}
5203
5204	obj = Z_OBJ_P(object);
5205	called_scope = obj->ce;
5206
5207	if (IS_CONST != IS_CONST ||
5208	    UNEXPECTED((fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope)) == NULL)) {
5209	    zend_object *orig_obj = obj;
5210
5211		if (UNEXPECTED(obj->handlers->get_method == NULL)) {
5212			zend_throw_error(NULL, "Object does not support method calls");
5213
5214
5215			HANDLE_EXCEPTION();
5216		}
5217
5218		/* First, locate the function. */
5219		fbc = obj->handlers->get_method(&obj, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
5220		if (UNEXPECTED(fbc == NULL)) {
5221			if (EXPECTED(!EG(exception))) {
5222				zend_throw_error(NULL, "Call to undefined method %s::%s()", ZSTR_VAL(obj->ce->name), Z_STRVAL_P(function_name));
5223			}
5224
5225
5226			HANDLE_EXCEPTION();
5227		}
5228		if (IS_CONST == IS_CONST &&
5229		    EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
5230		    EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE))) &&
5231		    EXPECTED(obj == orig_obj)) {
5232			CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), called_scope, fbc);
5233		}
5234		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
5235			init_func_run_time_cache(&fbc->op_array);
5236		}
5237	}
5238
5239	call_info = ZEND_CALL_NESTED_FUNCTION;
5240	if (UNEXPECTED((fbc->common.fn_flags & ZEND_ACC_STATIC) != 0)) {
5241		obj = NULL;
5242	} else if (IS_CONST & (IS_VAR|IS_TMP_VAR|IS_CV)) {
5243		/* CV may be changed indirectly (e.g. when it's a reference) */
5244		call_info = ZEND_CALL_NESTED_FUNCTION | ZEND_CALL_RELEASE_THIS;
5245		GC_REFCOUNT(obj)++; /* For $this pointer */
5246	}
5247
5248	call = zend_vm_stack_push_call_frame(call_info,
5249		fbc, opline->extended_value, called_scope, obj);
5250	call->prev_execute_data = EX(call);
5251	EX(call) = call;
5252
5253
5254	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5255}
5256
5257static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5258{
5259	USE_OPLINE
5260	zval *function_name;
5261	zend_class_entry *ce;
5262	zend_object *object;
5263	zend_function *fbc;
5264	zend_execute_data *call;
5265
5266	SAVE_OPLINE();
5267
5268	if (IS_CONST == IS_CONST) {
5269		/* no function found. try a static method in class */
5270		ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)));
5271		if (UNEXPECTED(ce == NULL)) {
5272			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT |  ZEND_FETCH_CLASS_EXCEPTION);
5273			if (UNEXPECTED(ce == NULL)) {
5274				if (UNEXPECTED(EG(exception) != NULL)) {
5275					HANDLE_EXCEPTION();
5276				}
5277				zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
5278				HANDLE_EXCEPTION();
5279			}
5280			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
5281		}
5282	} else if (IS_CONST == IS_UNUSED) {
5283		ce = zend_fetch_class(NULL, opline->op1.num);
5284		if (UNEXPECTED(ce == NULL)) {
5285			ZEND_ASSERT(EG(exception));
5286
5287			HANDLE_EXCEPTION();
5288		}
5289	} else {
5290		ce = Z_CE_P(EX_VAR(opline->op1.var));
5291	}
5292
5293	if (IS_CONST == IS_CONST &&
5294	    IS_CONST == IS_CONST &&
5295	    EXPECTED((fbc = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) != NULL)) {
5296		/* nothing to do */
5297	} else if (IS_CONST != IS_CONST &&
5298	           IS_CONST == IS_CONST &&
5299	           (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce))) {
5300		/* do nothing */
5301	} else if (IS_CONST != IS_UNUSED) {
5302
5303
5304		function_name = EX_CONSTANT(opline->op2);
5305		if (IS_CONST != IS_CONST) {
5306			if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
5307				do {
5308					if (IS_CONST & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
5309						function_name = Z_REFVAL_P(function_name);
5310						if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
5311							break;
5312						}
5313					} else if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
5314						GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
5315						if (UNEXPECTED(EG(exception) != NULL)) {
5316							HANDLE_EXCEPTION();
5317						}
5318					}
5319					zend_throw_error(NULL, "Function name must be a string");
5320
5321					HANDLE_EXCEPTION();
5322				} while (0);
5323 			}
5324		}
5325
5326		if (ce->get_static_method) {
5327			fbc = ce->get_static_method(ce, Z_STR_P(function_name));
5328		} else {
5329			fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_CONST == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
5330		}
5331		if (UNEXPECTED(fbc == NULL)) {
5332			if (EXPECTED(!EG(exception))) {
5333				zend_throw_error(NULL, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
5334			}
5335
5336			HANDLE_EXCEPTION();
5337		}
5338		if (IS_CONST == IS_CONST &&
5339		    EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
5340		    EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
5341			if (IS_CONST == IS_CONST) {
5342				CACHE_PTR(Z_CACHE_SLOT_P(function_name), fbc);
5343			} else {
5344				CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, fbc);
5345			}
5346		}
5347		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
5348			init_func_run_time_cache(&fbc->op_array);
5349		}
5350		if (IS_CONST != IS_CONST) {
5351
5352		}
5353	} else {
5354		if (UNEXPECTED(ce->constructor == NULL)) {
5355			zend_throw_error(NULL, "Cannot call constructor");
5356			HANDLE_EXCEPTION();
5357		}
5358		if (Z_TYPE(EX(This)) == IS_OBJECT && Z_OBJ(EX(This))->ce != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
5359			zend_throw_error(NULL, "Cannot call private %s::__construct()", ZSTR_VAL(ce->name));
5360			HANDLE_EXCEPTION();
5361		}
5362		fbc = ce->constructor;
5363		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
5364			init_func_run_time_cache(&fbc->op_array);
5365		}
5366	}
5367
5368	object = NULL;
5369	if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
5370		if (Z_TYPE(EX(This)) == IS_OBJECT && instanceof_function(Z_OBJCE(EX(This)), ce)) {
5371			object = Z_OBJ(EX(This));
5372			ce = object->ce;
5373		} else {
5374			if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
5375				/* Allowed for PHP 4 compatibility. */
5376				zend_error(
5377					E_DEPRECATED,
5378					"Non-static method %s::%s() should not be called statically",
5379					ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
5380				if (UNEXPECTED(EG(exception) != NULL)) {
5381					HANDLE_EXCEPTION();
5382				}
5383			} else {
5384				/* An internal function assumes $this is present and won't check that.
5385				 * So PHP would crash by allowing the call. */
5386				zend_throw_error(
5387					zend_ce_error,
5388					"Non-static method %s::%s() cannot be called statically",
5389					ZSTR_VAL(fbc->common.scope->name), ZSTR_VAL(fbc->common.function_name));
5390				HANDLE_EXCEPTION();
5391			}
5392		}
5393	}
5394
5395	if (IS_CONST == IS_UNUSED) {
5396		/* previous opcode is ZEND_FETCH_CLASS */
5397		if ((opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_PARENT ||
5398		    (opline->op1.num & ZEND_FETCH_CLASS_MASK) == ZEND_FETCH_CLASS_SELF) {
5399			if (Z_TYPE(EX(This)) == IS_OBJECT) {
5400				ce = Z_OBJCE(EX(This));
5401			} else {
5402				ce = Z_CE(EX(This));
5403			}
5404		}
5405	}
5406
5407	call = zend_vm_stack_push_call_frame(ZEND_CALL_NESTED_FUNCTION,
5408		fbc, opline->extended_value, ce, object);
5409	call->prev_execute_data = EX(call);
5410	EX(call) = call;
5411
5412	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5413}
5414
5415static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5416{
5417	USE_OPLINE
5418
5419	zval *function_name;
5420	zend_fcall_info_cache fcc;
5421	char *error = NULL;
5422	zend_function *func;
5423	zend_class_entry *called_scope;
5424	zend_object *object;
5425	zend_execute_data *call;
5426	uint32_t call_info = ZEND_CALL_NESTED_FUNCTION;
5427
5428	SAVE_OPLINE();
5429	function_name = EX_CONSTANT(opline->op2);
5430	if (zend_is_callable_ex(function_name, NULL, 0, NULL, &fcc, &error)) {
5431		func = fcc.function_handler;
5432		called_scope = fcc.called_scope;
5433		object = fcc.object;
5434		if (func->common.fn_flags & ZEND_ACC_CLOSURE) {
5435			/* Delay closure destruction until its invocation */
5436			if (IS_CONST & (IS_VAR|IS_CV)) {
5437				ZVAL_DEREF(function_name);
5438			}
5439			ZEND_ASSERT(GC_TYPE((zend_object*)func->common.prototype) == IS_OBJECT);
5440			GC_REFCOUNT((zend_object*)func->common.prototype)++;
5441			call_info |= ZEND_CALL_CLOSURE;
5442		} else if (object) {
5443			call_info |= ZEND_CALL_RELEASE_THIS;
5444			GC_REFCOUNT(object)++; /* For $this pointer */
5445		}
5446		if (error) {
5447			efree(error);
5448			/* This is the only soft error is_callable() can generate */
5449			zend_error(E_DEPRECATED,
5450				"Non-static method %s::%s() should not be called statically",
5451				ZSTR_VAL(func->common.scope->name), ZSTR_VAL(func->common.function_name));
5452			if (UNEXPECTED(EG(exception) != NULL)) {
5453				HANDLE_EXCEPTION();
5454			}
5455		}
5456		if (EXPECTED(func->type == ZEND_USER_FUNCTION) && UNEXPECTED(!func->op_array.run_time_cache)) {
5457			init_func_run_time_cache(&func->op_array);
5458		}
5459	} else {
5460		zend_internal_type_error(EX_USES_STRICT_TYPES(), "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(EX_CONSTANT(opline->op1)), error);
5461		efree(error);
5462		func = (zend_function*)&zend_pass_function;
5463		called_scope = NULL;
5464		object = NULL;
5465	}
5466
5467	call = zend_vm_stack_push_call_frame(call_info,
5468		func, opline->extended_value, called_scope, object);
5469	call->prev_execute_data = EX(call);
5470	EX(call) = call;
5471
5472	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5473}
5474
5475static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CASE_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5476{
5477	USE_OPLINE
5478
5479	zval *op1, *op2, *result;
5480
5481	op1 = EX_CONSTANT(opline->op1);
5482	op2 = EX_CONSTANT(opline->op2);
5483	do {
5484		int result;
5485
5486		if (EXPECTED(Z_TYPE_P(op1) == IS_LONG)) {
5487			if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
5488				result = (Z_LVAL_P(op1) == Z_LVAL_P(op2));
5489			} else if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
5490				result = ((double)Z_LVAL_P(op1) == Z_DVAL_P(op2));
5491			} else {
5492				break;
5493			}
5494		} else if (EXPECTED(Z_TYPE_P(op1) == IS_DOUBLE)) {
5495			if (EXPECTED(Z_TYPE_P(op2) == IS_DOUBLE)) {
5496				result = (Z_DVAL_P(op1) == Z_DVAL_P(op2));
5497			} else if (EXPECTED(Z_TYPE_P(op2) == IS_LONG)) {
5498				result = (Z_DVAL_P(op1) == ((double)Z_LVAL_P(op2)));
5499			} else {
5500				break;
5501			}
5502		} else if (EXPECTED(Z_TYPE_P(op1) == IS_STRING)) {
5503			if (EXPECTED(Z_TYPE_P(op2) == IS_STRING)) {
5504				if (Z_STR_P(op1) == Z_STR_P(op2)) {
5505					result = 1;
5506				} else if (Z_STRVAL_P(op1)[0] > '9' || Z_STRVAL_P(op2)[0] > '9') {
5507					if (Z_STRLEN_P(op1) != Z_STRLEN_P(op2)) {
5508						result = 0;
5509					} else {
5510						result = (memcmp(Z_STRVAL_P(op1), Z_STRVAL_P(op2), Z_STRLEN_P(op1)) == 0);
5511					}
5512				} else {
5513					result = (zendi_smart_strcmp(Z_STR_P(op1), Z_STR_P(op2)) == 0);
5514				}
5515
5516			} else {
5517				break;
5518			}
5519		} else {
5520			break;
5521		}
5522		ZEND_VM_SMART_BRANCH(result, 0);
5523		ZVAL_BOOL(EX_VAR(opline->result.var), result);
5524		ZEND_VM_NEXT_OPCODE();
5525	} while (0);
5526
5527	SAVE_OPLINE();
5528	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op1) == IS_UNDEF)) {
5529		op1 = GET_OP1_UNDEF_CV(op1, BP_VAR_R);
5530	} else if ((IS_CONST & IS_VAR) && UNEXPECTED(Z_ISREF_P(op1))) {
5531		/* Don't keep lock on reference, lock the value instead */
5532		if (UNEXPECTED(Z_REFCOUNT_P(op1) == 1)) {
5533			ZVAL_UNREF(op1);
5534		} else {
5535			Z_DELREF_P(op1);
5536			ZVAL_COPY(op1, Z_REFVAL_P(op1));
5537		}
5538	}
5539	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(op2) == IS_UNDEF)) {
5540		op2 = GET_OP2_UNDEF_CV(op2, BP_VAR_R);
5541	}
5542	result = EX_VAR(opline->result.var);
5543	compare_function(result, op1, op2);
5544	ZVAL_BOOL(result, Z_LVAL_P(result) == 0);
5545
5546	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5547}
5548
5549static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_CLASS_CONSTANT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5550{
5551	zend_class_entry *ce, *scope;
5552	zend_class_constant *c;
5553	zval *value;
5554	USE_OPLINE
5555
5556	SAVE_OPLINE();
5557
5558	do {
5559		if (IS_CONST == IS_CONST) {
5560			if (EXPECTED(CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2))))) {
5561				value = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
5562#ifdef ZTS
5563				ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)));
5564#endif
5565				break;
5566			} else if (EXPECTED(CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1))))) {
5567				ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)));
5568			} else {
5569				ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
5570				if (UNEXPECTED(ce == NULL)) {
5571					if (EXPECTED(!EG(exception))) {
5572						zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
5573					}
5574					HANDLE_EXCEPTION();
5575				}
5576				CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
5577			}
5578		} else {
5579			if (IS_CONST == IS_UNUSED) {
5580				ce = zend_fetch_class(NULL, opline->op1.num);
5581				if (UNEXPECTED(ce == NULL)) {
5582					ZEND_ASSERT(EG(exception));
5583					HANDLE_EXCEPTION();
5584				}
5585			} else {
5586				ce = Z_CE_P(EX_VAR(opline->op1.var));
5587			}
5588			if ((value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce)) != NULL) {
5589				break;
5590			}
5591		}
5592
5593		if (EXPECTED((c = zend_hash_find_ptr(&ce->constants_table, Z_STR_P(EX_CONSTANT(opline->op2)))) != NULL)) {
5594			scope = EX(func)->op_array.scope;
5595			if (!zend_verify_const_access(c, scope)) {
5596				zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(ce->name), Z_STRVAL_P(EX_CONSTANT(opline->op2)));
5597				HANDLE_EXCEPTION();
5598			}
5599			value = &c->value;
5600			if (Z_CONSTANT_P(value)) {
5601				zval_update_constant_ex(value, ce);
5602				if (UNEXPECTED(EG(exception) != NULL)) {
5603					HANDLE_EXCEPTION();
5604				}
5605			}
5606			if (IS_CONST == IS_CONST) {
5607				CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), value);
5608			} else {
5609				CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce, value);
5610			}
5611		} else {
5612			zend_throw_error(NULL, "Undefined class constant '%s'", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
5613			HANDLE_EXCEPTION();
5614		}
5615	} while (0);
5616
5617#ifdef ZTS
5618	if (ce->type == ZEND_INTERNAL_CLASS) {
5619		ZVAL_DUP(EX_VAR(opline->result.var), value);
5620	} else {
5621		ZVAL_COPY(EX_VAR(opline->result.var), value);
5622	}
5623#else
5624	ZVAL_COPY(EX_VAR(opline->result.var), value);
5625#endif
5626
5627	ZEND_VM_NEXT_OPCODE();
5628}
5629
5630static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5631{
5632	USE_OPLINE
5633
5634	zval *expr_ptr, new_expr;
5635
5636	SAVE_OPLINE();
5637	if ((IS_CONST == IS_VAR || IS_CONST == IS_CV) &&
5638	    UNEXPECTED(opline->extended_value & ZEND_ARRAY_ELEMENT_REF)) {
5639		expr_ptr = NULL;
5640		ZVAL_MAKE_REF(expr_ptr);
5641		Z_ADDREF_P(expr_ptr);
5642
5643	} else {
5644		expr_ptr = EX_CONSTANT(opline->op1);
5645		if (IS_CONST == IS_TMP_VAR) {
5646			/* pass */
5647		} else if (IS_CONST == IS_CONST) {
5648			if (UNEXPECTED(Z_OPT_COPYABLE_P(expr_ptr))) {
5649				ZVAL_COPY_VALUE(&new_expr, expr_ptr);
5650				zval_copy_ctor_func(&new_expr);
5651				expr_ptr = &new_expr;
5652			}
5653		} else if (IS_CONST == IS_CV) {
5654			ZVAL_DEREF(expr_ptr);
5655			if (Z_REFCOUNTED_P(expr_ptr)) {
5656				Z_ADDREF_P(expr_ptr);
5657			}
5658		} else /* if (IS_CONST == IS_VAR) */ {
5659			if (UNEXPECTED(Z_ISREF_P(expr_ptr))) {
5660				zend_refcounted *ref = Z_COUNTED_P(expr_ptr);
5661
5662				expr_ptr = Z_REFVAL_P(expr_ptr);
5663				if (UNEXPECTED(--GC_REFCOUNT(ref) == 0)) {
5664					ZVAL_COPY_VALUE(&new_expr, expr_ptr);
5665					expr_ptr = &new_expr;
5666					efree_size(ref, sizeof(zend_reference));
5667				} else if (Z_OPT_REFCOUNTED_P(expr_ptr)) {
5668					Z_ADDREF_P(expr_ptr);
5669				}
5670			}
5671		}
5672	}
5673
5674	if (IS_CONST != IS_UNUSED) {
5675
5676		zval *offset = EX_CONSTANT(opline->op2);
5677		zend_string *str;
5678		zend_ulong hval;
5679
5680add_again:
5681		if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
5682			str = Z_STR_P(offset);
5683			if (IS_CONST != IS_CONST) {
5684				if (ZEND_HANDLE_NUMERIC(str, hval)) {
5685					goto num_index;
5686				}
5687			}
5688str_index:
5689			zend_hash_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), str, expr_ptr);
5690		} else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
5691			hval = Z_LVAL_P(offset);
5692num_index:
5693			zend_hash_index_update(Z_ARRVAL_P(EX_VAR(opline->result.var)), hval, expr_ptr);
5694		} else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_TYPE_P(offset) == IS_REFERENCE)) {
5695			offset = Z_REFVAL_P(offset);
5696			goto add_again;
5697		} else if (Z_TYPE_P(offset) == IS_NULL) {
5698			str = ZSTR_EMPTY_ALLOC();
5699			goto str_index;
5700		} else if (Z_TYPE_P(offset) == IS_DOUBLE) {
5701			hval = zend_dval_to_lval(Z_DVAL_P(offset));
5702			goto num_index;
5703		} else if (Z_TYPE_P(offset) == IS_FALSE) {
5704			hval = 0;
5705			goto num_index;
5706		} else if (Z_TYPE_P(offset) == IS_TRUE) {
5707			hval = 1;
5708			goto num_index;
5709		} else if (IS_CONST == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
5710			GET_OP2_UNDEF_CV(offset, BP_VAR_R);
5711			str = ZSTR_EMPTY_ALLOC();
5712			goto str_index;
5713		} else {
5714			zend_error(E_WARNING, "Illegal offset type");
5715			zval_ptr_dtor(expr_ptr);
5716		}
5717
5718	} else {
5719		zend_hash_next_index_insert(Z_ARRVAL_P(EX_VAR(opline->result.var)), expr_ptr);
5720	}
5721	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5722}
5723
5724static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_ARRAY_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5725{
5726	zval *array;
5727	uint32_t size;
5728	USE_OPLINE
5729
5730	array = EX_VAR(opline->result.var);
5731	if (IS_CONST != IS_UNUSED) {
5732		size = opline->extended_value >> ZEND_ARRAY_SIZE_SHIFT;
5733	} else {
5734		size = 0;
5735	}
5736	ZVAL_NEW_ARR(array);
5737	zend_hash_init(Z_ARRVAL_P(array), size, NULL, ZVAL_PTR_DTOR, 0);
5738
5739	if (IS_CONST != IS_UNUSED) {
5740		/* Explicitly initialize array as not-packed if flag is set */
5741		if (opline->extended_value & ZEND_ARRAY_NOT_PACKED) {
5742			zend_hash_real_init(Z_ARRVAL_P(array), 0);
5743		}
5744	}
5745
5746	if (IS_CONST == IS_UNUSED) {
5747		ZEND_VM_NEXT_OPCODE();
5748#if 0 || (IS_CONST != IS_UNUSED)
5749	} else {
5750		ZEND_VM_TAIL_CALL(ZEND_ADD_ARRAY_ELEMENT_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU));
5751#endif
5752	}
5753}
5754
5755static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5756{
5757	USE_OPLINE
5758	zval tmp, *varname;
5759	zend_class_entry *ce;
5760
5761
5762	SAVE_OPLINE();
5763
5764	varname = EX_CONSTANT(opline->op1);
5765
5766	ZVAL_UNDEF(&tmp);
5767	if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
5768		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
5769			varname = GET_OP1_UNDEF_CV(varname, BP_VAR_R);
5770		}
5771		ZVAL_STR(&tmp, zval_get_string(varname));
5772		varname = &tmp;
5773	}
5774
5775	if (IS_CONST == IS_CONST) {
5776		ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
5777		if (UNEXPECTED(ce == NULL)) {
5778			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
5779			if (UNEXPECTED(ce == NULL)) {
5780				if (EXPECTED(!EG(exception))) {
5781					zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
5782				}
5783				if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
5784					zend_string_release(Z_STR(tmp));
5785				}
5786
5787				HANDLE_EXCEPTION();
5788			}
5789			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
5790		}
5791	} else if (IS_CONST == IS_UNUSED) {
5792		ce = zend_fetch_class(NULL, opline->op2.num);
5793		if (UNEXPECTED(ce == NULL)) {
5794			ZEND_ASSERT(EG(exception));
5795			if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
5796				zend_string_release(Z_STR(tmp));
5797			}
5798
5799			HANDLE_EXCEPTION();
5800		}
5801	} else {
5802		ce = Z_CE_P(EX_VAR(opline->op2.var));
5803	}
5804	zend_std_unset_static_property(ce, Z_STR_P(varname));
5805
5806	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
5807		zend_string_release(Z_STR(tmp));
5808	}
5809
5810	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5811}
5812
5813static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5814{
5815	USE_OPLINE
5816	zval *value;
5817	int result;
5818
5819	zval tmp, *varname;
5820	zend_class_entry *ce;
5821
5822	SAVE_OPLINE();
5823	varname = EX_CONSTANT(opline->op1);
5824	ZVAL_UNDEF(&tmp);
5825	if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
5826		ZVAL_STR(&tmp, zval_get_string(varname));
5827		varname = &tmp;
5828	}
5829
5830	if (IS_CONST == IS_CONST) {
5831		if (IS_CONST == IS_CONST && EXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)))) != NULL)) {
5832			value = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)) + sizeof(void*));
5833
5834			/* check if static properties were destoyed */
5835			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
5836				value = NULL;
5837			}
5838
5839			goto is_static_prop_return;
5840		} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
5841			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
5842			if (UNEXPECTED(ce == NULL)) {
5843				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5844			}
5845			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
5846		}
5847	} else {
5848		if (IS_CONST == IS_UNUSED) {
5849			ce = zend_fetch_class(NULL, opline->op2.num);
5850			if (UNEXPECTED(ce == NULL)) {
5851				ZEND_ASSERT(EG(exception));
5852				if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
5853					zend_string_release(Z_STR(tmp));
5854				}
5855
5856				HANDLE_EXCEPTION();
5857			}
5858		} else {
5859			ce = Z_CE_P(EX_VAR(opline->op2.var));
5860		}
5861		if (IS_CONST == IS_CONST &&
5862		    (value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce)) != NULL) {
5863
5864			/* check if static properties were destoyed */
5865			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
5866				value = NULL;
5867			}
5868
5869			goto is_static_prop_return;
5870		}
5871	}
5872
5873	value = zend_std_get_static_property(ce, Z_STR_P(varname), 1);
5874
5875	if (IS_CONST == IS_CONST && value) {
5876		CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, value);
5877	}
5878
5879	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
5880		zend_string_release(Z_STR(tmp));
5881	}
5882
5883is_static_prop_return:
5884	if (opline->extended_value & ZEND_ISSET) {
5885		result = value && Z_TYPE_P(value) > IS_NULL &&
5886		    (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
5887	} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
5888		result = !value || !i_zend_is_true(value);
5889	}
5890
5891	ZEND_VM_SMART_BRANCH(result, 1);
5892	ZVAL_BOOL(EX_VAR(opline->result.var), result);
5893	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
5894}
5895
5896static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_DIM_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
5897{
5898	USE_OPLINE
5899
5900	zval *container;
5901	int result;
5902	zend_ulong hval;
5903	zval *offset;
5904
5905	SAVE_OPLINE();
5906	container = EX_CONSTANT(opline->op1);
5907
5908	if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
5909		zend_throw_error(NULL, "Using $this when not in object context");
5910
5911		HANDLE_EXCEPTION();
5912	}
5913
5914	offset = EX_CONSTANT(opline->op2);
5915
5916	if (IS_CONST != IS_UNUSED && EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
5917		HashTable *ht;
5918		zval *value;
5919		zend_string *str;
5920
5921isset_dim_obj_array:
5922		ht = Z_ARRVAL_P(container);
5923isset_again:
5924		if (EXPECTED(Z_TYPE_P(offset) == IS_STRING)) {
5925			str = Z_STR_P(offset);
5926			if (IS_CONST != IS_CONST) {
5927				if (ZEND_HANDLE_NUMERIC(str, hval)) {
5928					goto num_index_prop;
5929				}
5930			}
5931str_index_prop:
5932			value = zend_hash_find_ind(ht, str);
5933		} else if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
5934			hval = Z_LVAL_P(offset);
5935num_index_prop:
5936			value = zend_hash_index_find(ht, hval);
5937		} else if ((IS_CONST & (IS_VAR|IS_CV)) && EXPECTED(Z_ISREF_P(offset))) {
5938			offset = Z_REFVAL_P(offset);
5939			goto isset_again;
5940		} else if (Z_TYPE_P(offset) == IS_DOUBLE) {
5941			hval = zend_dval_to_lval(Z_DVAL_P(offset));
5942			goto num_index_prop;
5943		} else if (Z_TYPE_P(offset) == IS_NULL) {
5944			str = ZSTR_EMPTY_ALLOC();
5945			goto str_index_prop;
5946		} else if (Z_TYPE_P(offset) == IS_FALSE) {
5947			hval = 0;
5948			goto num_index_prop;
5949		} else if (Z_TYPE_P(offset) == IS_TRUE) {
5950			hval = 1;
5951			goto num_index_prop;
5952		} else if (Z_TYPE_P(offset) == IS_RESOURCE) {
5953			hval = Z_RES_HANDLE_P(offset);
5954			goto num_index_prop;
5955		} else if (IS_CONST == IS_CV && Z_TYPE_P(offset) == IS_UNDEF) {
5956			GET_OP2_UNDEF_CV(offset, BP_VAR_R);
5957			str = ZSTR_EMPTY_ALLOC();
5958			goto str_index_prop;
5959		} else {
5960			zend_error(E_WARNING, "Illegal offset type in isset or empty");
5961			goto isset_not_found;
5962		}
5963
5964		if (opline->extended_value & ZEND_ISSET) {
5965			/* > IS_NULL means not IS_UNDEF and not IS_NULL */
5966			result = value != NULL && Z_TYPE_P(value) > IS_NULL &&
5967			    (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
5968		} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
5969			result = (value == NULL || !i_zend_is_true(value));
5970		}
5971		goto isset_dim_obj_exit;
5972	} else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(container)) {
5973		container = Z_REFVAL_P(container);
5974		if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
5975			goto isset_dim_obj_array;
5976		}
5977	}
5978
5979	if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(offset) == IS_UNDEF)) {
5980		offset = GET_OP2_UNDEF_CV(offset, BP_VAR_R);
5981	}
5982
5983	if (IS_CONST == IS_UNUSED ||
5984	    (IS_CONST != IS_CONST && EXPECTED(Z_TYPE_P(container) == IS_OBJECT))) {
5985		if (EXPECTED(Z_OBJ_HT_P(container)->has_dimension)) {
5986			result =
5987				((opline->extended_value & ZEND_ISSET) == 0) ^
5988				Z_OBJ_HT_P(container)->has_dimension(container, offset, (opline->extended_value & ZEND_ISSET) == 0);
5989		} else {
5990			zend_error(E_NOTICE, "Trying to check element of non-array");
5991			goto isset_not_found;
5992		}
5993	} else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) { /* string offsets */
5994		zend_long lval;
5995
5996		if (EXPECTED(Z_TYPE_P(offset) == IS_LONG)) {
5997			lval = Z_LVAL_P(offset);
5998isset_str_offset:
5999			if (UNEXPECTED(lval < 0)) { /* Handle negative offset */
6000				lval += (zend_long)Z_STRLEN_P(container);
6001			}
6002			if (EXPECTED(lval >= 0) && (size_t)lval < Z_STRLEN_P(container)) {
6003				if (opline->extended_value & ZEND_ISSET) {
6004					result = 1;
6005				} else {
6006					result = (Z_STRVAL_P(container)[lval] == '0');
6007				}
6008			} else {
6009				goto isset_not_found;
6010			}
6011		} else {
6012			if (IS_CONST & (IS_CV|IS_VAR)) {
6013				ZVAL_DEREF(offset);
6014			}
6015			if (Z_TYPE_P(offset) < IS_STRING /* simple scalar types */
6016					|| (Z_TYPE_P(offset) == IS_STRING /* or numeric string */
6017						&& IS_LONG == is_numeric_string(Z_STRVAL_P(offset), Z_STRLEN_P(offset), NULL, NULL, 0))) {
6018				lval = zval_get_long(offset);
6019				goto isset_str_offset;
6020			}
6021			goto isset_not_found;
6022		}
6023	} else {
6024isset_not_found:
6025		result = ((opline->extended_value & ZEND_ISSET) == 0);
6026	}
6027
6028isset_dim_obj_exit:
6029
6030
6031	ZEND_VM_SMART_BRANCH(result, 1);
6032	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6033	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6034}
6035
6036static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_PROP_OBJ_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6037{
6038	USE_OPLINE
6039
6040	zval *container;
6041	int result;
6042	zval *offset;
6043
6044	SAVE_OPLINE();
6045	container = EX_CONSTANT(opline->op1);
6046
6047	if (IS_CONST == IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) == IS_UNDEF)) {
6048		zend_throw_error(NULL, "Using $this when not in object context");
6049
6050		HANDLE_EXCEPTION();
6051	}
6052
6053	offset = EX_CONSTANT(opline->op2);
6054
6055	if (IS_CONST == IS_CONST ||
6056	    (IS_CONST != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT))) {
6057		if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(container)) {
6058			container = Z_REFVAL_P(container);
6059			if (UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
6060				goto isset_no_object;
6061			}
6062		} else {
6063			goto isset_no_object;
6064		}
6065	}
6066	if (UNEXPECTED(!Z_OBJ_HT_P(container)->has_property)) {
6067		zend_error(E_NOTICE, "Trying to check property of non-object");
6068isset_no_object:
6069		result = ((opline->extended_value & ZEND_ISSET) == 0);
6070	} else {
6071		result =
6072			((opline->extended_value & ZEND_ISSET) == 0) ^
6073			Z_OBJ_HT_P(container)->has_property(container, offset, (opline->extended_value & ZEND_ISSET) == 0, ((IS_CONST == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(offset)) : NULL));
6074	}
6075
6076
6077	ZEND_VM_SMART_BRANCH(result, 1);
6078	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6079	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6080}
6081
6082static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_DECLARE_CONST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6083{
6084	USE_OPLINE
6085
6086	zval *name;
6087	zval *val;
6088	zend_constant c;
6089
6090	SAVE_OPLINE();
6091	name  = EX_CONSTANT(opline->op1);
6092	val   = EX_CONSTANT(opline->op2);
6093
6094	ZVAL_COPY(&c.value, val);
6095	if (Z_OPT_CONSTANT(c.value)) {
6096		if (UNEXPECTED(zval_update_constant_ex(&c.value, EX(func)->op_array.scope) != SUCCESS)) {
6097
6098
6099			HANDLE_EXCEPTION();
6100		}
6101	}
6102	c.flags = CONST_CS; /* non persistent, case sensetive */
6103	c.name = zend_string_dup(Z_STR_P(name), 0);
6104	c.module_number = PHP_USER_CONSTANT;
6105
6106	if (zend_register_constant(&c) == FAILURE) {
6107	}
6108
6109
6110	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6111}
6112
6113static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6114{
6115	USE_OPLINE
6116
6117	zend_generator *generator = zend_get_running_generator(execute_data);
6118
6119	SAVE_OPLINE();
6120	if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
6121		zend_throw_error(NULL, "Cannot yield from finally in a force-closed generator");
6122
6123
6124		HANDLE_EXCEPTION();
6125	}
6126
6127	/* Destroy the previously yielded value */
6128	zval_ptr_dtor(&generator->value);
6129
6130	/* Destroy the previously yielded key */
6131	zval_ptr_dtor(&generator->key);
6132
6133	/* Set the new yielded value */
6134	if (IS_CONST != IS_UNUSED) {
6135
6136
6137		if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
6138			/* Constants and temporary variables aren't yieldable by reference,
6139			 * but we still allow them with a notice. */
6140			if (IS_CONST & (IS_CONST|IS_TMP_VAR)) {
6141				zval *value;
6142
6143				zend_error(E_NOTICE, "Only variable references should be yielded by reference");
6144
6145				value = EX_CONSTANT(opline->op1);
6146				ZVAL_COPY_VALUE(&generator->value, value);
6147				if (IS_CONST == IS_CONST) {
6148					if (UNEXPECTED(Z_OPT_COPYABLE(generator->value))) {
6149						zval_copy_ctor_func(&generator->value);
6150					}
6151				}
6152			} else {
6153				zval *value_ptr = NULL;
6154
6155				/* If a function call result is yielded and the function did
6156				 * not return by reference we throw a notice. */
6157				if (IS_CONST == IS_VAR &&
6158				    (value_ptr == &EG(uninitialized_zval) ||
6159				     (opline->extended_value == ZEND_RETURNS_FUNCTION &&
6160				      !Z_ISREF_P(value_ptr)))) {
6161					zend_error(E_NOTICE, "Only variable references should be yielded by reference");
6162				} else {
6163					ZVAL_MAKE_REF(value_ptr);
6164				}
6165				ZVAL_COPY(&generator->value, value_ptr);
6166
6167			}
6168		} else {
6169			zval *value = EX_CONSTANT(opline->op1);
6170
6171			/* Consts, temporary variables and references need copying */
6172			if (IS_CONST == IS_CONST) {
6173				ZVAL_COPY_VALUE(&generator->value, value);
6174				if (UNEXPECTED(Z_OPT_COPYABLE(generator->value))) {
6175					zval_copy_ctor_func(&generator->value);
6176				}
6177			} else if (IS_CONST == IS_TMP_VAR) {
6178				ZVAL_COPY_VALUE(&generator->value, value);
6179            } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
6180				ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
6181
6182			} else {
6183				ZVAL_COPY_VALUE(&generator->value, value);
6184				if (IS_CONST == IS_CV) {
6185					if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
6186				}
6187			}
6188		}
6189	} else {
6190		/* If no value was specified yield null */
6191		ZVAL_NULL(&generator->value);
6192	}
6193
6194	/* Set the new yielded key */
6195	if (IS_CONST != IS_UNUSED) {
6196
6197		zval *key = EX_CONSTANT(opline->op2);
6198
6199		/* Consts, temporary variables and references need copying */
6200		if (IS_CONST == IS_CONST) {
6201			ZVAL_COPY_VALUE(&generator->key, key);
6202			if (UNEXPECTED(Z_OPT_COPYABLE(generator->key))) {
6203				zval_copy_ctor_func(&generator->key);
6204			}
6205		} else if (IS_CONST == IS_TMP_VAR) {
6206			ZVAL_COPY_VALUE(&generator->key, key);
6207		} else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
6208			ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
6209
6210		} else {
6211			ZVAL_COPY_VALUE(&generator->key, key);
6212			if (IS_CONST == IS_CV) {
6213				if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
6214			}
6215		}
6216
6217		if (Z_TYPE(generator->key) == IS_LONG
6218		    && Z_LVAL(generator->key) > generator->largest_used_integer_key
6219		) {
6220			generator->largest_used_integer_key = Z_LVAL(generator->key);
6221		}
6222	} else {
6223		/* If no key was specified we use auto-increment keys */
6224		generator->largest_used_integer_key++;
6225		ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
6226	}
6227
6228	if (RETURN_VALUE_USED(opline)) {
6229		/* If the return value of yield is used set the send
6230		 * target and initialize it to NULL */
6231		generator->send_target = EX_VAR(opline->result.var);
6232		ZVAL_NULL(generator->send_target);
6233	} else {
6234		generator->send_target = NULL;
6235	}
6236
6237	/* We increment to the next op, so we are at the correct position when the
6238	 * generator is resumed. */
6239	ZEND_VM_INC_OPCODE();
6240
6241	/* The GOTO VM uses a local opline variable. We need to set the opline
6242	 * variable in execute_data so we don't resume at an old position. */
6243	SAVE_OPLINE();
6244
6245	ZEND_VM_RETURN();
6246}
6247
6248static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6249{
6250	USE_OPLINE
6251	zend_free_op free_op2;
6252	zval *op1, *op2;
6253	int result;
6254
6255	SAVE_OPLINE();
6256	op1 = EX_CONSTANT(opline->op1);
6257	op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
6258	result = fast_is_identical_function(op1, op2);
6259
6260	zval_ptr_dtor_nogc(free_op2);
6261	ZEND_VM_SMART_BRANCH(result, 1);
6262	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6263	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6264}
6265
6266static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6267{
6268	USE_OPLINE
6269	zend_free_op free_op2;
6270	zval *op1, *op2;
6271	int result;
6272
6273	SAVE_OPLINE();
6274	op1 = EX_CONSTANT(opline->op1);
6275	op2 = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
6276	result = fast_is_not_identical_function(op1, op2);
6277
6278	zval_ptr_dtor_nogc(free_op2);
6279	ZEND_VM_SMART_BRANCH(result, 1);
6280	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6281	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6282}
6283
6284static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6285{
6286	USE_OPLINE
6287
6288	zend_generator *generator = zend_get_running_generator(execute_data);
6289
6290	SAVE_OPLINE();
6291	if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
6292		zend_throw_error(NULL, "Cannot yield from finally in a force-closed generator");
6293		zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
6294
6295		HANDLE_EXCEPTION();
6296	}
6297
6298	/* Destroy the previously yielded value */
6299	zval_ptr_dtor(&generator->value);
6300
6301	/* Destroy the previously yielded key */
6302	zval_ptr_dtor(&generator->key);
6303
6304	/* Set the new yielded value */
6305	if (IS_CONST != IS_UNUSED) {
6306
6307
6308		if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
6309			/* Constants and temporary variables aren't yieldable by reference,
6310			 * but we still allow them with a notice. */
6311			if (IS_CONST & (IS_CONST|IS_TMP_VAR)) {
6312				zval *value;
6313
6314				zend_error(E_NOTICE, "Only variable references should be yielded by reference");
6315
6316				value = EX_CONSTANT(opline->op1);
6317				ZVAL_COPY_VALUE(&generator->value, value);
6318				if (IS_CONST == IS_CONST) {
6319					if (UNEXPECTED(Z_OPT_COPYABLE(generator->value))) {
6320						zval_copy_ctor_func(&generator->value);
6321					}
6322				}
6323			} else {
6324				zval *value_ptr = NULL;
6325
6326				/* If a function call result is yielded and the function did
6327				 * not return by reference we throw a notice. */
6328				if (IS_CONST == IS_VAR &&
6329				    (value_ptr == &EG(uninitialized_zval) ||
6330				     (opline->extended_value == ZEND_RETURNS_FUNCTION &&
6331				      !Z_ISREF_P(value_ptr)))) {
6332					zend_error(E_NOTICE, "Only variable references should be yielded by reference");
6333				} else {
6334					ZVAL_MAKE_REF(value_ptr);
6335				}
6336				ZVAL_COPY(&generator->value, value_ptr);
6337
6338			}
6339		} else {
6340			zval *value = EX_CONSTANT(opline->op1);
6341
6342			/* Consts, temporary variables and references need copying */
6343			if (IS_CONST == IS_CONST) {
6344				ZVAL_COPY_VALUE(&generator->value, value);
6345				if (UNEXPECTED(Z_OPT_COPYABLE(generator->value))) {
6346					zval_copy_ctor_func(&generator->value);
6347				}
6348			} else if (IS_CONST == IS_TMP_VAR) {
6349				ZVAL_COPY_VALUE(&generator->value, value);
6350            } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
6351				ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
6352
6353			} else {
6354				ZVAL_COPY_VALUE(&generator->value, value);
6355				if (IS_CONST == IS_CV) {
6356					if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
6357				}
6358			}
6359		}
6360	} else {
6361		/* If no value was specified yield null */
6362		ZVAL_NULL(&generator->value);
6363	}
6364
6365	/* Set the new yielded key */
6366	if (IS_TMP_VAR != IS_UNUSED) {
6367		zend_free_op free_op2;
6368		zval *key = _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2);
6369
6370		/* Consts, temporary variables and references need copying */
6371		if (IS_TMP_VAR == IS_CONST) {
6372			ZVAL_COPY_VALUE(&generator->key, key);
6373			if (UNEXPECTED(Z_OPT_COPYABLE(generator->key))) {
6374				zval_copy_ctor_func(&generator->key);
6375			}
6376		} else if (IS_TMP_VAR == IS_TMP_VAR) {
6377			ZVAL_COPY_VALUE(&generator->key, key);
6378		} else if ((IS_TMP_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
6379			ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
6380
6381		} else {
6382			ZVAL_COPY_VALUE(&generator->key, key);
6383			if (IS_TMP_VAR == IS_CV) {
6384				if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
6385			}
6386		}
6387
6388		if (Z_TYPE(generator->key) == IS_LONG
6389		    && Z_LVAL(generator->key) > generator->largest_used_integer_key
6390		) {
6391			generator->largest_used_integer_key = Z_LVAL(generator->key);
6392		}
6393	} else {
6394		/* If no key was specified we use auto-increment keys */
6395		generator->largest_used_integer_key++;
6396		ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
6397	}
6398
6399	if (RETURN_VALUE_USED(opline)) {
6400		/* If the return value of yield is used set the send
6401		 * target and initialize it to NULL */
6402		generator->send_target = EX_VAR(opline->result.var);
6403		ZVAL_NULL(generator->send_target);
6404	} else {
6405		generator->send_target = NULL;
6406	}
6407
6408	/* We increment to the next op, so we are at the correct position when the
6409	 * generator is resumed. */
6410	ZEND_VM_INC_OPCODE();
6411
6412	/* The GOTO VM uses a local opline variable. We need to set the opline
6413	 * variable in execute_data so we don't resume at an old position. */
6414	SAVE_OPLINE();
6415
6416	ZEND_VM_RETURN();
6417}
6418
6419static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6420{
6421	USE_OPLINE
6422	zend_free_op free_op2;
6423	zval *op1, *op2;
6424	int result;
6425
6426	SAVE_OPLINE();
6427	op1 = EX_CONSTANT(opline->op1);
6428	op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
6429	result = fast_is_identical_function(op1, op2);
6430
6431	zval_ptr_dtor_nogc(free_op2);
6432	ZEND_VM_SMART_BRANCH(result, 1);
6433	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6434	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6435}
6436
6437static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_IS_NOT_IDENTICAL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6438{
6439	USE_OPLINE
6440	zend_free_op free_op2;
6441	zval *op1, *op2;
6442	int result;
6443
6444	SAVE_OPLINE();
6445	op1 = EX_CONSTANT(opline->op1);
6446	op2 = _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2);
6447	result = fast_is_not_identical_function(op1, op2);
6448
6449	zval_ptr_dtor_nogc(free_op2);
6450	ZEND_VM_SMART_BRANCH(result, 1);
6451	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6452	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6453}
6454
6455static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_CONST_VAR(int type ZEND_OPCODE_HANDLER_ARGS_DC)
6456{
6457	USE_OPLINE
6458
6459	zval *varname;
6460	zval *retval;
6461	zend_string *name;
6462	zend_class_entry *ce;
6463
6464	SAVE_OPLINE();
6465	varname = EX_CONSTANT(opline->op1);
6466
6467 	if (IS_CONST == IS_CONST) {
6468		name = Z_STR_P(varname);
6469	} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
6470		name = Z_STR_P(varname);
6471		zend_string_addref(name);
6472	} else {
6473		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
6474			GET_OP1_UNDEF_CV(varname, BP_VAR_R);
6475		}
6476		name = zval_get_string(varname);
6477	}
6478
6479	if (IS_VAR == IS_CONST) {
6480		if (IS_CONST == IS_CONST && EXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)))) != NULL)) {
6481			retval = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)) + sizeof(void*));
6482
6483			/* check if static properties were destoyed */
6484			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
6485				zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
6486
6487				HANDLE_EXCEPTION();
6488			}
6489
6490			goto fetch_static_prop_return;
6491		} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
6492			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
6493			if (UNEXPECTED(ce == NULL)) {
6494				if (IS_CONST != IS_CONST) {
6495					zend_string_release(name);
6496				}
6497
6498				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6499			}
6500			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
6501		}
6502	} else {
6503		if (IS_VAR == IS_UNUSED) {
6504			ce = zend_fetch_class(NULL, opline->op2.num);
6505			if (UNEXPECTED(ce == NULL)) {
6506				ZEND_ASSERT(EG(exception));
6507				if (IS_CONST != IS_CONST) {
6508					zend_string_release(name);
6509				}
6510
6511				HANDLE_EXCEPTION();
6512			}
6513		} else {
6514			ce = Z_CE_P(EX_VAR(opline->op2.var));
6515		}
6516		if (IS_CONST == IS_CONST &&
6517		    (retval = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce)) != NULL) {
6518
6519			/* check if static properties were destoyed */
6520			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
6521				zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
6522
6523				HANDLE_EXCEPTION();
6524			}
6525
6526			goto fetch_static_prop_return;
6527		}
6528	}
6529	retval = zend_std_get_static_property(ce, name, 0);
6530	if (UNEXPECTED(EG(exception))) {
6531		if (IS_CONST != IS_CONST) {
6532			zend_string_release(name);
6533		}
6534
6535		HANDLE_EXCEPTION();
6536	}
6537	if (IS_CONST == IS_CONST && retval) {
6538		CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
6539	}
6540
6541	if (IS_CONST != IS_CONST) {
6542		zend_string_release(name);
6543	}
6544
6545fetch_static_prop_return:
6546	ZEND_ASSERT(retval != NULL);
6547	if (type == BP_VAR_R || type == BP_VAR_IS) {
6548		if (/*type == BP_VAR_R &&*/ Z_ISREF_P(retval) && Z_REFCOUNT_P(retval) == 1) {
6549			ZVAL_UNREF(retval);
6550		}
6551		ZVAL_COPY(EX_VAR(opline->result.var), retval);
6552	} else {
6553		ZVAL_INDIRECT(EX_VAR(opline->result.var), retval);
6554	}
6555	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6556}
6557
6558static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6559{
6560	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6561}
6562
6563static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_W_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6564{
6565	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6566}
6567
6568static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_RW_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6569{
6570	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_RW ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6571}
6572
6573static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_FUNC_ARG_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6574{
6575	USE_OPLINE
6576
6577	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
6578		ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6579	} else {
6580		ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6581	}
6582}
6583
6584static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_UNSET_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6585{
6586	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_UNSET ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6587}
6588
6589static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_IS_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6590{
6591	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_VAR(BP_VAR_IS ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6592}
6593
6594static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_UNSET_STATIC_PROP_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6595{
6596	USE_OPLINE
6597	zval tmp, *varname;
6598	zend_class_entry *ce;
6599
6600
6601	SAVE_OPLINE();
6602
6603	varname = EX_CONSTANT(opline->op1);
6604
6605	ZVAL_UNDEF(&tmp);
6606	if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
6607		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
6608			varname = GET_OP1_UNDEF_CV(varname, BP_VAR_R);
6609		}
6610		ZVAL_STR(&tmp, zval_get_string(varname));
6611		varname = &tmp;
6612	}
6613
6614	if (IS_VAR == IS_CONST) {
6615		ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)));
6616		if (UNEXPECTED(ce == NULL)) {
6617			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
6618			if (UNEXPECTED(ce == NULL)) {
6619				if (EXPECTED(!EG(exception))) {
6620					zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op2)));
6621				}
6622				if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
6623					zend_string_release(Z_STR(tmp));
6624				}
6625
6626				HANDLE_EXCEPTION();
6627			}
6628			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
6629		}
6630	} else if (IS_VAR == IS_UNUSED) {
6631		ce = zend_fetch_class(NULL, opline->op2.num);
6632		if (UNEXPECTED(ce == NULL)) {
6633			ZEND_ASSERT(EG(exception));
6634			if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
6635				zend_string_release(Z_STR(tmp));
6636			}
6637
6638			HANDLE_EXCEPTION();
6639		}
6640	} else {
6641		ce = Z_CE_P(EX_VAR(opline->op2.var));
6642	}
6643	zend_std_unset_static_property(ce, Z_STR_P(varname));
6644
6645	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
6646		zend_string_release(Z_STR(tmp));
6647	}
6648
6649	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6650}
6651
6652static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ISSET_ISEMPTY_STATIC_PROP_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6653{
6654	USE_OPLINE
6655	zval *value;
6656	int result;
6657
6658	zval tmp, *varname;
6659	zend_class_entry *ce;
6660
6661	SAVE_OPLINE();
6662	varname = EX_CONSTANT(opline->op1);
6663	ZVAL_UNDEF(&tmp);
6664	if (IS_CONST != IS_CONST && Z_TYPE_P(varname) != IS_STRING) {
6665		ZVAL_STR(&tmp, zval_get_string(varname));
6666		varname = &tmp;
6667	}
6668
6669	if (IS_VAR == IS_CONST) {
6670		if (IS_CONST == IS_CONST && EXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)))) != NULL)) {
6671			value = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)) + sizeof(void*));
6672
6673			/* check if static properties were destoyed */
6674			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
6675				value = NULL;
6676			}
6677
6678			goto is_static_prop_return;
6679		} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
6680			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
6681			if (UNEXPECTED(ce == NULL)) {
6682				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6683			}
6684			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
6685		}
6686	} else {
6687		if (IS_VAR == IS_UNUSED) {
6688			ce = zend_fetch_class(NULL, opline->op2.num);
6689			if (UNEXPECTED(ce == NULL)) {
6690				ZEND_ASSERT(EG(exception));
6691				if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
6692					zend_string_release(Z_STR(tmp));
6693				}
6694
6695				HANDLE_EXCEPTION();
6696			}
6697		} else {
6698			ce = Z_CE_P(EX_VAR(opline->op2.var));
6699		}
6700		if (IS_CONST == IS_CONST &&
6701		    (value = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce)) != NULL) {
6702
6703			/* check if static properties were destoyed */
6704			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
6705				value = NULL;
6706			}
6707
6708			goto is_static_prop_return;
6709		}
6710	}
6711
6712	value = zend_std_get_static_property(ce, Z_STR_P(varname), 1);
6713
6714	if (IS_CONST == IS_CONST && value) {
6715		CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, value);
6716	}
6717
6718	if (IS_CONST != IS_CONST && Z_TYPE(tmp) != IS_UNDEF) {
6719		zend_string_release(Z_STR(tmp));
6720	}
6721
6722is_static_prop_return:
6723	if (opline->extended_value & ZEND_ISSET) {
6724		result = value && Z_TYPE_P(value) > IS_NULL &&
6725		    (!Z_ISREF_P(value) || Z_TYPE_P(Z_REFVAL_P(value)) != IS_NULL);
6726	} else /* if (opline->extended_value & ZEND_ISEMPTY) */ {
6727		result = !value || !i_zend_is_true(value);
6728	}
6729
6730	ZEND_VM_SMART_BRANCH(result, 1);
6731	ZVAL_BOOL(EX_VAR(opline->result.var), result);
6732	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6733}
6734
6735static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6736{
6737	USE_OPLINE
6738
6739	zend_generator *generator = zend_get_running_generator(execute_data);
6740
6741	SAVE_OPLINE();
6742	if (UNEXPECTED(generator->flags & ZEND_GENERATOR_FORCED_CLOSE)) {
6743		zend_throw_error(NULL, "Cannot yield from finally in a force-closed generator");
6744		zval_ptr_dtor_nogc(EX_VAR(opline->op2.var));
6745
6746		HANDLE_EXCEPTION();
6747	}
6748
6749	/* Destroy the previously yielded value */
6750	zval_ptr_dtor(&generator->value);
6751
6752	/* Destroy the previously yielded key */
6753	zval_ptr_dtor(&generator->key);
6754
6755	/* Set the new yielded value */
6756	if (IS_CONST != IS_UNUSED) {
6757
6758
6759		if (UNEXPECTED(EX(func)->op_array.fn_flags & ZEND_ACC_RETURN_REFERENCE)) {
6760			/* Constants and temporary variables aren't yieldable by reference,
6761			 * but we still allow them with a notice. */
6762			if (IS_CONST & (IS_CONST|IS_TMP_VAR)) {
6763				zval *value;
6764
6765				zend_error(E_NOTICE, "Only variable references should be yielded by reference");
6766
6767				value = EX_CONSTANT(opline->op1);
6768				ZVAL_COPY_VALUE(&generator->value, value);
6769				if (IS_CONST == IS_CONST) {
6770					if (UNEXPECTED(Z_OPT_COPYABLE(generator->value))) {
6771						zval_copy_ctor_func(&generator->value);
6772					}
6773				}
6774			} else {
6775				zval *value_ptr = NULL;
6776
6777				/* If a function call result is yielded and the function did
6778				 * not return by reference we throw a notice. */
6779				if (IS_CONST == IS_VAR &&
6780				    (value_ptr == &EG(uninitialized_zval) ||
6781				     (opline->extended_value == ZEND_RETURNS_FUNCTION &&
6782				      !Z_ISREF_P(value_ptr)))) {
6783					zend_error(E_NOTICE, "Only variable references should be yielded by reference");
6784				} else {
6785					ZVAL_MAKE_REF(value_ptr);
6786				}
6787				ZVAL_COPY(&generator->value, value_ptr);
6788
6789			}
6790		} else {
6791			zval *value = EX_CONSTANT(opline->op1);
6792
6793			/* Consts, temporary variables and references need copying */
6794			if (IS_CONST == IS_CONST) {
6795				ZVAL_COPY_VALUE(&generator->value, value);
6796				if (UNEXPECTED(Z_OPT_COPYABLE(generator->value))) {
6797					zval_copy_ctor_func(&generator->value);
6798				}
6799			} else if (IS_CONST == IS_TMP_VAR) {
6800				ZVAL_COPY_VALUE(&generator->value, value);
6801            } else if ((IS_CONST & (IS_VAR|IS_CV)) && Z_ISREF_P(value)) {
6802				ZVAL_COPY(&generator->value, Z_REFVAL_P(value));
6803
6804			} else {
6805				ZVAL_COPY_VALUE(&generator->value, value);
6806				if (IS_CONST == IS_CV) {
6807					if (Z_OPT_REFCOUNTED_P(value)) Z_ADDREF_P(value);
6808				}
6809			}
6810		}
6811	} else {
6812		/* If no value was specified yield null */
6813		ZVAL_NULL(&generator->value);
6814	}
6815
6816	/* Set the new yielded key */
6817	if (IS_VAR != IS_UNUSED) {
6818		zend_free_op free_op2;
6819		zval *key = _get_zval_ptr_var(opline->op2.var, execute_data, &free_op2);
6820
6821		/* Consts, temporary variables and references need copying */
6822		if (IS_VAR == IS_CONST) {
6823			ZVAL_COPY_VALUE(&generator->key, key);
6824			if (UNEXPECTED(Z_OPT_COPYABLE(generator->key))) {
6825				zval_copy_ctor_func(&generator->key);
6826			}
6827		} else if (IS_VAR == IS_TMP_VAR) {
6828			ZVAL_COPY_VALUE(&generator->key, key);
6829		} else if ((IS_VAR & (IS_VAR|IS_CV)) && Z_ISREF_P(key)) {
6830			ZVAL_COPY(&generator->key, Z_REFVAL_P(key));
6831			zval_ptr_dtor_nogc(free_op2);
6832		} else {
6833			ZVAL_COPY_VALUE(&generator->key, key);
6834			if (IS_VAR == IS_CV) {
6835				if (Z_OPT_REFCOUNTED_P(key)) Z_ADDREF_P(key);
6836			}
6837		}
6838
6839		if (Z_TYPE(generator->key) == IS_LONG
6840		    && Z_LVAL(generator->key) > generator->largest_used_integer_key
6841		) {
6842			generator->largest_used_integer_key = Z_LVAL(generator->key);
6843		}
6844	} else {
6845		/* If no key was specified we use auto-increment keys */
6846		generator->largest_used_integer_key++;
6847		ZVAL_LONG(&generator->key, generator->largest_used_integer_key);
6848	}
6849
6850	if (RETURN_VALUE_USED(opline)) {
6851		/* If the return value of yield is used set the send
6852		 * target and initialize it to NULL */
6853		generator->send_target = EX_VAR(opline->result.var);
6854		ZVAL_NULL(generator->send_target);
6855	} else {
6856		generator->send_target = NULL;
6857	}
6858
6859	/* We increment to the next op, so we are at the correct position when the
6860	 * generator is resumed. */
6861	ZEND_VM_INC_OPCODE();
6862
6863	/* The GOTO VM uses a local opline variable. We need to set the opline
6864	 * variable in execute_data so we don't resume at an old position. */
6865	SAVE_OPLINE();
6866
6867	ZEND_VM_RETURN();
6868}
6869
6870static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_var_address_helper_SPEC_CONST_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
6871{
6872	USE_OPLINE
6873
6874	zval *varname;
6875	zval *retval;
6876	zend_string *name;
6877	HashTable *target_symbol_table;
6878
6879	SAVE_OPLINE();
6880	varname = EX_CONSTANT(opline->op1);
6881
6882 	if (IS_CONST == IS_CONST) {
6883		name = Z_STR_P(varname);
6884	} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
6885		name = Z_STR_P(varname);
6886		zend_string_addref(name);
6887	} else {
6888		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
6889			GET_OP1_UNDEF_CV(varname, BP_VAR_R);
6890		}
6891		name = zval_get_string(varname);
6892	}
6893
6894	target_symbol_table = zend_get_target_symbol_table(execute_data, opline->extended_value & ZEND_FETCH_TYPE_MASK);
6895	retval = zend_hash_find(target_symbol_table, name);
6896	if (retval == NULL) {
6897		switch (type) {
6898			case BP_VAR_R:
6899			case BP_VAR_UNSET:
6900				zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
6901				/* break missing intentionally */
6902			case BP_VAR_IS:
6903				retval = &EG(uninitialized_zval);
6904				break;
6905			case BP_VAR_RW:
6906				zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
6907				retval = zend_hash_update(target_symbol_table, name, &EG(uninitialized_zval));
6908				break;
6909			case BP_VAR_W:
6910				retval = zend_hash_add_new(target_symbol_table, name, &EG(uninitialized_zval));
6911				break;
6912			EMPTY_SWITCH_DEFAULT_CASE()
6913		}
6914	/* GLOBAL or $$name variable may be an INDIRECT pointer to CV */
6915	} else if (Z_TYPE_P(retval) == IS_INDIRECT) {
6916		retval = Z_INDIRECT_P(retval);
6917		if (Z_TYPE_P(retval) == IS_UNDEF) {
6918			switch (type) {
6919				case BP_VAR_R:
6920				case BP_VAR_UNSET:
6921					zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
6922					/* break missing intentionally */
6923				case BP_VAR_IS:
6924					retval = &EG(uninitialized_zval);
6925					break;
6926				case BP_VAR_RW:
6927					zend_error(E_NOTICE,"Undefined variable: %s", ZSTR_VAL(name));
6928					/* break missing intentionally */
6929				case BP_VAR_W:
6930					ZVAL_NULL(retval);
6931					break;
6932				EMPTY_SWITCH_DEFAULT_CASE()
6933			}
6934		}
6935	}
6936
6937	if ((opline->extended_value & ZEND_FETCH_TYPE_MASK) != ZEND_FETCH_GLOBAL_LOCK) {
6938
6939	}
6940
6941	if (IS_CONST != IS_CONST) {
6942		zend_string_release(name);
6943	}
6944
6945	ZEND_ASSERT(retval != NULL);
6946	if (type == BP_VAR_R || type == BP_VAR_IS) {
6947		if (/*type == BP_VAR_R &&*/ Z_ISREF_P(retval) && Z_REFCOUNT_P(retval) == 1) {
6948			ZVAL_UNREF(retval);
6949		}
6950		ZVAL_COPY(EX_VAR(opline->result.var), retval);
6951	} else {
6952		ZVAL_INDIRECT(EX_VAR(opline->result.var), retval);
6953	}
6954	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
6955}
6956
6957static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_R_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6958{
6959	ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6960}
6961
6962static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_W_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6963{
6964	ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6965}
6966
6967static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_RW_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6968{
6969	ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_RW ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6970}
6971
6972static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_FUNC_ARG_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6973{
6974	USE_OPLINE
6975
6976	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
6977		ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6978	} else {
6979		ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6980	}
6981}
6982
6983static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_UNSET_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6984{
6985	ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_UNSET ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6986}
6987
6988static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_IS_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
6989{
6990	ZEND_VM_TAIL_CALL(zend_fetch_var_address_helper_SPEC_CONST_UNUSED(BP_VAR_IS ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
6991}
6992
6993static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(int type ZEND_OPCODE_HANDLER_ARGS_DC)
6994{
6995	USE_OPLINE
6996
6997	zval *varname;
6998	zval *retval;
6999	zend_string *name;
7000	zend_class_entry *ce;
7001
7002	SAVE_OPLINE();
7003	varname = EX_CONSTANT(opline->op1);
7004
7005 	if (IS_CONST == IS_CONST) {
7006		name = Z_STR_P(varname);
7007	} else if (EXPECTED(Z_TYPE_P(varname) == IS_STRING)) {
7008		name = Z_STR_P(varname);
7009		zend_string_addref(name);
7010	} else {
7011		if (IS_CONST == IS_CV && UNEXPECTED(Z_TYPE_P(varname) == IS_UNDEF)) {
7012			GET_OP1_UNDEF_CV(varname, BP_VAR_R);
7013		}
7014		name = zval_get_string(varname);
7015	}
7016
7017	if (IS_UNUSED == IS_CONST) {
7018		if (IS_CONST == IS_CONST && EXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)))) != NULL)) {
7019			retval = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)) + sizeof(void*));
7020
7021			/* check if static properties were destoyed */
7022			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
7023				zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
7024
7025				HANDLE_EXCEPTION();
7026			}
7027
7028			goto fetch_static_prop_return;
7029		} else if (UNEXPECTED((ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) == NULL)) {
7030			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op2)), EX_CONSTANT(opline->op2) + 1, ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION);
7031			if (UNEXPECTED(ce == NULL)) {
7032				if (IS_CONST != IS_CONST) {
7033					zend_string_release(name);
7034				}
7035
7036				ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
7037			}
7038			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce);
7039		}
7040	} else {
7041		if (IS_UNUSED == IS_UNUSED) {
7042			ce = zend_fetch_class(NULL, opline->op2.num);
7043			if (UNEXPECTED(ce == NULL)) {
7044				ZEND_ASSERT(EG(exception));
7045				if (IS_CONST != IS_CONST) {
7046					zend_string_release(name);
7047				}
7048
7049				HANDLE_EXCEPTION();
7050			}
7051		} else {
7052			ce = Z_CE_P(EX_VAR(opline->op2.var));
7053		}
7054		if (IS_CONST == IS_CONST &&
7055		    (retval = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce)) != NULL) {
7056
7057			/* check if static properties were destoyed */
7058			if (UNEXPECTED(CE_STATIC_MEMBERS(ce) == NULL)) {
7059				zend_throw_error(NULL, "Access to undeclared static property: %s::$%s", ZSTR_VAL(ce->name), ZSTR_VAL(name));
7060
7061				HANDLE_EXCEPTION();
7062			}
7063
7064			goto fetch_static_prop_return;
7065		}
7066	}
7067	retval = zend_std_get_static_property(ce, name, 0);
7068	if (UNEXPECTED(EG(exception))) {
7069		if (IS_CONST != IS_CONST) {
7070			zend_string_release(name);
7071		}
7072
7073		HANDLE_EXCEPTION();
7074	}
7075	if (IS_CONST == IS_CONST && retval) {
7076		CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce, retval);
7077	}
7078
7079	if (IS_CONST != IS_CONST) {
7080		zend_string_release(name);
7081	}
7082
7083fetch_static_prop_return:
7084	ZEND_ASSERT(retval != NULL);
7085	if (type == BP_VAR_R || type == BP_VAR_IS) {
7086		if (/*type == BP_VAR_R &&*/ Z_ISREF_P(retval) && Z_REFCOUNT_P(retval) == 1) {
7087			ZVAL_UNREF(retval);
7088		}
7089		ZVAL_COPY(EX_VAR(opline->result.var), retval);
7090	} else {
7091		ZVAL_INDIRECT(EX_VAR(opline->result.var), retval);
7092	}
7093	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
7094}
7095
7096static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_R_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7097{
7098	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7099}
7100
7101static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_W_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7102{
7103	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7104}
7105
7106static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_RW_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7107{
7108	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_RW ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7109}
7110
7111static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_FUNC_ARG_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7112{
7113	USE_OPLINE
7114
7115	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
7116		ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_W ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7117	} else {
7118		ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_R ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7119	}
7120}
7121
7122static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_UNSET_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7123{
7124	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_UNSET ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7125}
7126
7127static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_STATIC_PROP_IS_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7128{
7129	ZEND_VM_TAIL_CALL(zend_fetch_static_prop_helper_SPEC_CONST_UNUSED(BP_VAR_IS ZEND_OPCODE_HANDLER_ARGS_PASSTHRU_CC));
7130}
7131
7132static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_FETCH_DIM_FUNC_ARG_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7133{
7134	USE_OPLINE
7135	zval *container;
7136	zend_free_op free_op1;
7137
7138	SAVE_OPLINE();
7139
7140	if (zend_is_by_ref_func_arg_fetch(opline, EX(call))) {
7141        if ((IS_CONST & (IS_CONST|IS_TMP_VAR))) {
7142            zend_throw_error(NULL, "Cannot use temporary expression in write context");
7143
7144
7145			HANDLE_EXCEPTION();
7146        }
7147		container = NULL;
7148		zend_fetch_dimension_address_W(EX_VAR(opline->result.var), container, NULL, IS_UNUSED);
7149		if (IS_CONST == IS_VAR && READY_TO_DESTROY(free_op1)) {
7150			EXTRACT_ZVAL_PTR(EX_VAR(opline->result.var));
7151		}
7152
7153
7154	} else {
7155		if (IS_UNUSED == IS_UNUSED) {
7156			zend_throw_error(NULL, "Cannot use [] for reading");
7157
7158
7159			HANDLE_EXCEPTION();
7160		}
7161		container = EX_CONSTANT(opline->op1);
7162		zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, NULL, IS_UNUSED);
7163
7164
7165	}
7166	ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
7167}
7168
7169static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
7170{
7171	USE_OPLINE
7172	zval *function_name;
7173	zend_class_entry *ce;
7174	zend_object *object;
7175	zend_function *fbc;
7176	zend_execute_data *call;
7177
7178	SAVE_OPLINE();
7179
7180	if (IS_CONST == IS_CONST) {
7181		/* no function found. try a static method in class */
7182		ce = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)));
7183		if (UNEXPECTED(ce == NULL)) {
7184			ce = zend_fetch_class_by_name(Z_STR_P(EX_CONSTANT(opline->op1)), EX_CONSTANT(opline->op1) + 1, ZEND_FETCH_CLASS_DEFAULT |  ZEND_FETCH_CLASS_EXCEPTION);
7185			if (UNEXPECTED(ce == NULL)) {
7186				if (UNEXPECTED(EG(exception) != NULL)) {
7187					HANDLE_EXCEPTION();
7188				}
7189				zend_throw_error(NULL, "Class '%s' not found", Z_STRVAL_P(EX_CONSTANT(opline->op1)));
7190				HANDLE_EXCEPTION();
7191			}
7192			CACHE_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op1)), ce);
7193		}
7194	} else if (IS_CONST == IS_UNUSED) {
7195		ce = zend_fetch_class(NULL, opline->op1.num);
7196		if (UNEXPECTED(ce == NULL)) {
7197			ZEND_ASSERT(EG(exception));
7198
7199			HANDLE_EXCEPTION();
7200		}
7201	} else {
7202		ce = Z_CE_P(EX_VAR(opline->op1.var));
7203	}
7204
7205	if (IS_CONST == IS_CONST &&
7206	    IS_UNUSED == IS_CONST &&
7207	    EXPECTED((fbc = CACHED_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)))) != NULL)) {
7208		/* nothing to do */
7209	} else if (IS_CONST != IS_CONST &&
7210	           IS_UNUSED == IS_CONST &&
7211	           (fbc = CACHED_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(EX_CONSTANT(opline->op2)), ce))) {
7212		/* do nothing */
7213	} else if (IS_UNUSED != IS_UNUSED) {
7214
7215
7216		function_name = NULL;
7217		if (IS_UNUSED != IS_CONST) {
7218			if (UNEXPECTED(Z_TYPE_P(function_name) != IS_STRING)) {
7219				do {
7220					if (IS_UNUSED & (IS_VAR|IS_CV) && Z_ISREF_P(function_name)) {
7221						function_name = Z_REFVAL_P(function_name);
7222						if (EXPECTED(Z_TYPE_P(function_name) == IS_STRING)) {
7223							break;
7224						}
7225					} else if (IS_UNUSED == IS_CV && UNEXPECTED(Z_TYPE_P(function_name) == IS_UNDEF)) {
7226						GET_OP2_UNDEF_CV(function_name, BP_VAR_R);
7227						if (UNEXPECTED(EG(exception) != NULL)) {
7228							HANDLE_EXCEPTION();
7229						}
7230					}
7231					zend_throw_error(NULL, "Function name must be a string");
7232
7233					HANDLE_EXCEPTION();
7234				} while (0);
7235 			}
7236		}
7237
7238		if (ce->get_static_method) {
7239			fbc = ce->get_static_method(ce, Z_STR_P(function_name));
7240		} else {
7241			fbc = zend_std_get_static_method(ce, Z_STR_P(function_name), ((IS_UNUSED == IS_CONST) ? (EX_CONSTANT(opline->op2) + 1) : NULL));
7242		}
7243		if (UNEXPECTED(fbc == NULL)) {
7244			if (EXPECTED(!EG(exception))) {
7245				zend_throw_error(NULL, "Call to undefined method %s::%s()", ZSTR_VAL(ce->name), Z_STRVAL_P(function_name));
7246			}
7247
7248			HANDLE_EXCEPTION();
7249		}
7250		if (IS_UNUSED == IS_CONST &&
7251		    EXPECTED(fbc->type <= ZEND_USER_FUNCTION) &&
7252		    EXPECTED(!(fbc->common.fn_flags & (ZEND_ACC_CALL_VIA_TRAMPOLINE|ZEND_ACC_NEVER_CACHE)))) {
7253			if (IS_CONST == IS_CONST) {
7254				CACHE_PTR(Z_CACHE_SLOT_P(function_name), fbc);
7255			} else {
7256				CACHE_POLYMORPHIC_PTR(Z_CACHE_SLOT_P(function_name), ce, fbc);
7257			}
7258		}
7259		if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) && UNEXPECTED(!fbc->op_array.run_time_cache)) {
7260			init_func_run_time_cache(&fbc->op_array);
7261		}
7262		if (IS_UNUSED != IS_CONST) {
7263
7264		}
7265	} else {
7266		if (UNEXPECTED(ce->constructor == NULL)) {
7267			zend_throw_error(NULL, "Cannot call constructor");
7268			HANDLE_EXCEPTION();
7269		}
7270		if (Z_TYPE(EX(This)) == IS_OBJECT && Z_