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