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