PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LCOV - code coverage report
Current view: top level - Zend - zend_execute.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 774 895 86.5 %
Date: 2015-05-21 Functions: 36 45 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend Engine                                                          |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2015 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             :    +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : /* $Id$ */
      21             : 
      22             : #define ZEND_INTENSIVE_DEBUGGING 0
      23             : 
      24             : #include <stdio.h>
      25             : #include <signal.h>
      26             : 
      27             : #include "zend.h"
      28             : #include "zend_compile.h"
      29             : #include "zend_execute.h"
      30             : #include "zend_API.h"
      31             : #include "zend_ptr_stack.h"
      32             : #include "zend_constants.h"
      33             : #include "zend_extensions.h"
      34             : #include "zend_ini.h"
      35             : #include "zend_exceptions.h"
      36             : #include "zend_interfaces.h"
      37             : #include "zend_closures.h"
      38             : #include "zend_generators.h"
      39             : #include "zend_vm.h"
      40             : #include "zend_dtrace.h"
      41             : #include "zend_inheritance.h"
      42             : 
      43             : /* Virtual current working directory support */
      44             : #include "zend_virtual_cwd.h"
      45             : 
      46             : #define _CONST_CODE  0
      47             : #define _TMP_CODE    1
      48             : #define _VAR_CODE    2
      49             : #define _UNUSED_CODE 3
      50             : #define _CV_CODE     4
      51             : 
      52             : typedef int (ZEND_FASTCALL *incdec_t)(zval *);
      53             : 
      54             : #define get_zval_ptr(op_type, node, ex, should_free, type) _get_zval_ptr(op_type, node, ex, should_free, type)
      55             : #define get_zval_ptr_deref(op_type, node, ex, should_free, type) _get_zval_ptr_deref(op_type, node, ex, should_free, type)
      56             : #define get_zval_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_undef(op_type, node, ex, should_free, type)
      57             : #define get_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type)
      58             : #define get_zval_ptr_ptr_undef(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type)
      59             : #define get_obj_zval_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr(op_type, node, ex, should_free, type)
      60             : #define get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr_ptr(op_type, node, ex, should_free, type)
      61             : 
      62             : /* Prototypes */
      63             : static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array);
      64             : static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array);
      65             : static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array);
      66             : 
      67             : #define RETURN_VALUE_USED(opline) (!((opline)->result_type & EXT_TYPE_UNUSED))
      68             : 
      69          71 : static ZEND_FUNCTION(pass)
      70             : {
      71          71 : }
      72             : 
      73             : static const zend_internal_function zend_pass_function = {
      74             :         ZEND_INTERNAL_FUNCTION, /* type              */
      75             :         {0, 0, 0},              /* arg_flags         */
      76             :         0,                      /* fn_flags          */
      77             :         NULL,                   /* name              */
      78             :         NULL,                   /* scope             */
      79             :         NULL,                   /* prototype         */
      80             :         0,                      /* num_args          */
      81             :         0,                      /* required_num_args */
      82             :         NULL,                   /* arg_info          */
      83             :         ZEND_FN(pass),          /* handler           */
      84             :         NULL                    /* module            */
      85             : };
      86             : 
      87             : #undef zval_ptr_dtor
      88             : #define zval_ptr_dtor(zv) i_zval_ptr_dtor(zv ZEND_FILE_LINE_CC)
      89             : 
      90             : #define PZVAL_LOCK(z) if (Z_REFCOUNTED_P(z)) Z_ADDREF_P((z))
      91             : #define SELECTIVE_PZVAL_LOCK(pzv, opline)       if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(pzv); }
      92             : 
      93             : #define READY_TO_DESTROY(zv) \
      94             :         (zv && Z_REFCOUNTED_P(zv) && Z_REFCOUNT_P(zv) == 1)
      95             : 
      96             : #define EXTRACT_ZVAL_PTR(zv) do {                                               \
      97             :                 zval *__zv = (zv);                                                              \
      98             :                 if (Z_TYPE_P(__zv) == IS_INDIRECT) {                    \
      99             :                         ZVAL_COPY(__zv, Z_INDIRECT_P(__zv));            \
     100             :                 }                                                                                               \
     101             :         } while (0)
     102             : 
     103             : #define FREE_OP(should_free) \
     104             :         if (should_free) { \
     105             :                 zval_ptr_dtor_nogc(should_free); \
     106             :         }
     107             : 
     108             : #define FREE_UNFETCHED_OP(type, var) \
     109             :         if ((type) & (IS_TMP_VAR|IS_VAR)) { \
     110             :                 zval_ptr_dtor_nogc(EX_VAR(var)); \
     111             :         }
     112             : 
     113             : #define FREE_OP_VAR_PTR(should_free) \
     114             :         if (should_free) { \
     115             :                 zval_ptr_dtor_nogc(should_free); \
     116             :         }
     117             : 
     118             : /* End of zend_execute_locks.h */
     119             : 
     120             : #define CV_DEF_OF(i) (EX(func)->op_array.vars[i])
     121             : 
     122             : #define CTOR_CALL_BIT    0x1
     123             : #define CTOR_USED_BIT    0x2
     124             : 
     125             : #define IS_CTOR_CALL(ce) (((zend_uintptr_t)(ce)) & CTOR_CALL_BIT)
     126             : #define IS_CTOR_USED(ce) (((zend_uintptr_t)(ce)) & CTOR_USED_BIT)
     127             : 
     128             : #define ENCODE_CTOR(ce, used) \
     129             :         ((zend_class_entry*)(((zend_uintptr_t)(ce)) | CTOR_CALL_BIT | ((used) ? CTOR_USED_BIT : 0)))
     130             : #define DECODE_CTOR(ce) \
     131             :         ((zend_class_entry*)(((zend_uintptr_t)(ce)) & ~(CTOR_CALL_BIT|CTOR_USED_BIT)))
     132             : 
     133             : #define ZEND_VM_MAIN_STACK_PAGE_SLOTS (16 * 1024) /* should be a power of 2 */
     134             : #define ZEND_VM_GENERATOR_STACK_PAGE_SLOTS (256)
     135             : 
     136             : #define ZEND_VM_STACK_PAGE_SLOTS(gen) ((gen) ? ZEND_VM_GENERATOR_STACK_PAGE_SLOTS : ZEND_VM_MAIN_STACK_PAGE_SLOTS)
     137             : 
     138             : #define ZEND_VM_STACK_PAGE_SIZE(gen)  (ZEND_VM_STACK_PAGE_SLOTS(gen) * sizeof(zval))
     139             : 
     140             : #define ZEND_VM_STACK_FREE_PAGE_SIZE(gen) \
     141             :         ((ZEND_VM_STACK_PAGE_SLOTS(gen) - ZEND_VM_STACK_HEADER_SLOTS) * sizeof(zval))
     142             : 
     143             : #define ZEND_VM_STACK_PAGE_ALIGNED_SIZE(gen, size) \
     144             :         (((size) + (ZEND_VM_STACK_FREE_PAGE_SIZE(gen) - 1)) & ~ZEND_VM_STACK_PAGE_SIZE(gen))
     145             : 
     146             : static zend_always_inline zend_vm_stack zend_vm_stack_new_page(size_t size, zend_vm_stack prev) {
     147       71265 :         zend_vm_stack page = (zend_vm_stack)emalloc(size);
     148             : 
     149       71265 :         page->top = ZEND_VM_STACK_ELEMETS(page);
     150       71265 :         page->end = (zval*)((char*)page + size);
     151       71265 :         page->prev = prev;
     152       71265 :         return page;
     153             : }
     154             : 
     155       20873 : ZEND_API void zend_vm_stack_init(void)
     156             : {
     157       20873 :         EG(vm_stack) = zend_vm_stack_new_page(ZEND_VM_STACK_PAGE_SIZE(0 /* main stack */), NULL);
     158       20873 :         EG(vm_stack)->top++;
     159       20873 :         EG(vm_stack_top) = EG(vm_stack)->top;
     160       20873 :         EG(vm_stack_end) = EG(vm_stack)->end;
     161       20873 : }
     162             : 
     163       20911 : ZEND_API void zend_vm_stack_destroy(void)
     164             : {
     165       20911 :         zend_vm_stack stack = EG(vm_stack);
     166             : 
     167       62736 :         while (stack != NULL) {
     168       20914 :                 zend_vm_stack p = stack->prev;
     169       20914 :                 efree(stack);
     170       20914 :                 stack = p;
     171             :         }
     172       20911 : }
     173             : 
     174           7 : ZEND_API void* zend_vm_stack_extend(size_t size)
     175             : {
     176             :         zend_vm_stack stack;
     177             :         void *ptr;
     178             : 
     179           7 :         stack = EG(vm_stack);
     180           7 :         stack->top = EG(vm_stack_top);
     181          20 :         EG(vm_stack) = stack = zend_vm_stack_new_page(
     182           7 :                 EXPECTED(size < ZEND_VM_STACK_FREE_PAGE_SIZE(0)) ?
     183           6 :                         ZEND_VM_STACK_PAGE_SIZE(0) : ZEND_VM_STACK_PAGE_ALIGNED_SIZE(0, size),
     184             :                 stack);
     185           7 :         ptr = stack->top;
     186           7 :         EG(vm_stack_top) = (void*)(((char*)ptr) + size);
     187           7 :         EG(vm_stack_end) = stack->end;
     188           7 :         return ptr;
     189             : }
     190             : 
     191           0 : ZEND_API zval* zend_get_compiled_variable_value(const zend_execute_data *execute_data, uint32_t var)
     192             : {
     193           0 :         return EX_VAR(var);
     194             : }
     195             : 
     196             : static zend_always_inline zval *_get_zval_ptr_tmp(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
     197             : {
     198     4552777 :         zval *ret = EX_VAR(var);
     199     4552777 :         *should_free = ret;
     200             : 
     201             :         ZEND_ASSERT(Z_TYPE_P(ret) != IS_REFERENCE);
     202             : 
     203     4552777 :         return ret;
     204             : }
     205             : 
     206             : static zend_always_inline zval *_get_zval_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
     207             : {
     208    50983847 :         zval *ret = EX_VAR(var);
     209             : 
     210    50983847 :         *should_free = ret;
     211    50983847 :         return ret;
     212             : }
     213             : 
     214             : static zend_always_inline zval *_get_zval_ptr_var_deref(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
     215             : {
     216     1205048 :         zval *ret = EX_VAR(var);
     217             : 
     218     1205048 :         *should_free = ret;
     219     1205048 :         ZVAL_DEREF(ret);
     220     1205048 :         return ret;
     221             : }
     222             : 
     223           5 : static zend_never_inline zval *_get_zval_cv_lookup(zval *ptr, uint32_t var, int type, const zend_execute_data *execute_data)
     224             : {
     225             :         zend_string *cv;
     226             : 
     227           5 :         switch (type) {
     228             :                 case BP_VAR_R:
     229             :                 case BP_VAR_UNSET:
     230           5 :                         cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
     231           5 :                         zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
     232             :                         /* break missing intentionally */
     233             :                 case BP_VAR_IS:
     234           5 :                         ptr = &EG(uninitialized_zval);
     235           5 :                         break;
     236             :                 case BP_VAR_RW:
     237           0 :                         cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
     238           0 :                         zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
     239             :                         /* break missing intentionally */
     240             :                 case BP_VAR_W:
     241           0 :                         ZVAL_NULL(ptr);
     242             :                         break;
     243             :         }
     244           5 :         return ptr;
     245             : }
     246             : 
     247             : static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_R(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
     248             : {
     249         569 :         zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
     250             : 
     251         569 :         zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
     252         569 :         return &EG(uninitialized_zval);
     253             : }
     254             : 
     255             : static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_UNSET(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
     256             : {
     257           0 :         zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
     258             : 
     259           0 :         zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
     260           0 :         return &EG(uninitialized_zval);
     261             : }
     262             : 
     263             : static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_RW(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
     264             : {
     265           4 :         zend_string *cv = CV_DEF_OF(EX_VAR_TO_NUM(var));
     266             : 
     267           4 :         ZVAL_NULL(ptr);
     268           4 :         zend_error(E_NOTICE, "Undefined variable: %s", cv->val);
     269           4 :         return ptr;
     270             : }
     271             : 
     272             : static zend_always_inline zval *_get_zval_cv_lookup_BP_VAR_W(zval *ptr, uint32_t var, const zend_execute_data *execute_data)
     273             : {
     274       38734 :         ZVAL_NULL(ptr);
     275       38734 :         return ptr;
     276             : }
     277             : 
     278             : static zend_always_inline zval *_get_zval_ptr_cv(const zend_execute_data *execute_data, uint32_t var, int type)
     279             : {
     280     3130733 :         zval *ret = EX_VAR(var);
     281             : 
     282     3130733 :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     283           5 :                 return _get_zval_cv_lookup(ret, var, type, execute_data);
     284             :         }
     285     3130728 :         return ret;
     286             : }
     287             : 
     288             : static zend_always_inline zval *_get_zval_ptr_cv_undef(const zend_execute_data *execute_data, uint32_t var)
     289             : {
     290    45853257 :         return EX_VAR(var);
     291             : }
     292             : 
     293             : static zend_always_inline zval *_get_zval_ptr_cv_deref(const zend_execute_data *execute_data, uint32_t var, int type)
     294             : {
     295          82 :         zval *ret = EX_VAR(var);
     296             : 
     297          82 :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     298           0 :                 return _get_zval_cv_lookup(ret, var, type, execute_data);
     299             :         }
     300          82 :         ZVAL_DEREF(ret);
     301          82 :         return ret;
     302             : }
     303             : 
     304             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var)
     305             : {
     306    30105905 :         zval *ret = EX_VAR(var);
     307             : 
     308    30105905 :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     309         330 :                 return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data);
     310             :         }
     311    30105575 :         return ret;
     312             : }
     313             : 
     314             : static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_R(const zend_execute_data *execute_data, uint32_t var)
     315             : {
     316     3911772 :         zval *ret = EX_VAR(var);
     317             : 
     318     3911772 :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     319           5 :                 return _get_zval_cv_lookup_BP_VAR_R(ret, var, execute_data);
     320             :         }
     321     3911767 :         ZVAL_DEREF(ret);
     322     3911767 :         return ret;
     323             : }
     324             : 
     325             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var)
     326             : {
     327       22018 :         zval *ret = EX_VAR(var);
     328             : 
     329       22018 :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     330           0 :                 return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data);
     331             :         }
     332       22018 :         return ret;
     333             : }
     334             : 
     335             : static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_UNSET(const zend_execute_data *execute_data, uint32_t var)
     336             : {
     337             :         zval *ret = EX_VAR(var);
     338             : 
     339             :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     340             :                 return _get_zval_cv_lookup_BP_VAR_UNSET(ret, var, execute_data);
     341             :         }
     342             :         ZVAL_DEREF(ret);
     343             :         return ret;
     344             : }
     345             : 
     346             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var)
     347             : {
     348      461963 :         zval *ret = EX_VAR(var);
     349             : 
     350      461963 :         return ret;
     351             : }
     352             : 
     353             : static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_IS(const zend_execute_data *execute_data, uint32_t var)
     354             : {
     355             :         zval *ret = EX_VAR(var);
     356             : 
     357             :         ZVAL_DEREF(ret);
     358             :         return ret;
     359             : }
     360             : 
     361             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var)
     362             : {
     363     8912203 :         zval *ret = EX_VAR(var);
     364             : 
     365     8912203 :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     366           0 :                 return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data);
     367             :         }
     368     8912203 :         return ret;
     369             : }
     370             : 
     371             : static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var)
     372             : {
     373             :         zval *ret = EX_VAR(var);
     374             : 
     375             :         if (UNEXPECTED(Z_TYPE_P(ret) == IS_UNDEF)) {
     376             :                 return _get_zval_cv_lookup_BP_VAR_RW(ret, var, execute_data);
     377             :         }
     378             :         ZVAL_DEREF(ret);
     379             :         return ret;
     380             : }
     381             : 
     382             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
     383             : {
     384     3937295 :         zval *ret = EX_VAR(var);
     385             : 
     386     3937295 :         if (Z_TYPE_P(ret) == IS_UNDEF) {
     387       38734 :                 return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data);
     388             :         }
     389     3898561 :         return ret;
     390             : }
     391             : 
     392             : static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
     393             : {
     394    26435143 :         return EX_VAR(var);
     395             : }
     396             : 
     397             : static zend_always_inline zval *_get_zval_ptr_cv_undef_BP_VAR_RW(const zend_execute_data *execute_data, uint32_t var)
     398             : {
     399     7483771 :         return EX_VAR(var);
     400             : }
     401             : 
     402             : static zend_always_inline zval *_get_zval_ptr_cv_deref_BP_VAR_W(const zend_execute_data *execute_data, uint32_t var)
     403             : {
     404             :         zval *ret = EX_VAR(var);
     405             : 
     406             :         if (Z_TYPE_P(ret) == IS_UNDEF) {
     407             :                 return _get_zval_cv_lookup_BP_VAR_W(ret, var, execute_data);
     408             :         }
     409             :         ZVAL_DEREF(ret);
     410             :         return ret;
     411             : }
     412             : 
     413             : static zend_always_inline zval *_get_zval_ptr(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
     414             : {
     415     4118580 :         if (op_type & (IS_TMP_VAR|IS_VAR)) {
     416      316985 :                 if (op_type == IS_TMP_VAR) {
     417      215526 :                         return _get_zval_ptr_tmp(node.var, execute_data, should_free);
     418             :                 } else {
     419             :                         ZEND_ASSERT(op_type == IS_VAR);
     420      418444 :                         return _get_zval_ptr_var(node.var, execute_data, should_free);
     421             :                 }
     422             :         } else {
     423     3801595 :                 *should_free = NULL;
     424     3801595 :                 if (op_type == IS_CONST) {
     425      670862 :                         return EX_CONSTANT(node);
     426     3130733 :                 } else if (op_type == IS_CV) {
     427     6261466 :                         return _get_zval_ptr_cv(execute_data, node.var, type);
     428             :                 } else {
     429           0 :                         return NULL;
     430             :                 }
     431             :         }
     432             : }
     433             : 
     434             : static zend_always_inline zval *_get_zval_ptr_deref(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
     435             : {
     436        1701 :         if (op_type & (IS_TMP_VAR|IS_VAR)) {
     437          57 :                 if (op_type == IS_TMP_VAR) {
     438          58 :                         return _get_zval_ptr_tmp(node.var, execute_data, should_free);
     439             :                 } else {
     440             :                         ZEND_ASSERT(op_type == IS_VAR);
     441          56 :                         return _get_zval_ptr_var_deref(node.var, execute_data, should_free);
     442             :                 }
     443             :         } else {
     444        1644 :                 *should_free = NULL;
     445        1644 :                 if (op_type == IS_CONST) {
     446        1562 :                         return EX_CONSTANT(node);
     447          82 :                 } else if (op_type == IS_CV) {
     448         164 :                         return _get_zval_ptr_cv_deref(execute_data, node.var, type);
     449             :                 } else {
     450           0 :                         return NULL;
     451             :                 }
     452             :         }
     453             : }
     454             : 
     455             : static zend_always_inline zval *_get_zval_ptr_undef(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
     456             : {
     457             :         if (op_type & (IS_TMP_VAR|IS_VAR)) {
     458             :                 if (op_type == IS_TMP_VAR) {
     459             :                         return _get_zval_ptr_tmp(node.var, execute_data, should_free);
     460             :                 } else {
     461             :                         ZEND_ASSERT(op_type == IS_VAR);
     462             :                         return _get_zval_ptr_var(node.var, execute_data, should_free);
     463             :                 }
     464             :         } else {
     465             :                 *should_free = NULL;
     466             :                 if (op_type == IS_CONST) {
     467             :                         return EX_CONSTANT(node);
     468             :                 } else if (op_type == IS_CV) {
     469             :                         return _get_zval_ptr_cv_undef(execute_data, node.var);
     470             :                 } else {
     471             :                         return NULL;
     472             :                 }
     473             :         }
     474             : }
     475             : 
     476             : static zend_always_inline zval *_get_zval_ptr_ptr_var(uint32_t var, const zend_execute_data *execute_data, zend_free_op *should_free)
     477             : {
     478      699177 :         zval *ret = EX_VAR(var);
     479             : 
     480      699177 :         if (EXPECTED(Z_TYPE_P(ret) == IS_INDIRECT)) {
     481      698940 :                 *should_free = NULL;
     482      698940 :                 ret = Z_INDIRECT_P(ret);
     483         237 :         } else if (!Z_REFCOUNTED_P(ret)) {
     484          72 :                 *should_free = ret; /* immutable array may be converted to regular */
     485         165 :         } else if (Z_REFCOUNT_P(ret) == 1) {
     486         108 :                 *should_free = ret;
     487             :         } else {
     488          57 :                 *should_free = NULL;
     489             :                 Z_DELREF_P(ret);
     490             :         }
     491      699177 :         return ret;
     492             : }
     493             : 
     494             : static inline zval *_get_zval_ptr_ptr(int op_type, znode_op node, const zend_execute_data *execute_data, zend_free_op *should_free, int type)
     495             : {
     496             :         if (op_type == IS_CV) {
     497             :                 *should_free = NULL;
     498             :                 return _get_zval_ptr_cv(execute_data, node.var, type);
     499             :         } else /* if (op_type == IS_VAR) */ {
     500             :                 ZEND_ASSERT(op_type == IS_VAR);
     501             :                 return _get_zval_ptr_ptr_var(node.var, execute_data, should_free);
     502             :         }
     503             : }
     504             : 
     505             : static zend_always_inline zval *_get_obj_zval_ptr_unused(zend_execute_data *execute_data)
     506             : {       
     507      225964 :         return &EX(This);
     508             : }
     509             : 
     510             : static inline zval *_get_obj_zval_ptr(int op_type, znode_op op, zend_execute_data *execute_data, zend_free_op *should_free, int type)
     511             : {
     512             :         if (op_type == IS_UNUSED) {
     513             :                 *should_free = NULL;
     514             :                 return &EX(This);
     515             :         }
     516             :         return get_zval_ptr(op_type, op, execute_data, should_free, type);
     517             : }
     518             : 
     519             : static inline zval *_get_obj_zval_ptr_ptr(int op_type, znode_op node, zend_execute_data *execute_data, zend_free_op *should_free, int type)
     520             : {
     521             :         if (op_type == IS_UNUSED) {
     522             :                 *should_free = NULL;
     523             :                 return &EX(This);
     524             :         }
     525             :         return get_zval_ptr_ptr(op_type, node, execute_data, should_free, type);
     526             : }
     527             : 
     528      156128 : static inline void zend_assign_to_variable_reference(zval *variable_ptr, zval *value_ptr)
     529             : {
     530             :         zend_reference *ref;
     531             : 
     532      156128 :         if (EXPECTED(!Z_ISREF_P(value_ptr))) {
     533      113054 :                 ZVAL_NEW_REF(value_ptr, value_ptr);
     534       43074 :         } else if (UNEXPECTED(variable_ptr == value_ptr)) {
     535           1 :                 return;
     536             :         }
     537             : 
     538      156127 :         ref = Z_REF_P(value_ptr);
     539      156127 :         GC_REFCOUNT(ref)++;
     540             :         zval_ptr_dtor(variable_ptr);
     541      156127 :         ZVAL_REF(variable_ptr, ref);
     542             : }
     543             : 
     544             : /* this should modify object only if it's empty */
     545          25 : static inline int make_real_object(zval *object)
     546             : {
     547          25 :         if (UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
     548          18 :                 if (EXPECTED(Z_TYPE_P(object) <= IS_FALSE)) {
     549             :                         /* nothing to destroy */
     550          11 :                 } else if (EXPECTED((Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0))) {
     551             :                         zval_ptr_dtor_nogc(object);
     552             :                 } else {
     553           7 :                         return 0;
     554             :                 }
     555          11 :                 object_init(object);
     556          11 :                 zend_error(E_WARNING, "Creating default object from empty value");
     557             :         }
     558          18 :         return 1;
     559             : }
     560             : 
     561        1131 : ZEND_API char * zend_verify_internal_arg_class_kind(const zend_internal_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce)
     562             : {
     563             :         zend_string *key;
     564             :         ALLOCA_FLAG(use_heap);
     565             : 
     566        1131 :         STR_ALLOCA_INIT(key, cur_arg_info->class_name, strlen(cur_arg_info->class_name), use_heap);
     567        1131 :         *pce = zend_fetch_class(key, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
     568        1131 :         STR_ALLOCA_FREE(key, use_heap);
     569             : 
     570        1131 :         *class_name = (*pce) ? (*pce)->name->val : (char*)cur_arg_info->class_name;
     571        1131 :         if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) {
     572         446 :                 return "implement interface ";
     573             :         } else {
     574         685 :                 return "be an instance of ";
     575             :         }
     576             : }
     577             : 
     578       87952 : ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, char **class_name, zend_class_entry **pce)
     579             : {
     580       87952 :         *pce = zend_fetch_class(cur_arg_info->class_name, (ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD));
     581             : 
     582       87952 :         *class_name = (*pce) ? (*pce)->name->val : cur_arg_info->class_name->val;
     583       87952 :         if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) {
     584         175 :                 return "implement interface ";
     585             :         } else {
     586       87777 :                 return "be an instance of ";
     587             :         }
     588             : }
     589             : 
     590         347 : ZEND_API void zend_verify_arg_error(const zend_function *zf, uint32_t arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind, zval *arg)
     591             : {
     592         347 :         zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
     593         347 :         const char *fname = zf->common.function_name->val;
     594             :         const char *fsep;
     595             :         const char *fclass;
     596             :         zval old_arg;
     597             : 
     598         347 :         if (zf->common.scope) {
     599          30 :                 fsep =  "::";
     600          30 :                 fclass = zf->common.scope->name->val;
     601             :         } else {
     602         317 :                 fsep =  "";
     603         317 :                 fclass = "";
     604             :         }
     605             : 
     606         347 :         if (zf->common.type == ZEND_USER_FUNCTION) {
     607         152 :                 if (arg) {
     608         143 :                         ZVAL_COPY_VALUE(&old_arg, arg);
     609         143 :                         ZVAL_UNDEF(arg);
     610             :                 }
     611             : 
     612         300 :                 if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
     613         296 :                         zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d",
     614             :                                         arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind,
     615         296 :                                         ptr->func->op_array.filename->val, ptr->opline->lineno);
     616             :                 } else {
     617           4 :                         zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
     618             :                 }
     619             : 
     620         152 :                 if (arg) {
     621         143 :                         ZVAL_COPY_VALUE(arg, &old_arg);
     622             :                 }
     623             :         } else {
     624         195 :                 zend_type_error("Argument %d passed to %s%s%s() must %s%s, %s%s given", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind);
     625             :         }
     626         347 : }
     627             : 
     628           5 : static int is_null_constant(zval *default_value)
     629             : {
     630           5 :         if (Z_CONSTANT_P(default_value)) {
     631             :                 zval constant;
     632             : 
     633           5 :                 ZVAL_COPY_VALUE(&constant, default_value);
     634           5 :                 if (UNEXPECTED(zval_update_constant_ex(&constant, 0, NULL) != SUCCESS)) {
     635           0 :                         return 0;
     636             :                 }
     637           5 :                 if (Z_TYPE(constant) == IS_NULL) {
     638           4 :                         return 1;
     639             :                 }
     640             :                 zval_dtor(&constant);
     641             :         }
     642           1 :         return 0;
     643             : }
     644             : 
     645         128 : static zend_bool zend_verify_weak_scalar_type_hint(zend_uchar type_hint, zval *arg)
     646             : {
     647         128 :         switch (type_hint) {
     648             :                 case _IS_BOOL: {
     649             :                         zend_bool dest;
     650             : 
     651          27 :                         if (!zend_parse_arg_bool_weak(arg, &dest)) {
     652           8 :                                 return 0;
     653             :                         }
     654             :                         zval_ptr_dtor(arg);
     655          19 :                         ZVAL_BOOL(arg, dest);
     656          19 :                         return 1;
     657             :                 }
     658             :                 case IS_LONG: {
     659             :                         zend_long dest;
     660             : 
     661          32 :                         if (!zend_parse_arg_long_weak(arg, &dest)) {
     662          15 :                                 return 0;
     663             :                         }
     664             :                         zval_ptr_dtor(arg);
     665          17 :                         ZVAL_LONG(arg, dest);
     666          17 :                         return 1;
     667             :                 }
     668             :                 case IS_DOUBLE: {
     669             :                         double dest;
     670             : 
     671          28 :                         if (!zend_parse_arg_double_weak(arg, &dest)) {
     672          12 :                                 return 0;
     673             :                         }
     674             :                         zval_ptr_dtor(arg);
     675          16 :                         ZVAL_DOUBLE(arg, dest);
     676          16 :                         return 1;
     677             :                 }
     678             :                 case IS_STRING: {
     679             :                         zend_string *dest;
     680             : 
     681             :                         /* on success "arg" is converted to IS_STRING */
     682          27 :                         if (!zend_parse_arg_str_weak(arg, &dest)) {
     683           6 :                                 return 0;
     684             :                         }
     685          21 :                         return 1;
     686             :                 }
     687             :                 default:
     688          14 :                         return 0;
     689             :         }
     690             : }
     691             : 
     692         230 : static zend_bool zend_verify_scalar_type_hint(zend_uchar type_hint, zval *arg, zend_bool strict)
     693             : {
     694         230 :         if (UNEXPECTED(strict)) {
     695             :                 /* SSTH Exception: IS_LONG may be accepted as IS_DOUBLE (converted) */
     696         109 :                 if (type_hint != IS_DOUBLE || Z_TYPE_P(arg) != IS_LONG) {
     697          85 :                         return 0;
     698             :                 }
     699         142 :         } else if (UNEXPECTED(Z_TYPE_P(arg) == IS_NULL)) {
     700             :                 /* NULL may be accepted only by nullable hints (this is already checked) */
     701          17 :                 return 0;
     702             :         }
     703         128 :         return zend_verify_weak_scalar_type_hint(type_hint, arg);
     704             : }
     705             : 
     706        4297 : static void zend_verify_internal_arg_type(zend_function *zf, uint32_t arg_num, zval *arg)
     707             : {
     708             :         zend_internal_arg_info *cur_arg_info;
     709             :         char *need_msg, *class_name;
     710             :         zend_class_entry *ce;
     711             : 
     712        4297 :         if (EXPECTED(arg_num <= zf->internal_function.num_args)) {
     713        4266 :                 cur_arg_info = &zf->internal_function.arg_info[arg_num-1];
     714          31 :         } else if (zf->internal_function.fn_flags & ZEND_ACC_VARIADIC) {
     715           0 :                 cur_arg_info = &zf->internal_function.arg_info[zf->internal_function.num_args];
     716             :         } else {
     717          31 :                 return;
     718             :         }
     719             : 
     720        4266 :         if (cur_arg_info->type_hint) {
     721        1460 :                 ZVAL_DEREF(arg);
     722        2920 :                 if (EXPECTED(cur_arg_info->type_hint == Z_TYPE_P(arg))) {
     723        1317 :                         if (cur_arg_info->class_name) {
     724        1013 :                                 need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce);
     725        1013 :                                 if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce)) {
     726          70 :                                         zend_verify_arg_error(zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg);
     727             :                                 }
     728             :                         }
     729         143 :                 } else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
     730         125 :                         if (cur_arg_info->class_name) {
     731         118 :                                 need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info*)cur_arg_info, &class_name, &ce);
     732         118 :                                 zend_verify_arg_error(zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
     733           7 :                         } else if (cur_arg_info->type_hint == IS_CALLABLE) {
     734           0 :                                 if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL)) {
     735           0 :                                         zend_verify_arg_error(zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
     736             :                                 }
     737           7 :                         } else if (cur_arg_info->type_hint == _IS_BOOL &&
     738             :                                    EXPECTED(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE)) {
     739             :                                 /* pass */
     740           7 :                         } else if (UNEXPECTED(!zend_verify_scalar_type_hint(cur_arg_info->type_hint, arg, ZEND_CALL_USES_STRICT_TYPES(EG(current_execute_data))))) {
     741           7 :                                 zend_verify_arg_error(zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), zend_zval_type_name(arg), "", arg);
     742             :                         }
     743             :                 }
     744             :         }
     745             : }
     746             : 
     747       88595 : static int zend_verify_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value)
     748             : {
     749             :         zend_arg_info *cur_arg_info;
     750             :         char *need_msg, *class_name;
     751             :         zend_class_entry *ce;
     752             : 
     753       88595 :         if (EXPECTED(arg_num <= zf->common.num_args)) {
     754       88586 :                 cur_arg_info = &zf->common.arg_info[arg_num-1];
     755           9 :         } else if (zf->common.fn_flags & ZEND_ACC_VARIADIC) {
     756           9 :                 cur_arg_info = &zf->common.arg_info[zf->common.num_args];
     757             :         } else {
     758           0 :                 return 1;
     759             :         }
     760             : 
     761       88595 :         if (cur_arg_info->type_hint) {
     762       88366 :                 ZVAL_DEREF(arg);
     763      176732 :                 if (EXPECTED(cur_arg_info->type_hint == Z_TYPE_P(arg))) {
     764       88129 :                         if (cur_arg_info->class_name) {
     765       87924 :                                 need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
     766       87924 :                                 if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce)) {
     767          15 :                                         zend_verify_arg_error(zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name->val, arg);
     768          15 :                                         return 0;
     769             :                                 }
     770             :                         }
     771         237 :                 } else if (Z_TYPE_P(arg) != IS_NULL || !(cur_arg_info->allow_null || (default_value && is_null_constant(default_value)))) {
     772         185 :                         if (cur_arg_info->class_name) {
     773           7 :                                 need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
     774           7 :                                 zend_verify_arg_error(zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "", arg);
     775           7 :                                 return 0;
     776         178 :                         } else if (cur_arg_info->type_hint == IS_CALLABLE) {
     777          10 :                                 if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL)) {
     778           1 :                                         zend_verify_arg_error(zf, arg_num, "be callable", "", zend_zval_type_name(arg), "", arg);
     779           1 :                                         return 0;
     780             :                                 }
     781         254 :                         } else if (cur_arg_info->type_hint == _IS_BOOL &&
     782             :                                    EXPECTED(Z_TYPE_P(arg) == IS_FALSE || Z_TYPE_P(arg) == IS_TRUE)) {
     783             :                                 /* pass */
     784         160 :                         } else if (UNEXPECTED(!zend_verify_scalar_type_hint(cur_arg_info->type_hint, arg, ZEND_ARG_USES_STRICT_TYPES()))) {
     785         120 :                                 zend_verify_arg_error(zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), zend_zval_type_name(arg), "", arg);
     786         120 :                                 return 0;
     787             :                         }
     788             :                 }
     789             :         }
     790       88452 :         return 1;
     791             : }
     792             : 
     793           9 : static inline int zend_verify_missing_arg_type(zend_function *zf, uint32_t arg_num)
     794             : {
     795             :         zend_arg_info *cur_arg_info;
     796             :         char *need_msg;
     797             :         zend_class_entry *ce;
     798             : 
     799           9 :         if (EXPECTED(arg_num <= zf->common.num_args)) {
     800           9 :                 cur_arg_info = &zf->common.arg_info[arg_num-1];
     801           0 :         } else if (zf->common.fn_flags & ZEND_ACC_VARIADIC) {
     802           0 :                 cur_arg_info = &zf->common.arg_info[zf->common.num_args];
     803             :         } else {
     804           0 :                 return 1;
     805             :         }
     806             : 
     807           9 :         if (cur_arg_info->type_hint) {
     808           9 :                 if (cur_arg_info->class_name) {
     809             :                         char *class_name;
     810             : 
     811           2 :                         need_msg = zend_verify_arg_class_kind(cur_arg_info, &class_name, &ce);
     812           2 :                         zend_verify_arg_error(zf, arg_num, need_msg, class_name, "none", "", NULL);
     813           7 :                 } else if (cur_arg_info->type_hint == IS_CALLABLE) {
     814           1 :                         zend_verify_arg_error(zf, arg_num, "be callable", "", "none", "", NULL);
     815             :                 } else {
     816           6 :                         zend_verify_arg_error(zf, arg_num, "be of the type ", zend_get_type_by_const(cur_arg_info->type_hint), "none", "", NULL);
     817             :                 }
     818           9 :                 return 0;
     819             :         }
     820           0 :         return 1;
     821             : }
     822             : 
     823          74 : static int zend_verify_missing_arg(zend_execute_data *execute_data, uint32_t arg_num)
     824             : {
     825          83 :         if (EXPECTED(!(EX(func)->common.fn_flags & ZEND_ACC_HAS_TYPE_HINTS)) ||
     826           9 :             zend_verify_missing_arg_type(EX(func), arg_num)) {
     827          65 :                 const char *class_name = EX(func)->common.scope ? EX(func)->common.scope->name->val : "";
     828          65 :                 const char *space = EX(func)->common.scope ? "::" : "";
     829          65 :                 const char *func_name = EX(func)->common.function_name ? EX(func)->common.function_name->val : "main";
     830          65 :                 zend_execute_data *ptr = EX(prev_execute_data);
     831             : 
     832          80 :                 if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
     833          15 :                         zend_error(E_WARNING, "Missing argument %u for %s%s%s(), called in %s on line %d and defined", arg_num, class_name, space, func_name, ptr->func->op_array.filename->val, ptr->opline->lineno);
     834             :                 } else {
     835          50 :                         zend_error(E_WARNING, "Missing argument %u for %s%s%s()", arg_num, class_name, space, func_name);
     836             :                 }
     837          65 :                 return 1;
     838             :         }
     839           9 :         return 0;
     840             : }
     841             : 
     842          33 : ZEND_API void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind)
     843             : {
     844          33 :         const char *fname = zf->common.function_name->val;
     845             :         const char *fsep;
     846             :         const char *fclass;
     847             : 
     848          33 :         if (zf->common.scope) {
     849           2 :                 fsep =  "::";
     850           2 :                 fclass = zf->common.scope->name->val;
     851             :         } else {
     852          31 :                 fsep =  "";
     853          31 :                 fclass = "";
     854             :         }
     855             : 
     856          33 :         if (zf->common.type == ZEND_USER_FUNCTION) {
     857          66 :                 zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned in %s on line %d",
     858             :                         fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind,
     859          66 :                         zf->op_array.filename->val, EG(current_execute_data)->opline->lineno);
     860             :         } else {
     861           0 :                 zend_type_error("Return value of %s%s%s() must %s%s, %s%s returned",
     862             :                         fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind);
     863             :         }
     864          33 : }
     865             : 
     866           0 : ZEND_API void zend_verify_internal_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind)
     867             : {
     868           0 :         const char *fname = zf->common.function_name->val;
     869             :         const char *fsep;
     870             :         const char *fclass;
     871             : 
     872           0 :         if (zf->common.scope) {
     873           0 :                 fsep =  "::";
     874           0 :                 fclass = zf->common.scope->name->val;
     875             :         } else {
     876           0 :                 fsep =  "";
     877           0 :                 fclass = "";
     878             :         }
     879             : 
     880           0 :         zend_error_noreturn(E_CORE_ERROR, "Return value of %s%s%s() must %s%s, %s%s returned",
     881             :                 fclass, fsep, fname, need_msg, need_kind, returned_msg, returned_kind);
     882             : }
     883             : 
     884             : #if ZEND_DEBUG
     885             : static int zend_verify_internal_return_type(zend_function *zf, zval *ret)
     886             : {
     887             :         zend_arg_info *ret_info = zf->common.arg_info - 1;
     888             :         char *need_msg, *class_name;
     889             :         zend_class_entry *ce;
     890             : 
     891             : 
     892             :         if (ret_info->type_hint) {
     893             :                 if (EXPECTED(ret_info->type_hint == Z_TYPE_P(ret))) {
     894             :                         if (ret_info->class_name) {
     895             :                                 need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info *)ret_info, &class_name, &ce);
     896             :                                 if (!ce || !instanceof_function(Z_OBJCE_P(ret), ce)) {
     897             :                                         zend_verify_internal_return_error(zf, need_msg, class_name, "instance of ", Z_OBJCE_P(ret)->name->val);
     898             :                                         return 0;
     899             :                                 }
     900             :                         }
     901             :                 } else if (Z_TYPE_P(ret) != IS_NULL || !ret_info->allow_null) {
     902             :                         if (ret_info->class_name) {
     903             :                                 need_msg = zend_verify_internal_arg_class_kind((zend_internal_arg_info *)ret_info, &class_name, &ce);
     904             :                                 zend_verify_internal_return_error(zf, need_msg, class_name, zend_zval_type_name(ret), "");
     905             :                         } else if (ret_info->type_hint == IS_CALLABLE) {
     906             :                                 if (!zend_is_callable(ret, IS_CALLABLE_CHECK_SILENT, NULL) && (Z_TYPE_P(ret) != IS_NULL || !ret_info->allow_null)) {
     907             :                                         zend_verify_internal_return_error(zf, "be callable", "", zend_zval_type_name(ret), "");
     908             :                                         return 0;
     909             :                                 }
     910             :                         } else if (ret_info->type_hint == _IS_BOOL &&
     911             :                                    EXPECTED(Z_TYPE_P(ret) == IS_FALSE || Z_TYPE_P(ret) == IS_TRUE)) {
     912             :                                 /* pass */
     913             :                         } else {
     914             :                                 /* Use strict check to verify return value of internal function */
     915             :                                 zend_verify_internal_return_error(zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), zend_zval_type_name(ret), "");
     916             :                                 return 0;
     917             :                         }
     918             :                 }
     919             :         }
     920             :         return 1;
     921             : }
     922             : #endif
     923             : 
     924         105 : static void zend_verify_return_type(zend_function *zf, zval *ret)
     925             : {
     926         105 :         zend_arg_info *ret_info = zf->common.arg_info - 1;
     927             :         char *need_msg, *class_name;
     928             :         zend_class_entry *ce;
     929             : 
     930         105 :         if (ret_info->type_hint) {
     931         210 :                 if (EXPECTED(ret_info->type_hint == Z_TYPE_P(ret))) {
     932          36 :                         if (ret_info->class_name) {
     933          18 :                                 need_msg = zend_verify_arg_class_kind(ret_info, &class_name, &ce);
     934          18 :                                 if (!ce || !instanceof_function(Z_OBJCE_P(ret), ce)) {
     935           1 :                                         zend_verify_return_error(zf, need_msg, class_name, "instance of ", Z_OBJCE_P(ret)->name->val);
     936             :                                 }
     937             :                         }
     938          69 :                 } else if (Z_TYPE_P(ret) != IS_NULL || !ret_info->allow_null) {
     939          69 :                         if (ret_info->class_name) {
     940           1 :                                 need_msg = zend_verify_arg_class_kind(ret_info, &class_name, &ce);
     941           1 :                                 zend_verify_return_error(zf, need_msg, class_name, zend_zval_type_name(ret), "");
     942          68 :                         } else if (ret_info->type_hint == IS_CALLABLE) {
     943           3 :                                 if (!zend_is_callable(ret, IS_CALLABLE_CHECK_SILENT, NULL)) {
     944           0 :                                         zend_verify_return_error(zf, "be callable", "", zend_zval_type_name(ret), "");
     945             :                                 }
     946          96 :                         } else if (ret_info->type_hint == _IS_BOOL &&
     947             :                                    EXPECTED(Z_TYPE_P(ret) == IS_FALSE || Z_TYPE_P(ret) == IS_TRUE)) {
     948             :                                 /* pass */
     949          63 :                         } else if (UNEXPECTED(!zend_verify_scalar_type_hint(ret_info->type_hint, ret, ZEND_RET_USES_STRICT_TYPES()))) {
     950          30 :                                 zend_verify_return_error(zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), zend_zval_type_name(ret), "");
     951             :                         }
     952             :                 }
     953             :         }
     954         105 : }
     955             : 
     956           1 : static inline int zend_verify_missing_return_type(zend_function *zf)
     957             : {
     958           1 :         zend_arg_info *ret_info = zf->common.arg_info - 1;
     959             :         char *need_msg;
     960             :         zend_class_entry *ce;
     961             : 
     962           1 :         if (ret_info->type_hint) {
     963           1 :                 if (ret_info->class_name) {
     964             :                         char *class_name;
     965             : 
     966           0 :                         need_msg = zend_verify_arg_class_kind(ret_info, &class_name, &ce);
     967           0 :                         zend_verify_return_error(zf, need_msg, class_name, "none", "");
     968           0 :                         return 0;
     969           1 :                 } else if (ret_info->type_hint == IS_CALLABLE) {
     970           0 :                         zend_verify_return_error(zf, "be callable", "", "none", "");
     971             :                 } else {
     972           1 :                         zend_verify_return_error(zf, "be of the type ", zend_get_type_by_const(ret_info->type_hint), "none", "");
     973             :                 }
     974           1 :                 return 0;
     975             :         }
     976           0 :         return 1;
     977             : }
     978             : 
     979             : static zend_always_inline void zend_assign_to_object(zval *retval, zval *object, uint32_t object_op_type, zval *property_name, uint32_t property_op_type, int value_type, znode_op value_op, const zend_execute_data *execute_data, void **cache_slot)
     980             : {
     981             :         zend_free_op free_value;
     982      113951 :         zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
     983             :         zval tmp;
     984             : 
     985      125930 :         if (object_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) {
     986             :                 do {
     987       10096 :                         if (object_op_type == IS_VAR && UNEXPECTED(object == &EG(error_zval))) {
     988           0 :                                 if (retval) {
     989           0 :                                         ZVAL_NULL(retval);
     990             :                                 }
     991           0 :                                 FREE_OP(free_value);
     992             :                                 return;
     993             :                         }
     994       10096 :                         if (Z_ISREF_P(object)) {
     995       10068 :                                 object = Z_REFVAL_P(object);
     996       10068 :                                 if (EXPECTED(Z_TYPE_P(object) == IS_OBJECT)) {
     997             :                                         break;
     998             :                                 }
     999             :                         }
    1000          33 :                         if (EXPECTED(Z_TYPE_P(object) <= IS_FALSE ||
    1001             :                         (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0))) {
    1002             :                                 zend_object *obj;
    1003             : 
    1004             :                                 zval_ptr_dtor(object);
    1005          24 :                                 object_init(object);
    1006             :                                 Z_ADDREF_P(object);
    1007          24 :                                 obj = Z_OBJ_P(object);
    1008          24 :                                 zend_error(E_WARNING, "Creating default object from empty value");
    1009          24 :                                 if (GC_REFCOUNT(obj) == 1) {
    1010             :                                         /* the enclosing container was deleted, obj is unreferenced */
    1011           1 :                                         if (retval) {
    1012           1 :                                                 ZVAL_NULL(retval);
    1013             :                                         }
    1014           1 :                                         FREE_OP(free_value);
    1015             :                                         OBJ_RELEASE(obj);
    1016             :                                         return;
    1017             :                                 }
    1018             :                                 Z_DELREF_P(object);
    1019             :                         } else {
    1020           4 :                                 zend_error(E_WARNING, "Attempt to assign property of non-object");
    1021           4 :                                 if (retval) {
    1022           0 :                                         ZVAL_NULL(retval);
    1023             :                                 }
    1024           4 :                                 FREE_OP(free_value);
    1025             :                                 return;
    1026             :                         }
    1027             :                 } while (0);
    1028             :         }
    1029             : 
    1030      217744 :         if (property_op_type == IS_CONST &&
    1031      103798 :                 EXPECTED(Z_OBJCE_P(object) == CACHED_PTR_EX(cache_slot))) {
    1032      101495 :                 uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR_EX(cache_slot + 1);
    1033      101495 :                 zend_object *zobj = Z_OBJ_P(object);
    1034             :                 zval *property;
    1035             : 
    1036      101495 :                 if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) {
    1037       90465 :                         property = OBJ_PROP(zobj, prop_offset);
    1038       90465 :                         if (Z_TYPE_P(property) != IS_UNDEF) {
    1039             : fast_assign:
    1040      181264 :                                 value = zend_assign_to_variable(property, value, value_type);
    1041       90632 :                                 if (retval && EXPECTED(!EG(exception))) {
    1042           0 :                                         ZVAL_COPY(retval, value);
    1043             :                                 }
    1044             :                                 return;
    1045             :                         }
    1046             :                 } else {
    1047       11030 :                         if (EXPECTED(zobj->properties != NULL)) {
    1048         670 :                                 property = zend_hash_find(zobj->properties, Z_STR_P(property_name));
    1049         670 :                                 if (property) {
    1050             :                                         goto fast_assign;
    1051             :                                 }
    1052             :                         }
    1053             : 
    1054       10861 :                         if (!zobj->ce->__set) {
    1055             : 
    1056       10856 :                                 if (EXPECTED(zobj->properties == NULL)) {
    1057       10355 :                                         rebuild_object_properties(zobj);
    1058             :                                 }
    1059             :                                 /* separate our value if necessary */
    1060       10856 :                                 if (value_type == IS_CONST) {
    1061       10281 :                                         if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
    1062           2 :                                                 ZVAL_COPY_VALUE(&tmp, value);
    1063           2 :                                                 zval_copy_ctor_func(&tmp);
    1064           2 :                                                 value = &tmp;
    1065             :                                         }
    1066         575 :                                 } else if (value_type != IS_TMP_VAR) {
    1067         384 :                                         if (Z_ISREF_P(value)) {
    1068           1 :                                                 if (value_type == IS_VAR) {
    1069           1 :                                                         zend_reference *ref = Z_REF_P(value);
    1070           1 :                                                         if (--(GC_REFCOUNT(ref)) == 0) {
    1071           1 :                                                                 ZVAL_COPY_VALUE(&tmp, Z_REFVAL_P(value));
    1072           1 :                                                                 efree_size(ref, sizeof(zend_reference));
    1073           1 :                                                                 value = &tmp;
    1074             :                                                         } else {
    1075           0 :                                                                 value = Z_REFVAL_P(value);
    1076           0 :                                                                 if (Z_REFCOUNTED_P(value)) {
    1077             :                                                                         Z_ADDREF_P(value);
    1078             :                                                                 }
    1079             :                                                         }
    1080             :                                                 } else {
    1081           0 :                                                         value = Z_REFVAL_P(value);
    1082           0 :                                                         if (Z_REFCOUNTED_P(value)) {
    1083             :                                                                 Z_ADDREF_P(value);
    1084             :                                                         }
    1085             :                                                 }
    1086         383 :                                         } else if (value_type == IS_CV && Z_REFCOUNTED_P(value)) {
    1087             :                                                 Z_ADDREF_P(value);
    1088             :                                         }
    1089             :                                 }
    1090       10856 :                                 zend_hash_add_new(zobj->properties, Z_STR_P(property_name), value);
    1091       10856 :                                 if (retval) {
    1092           0 :                                         ZVAL_COPY(retval, value);
    1093             :                                 }
    1094             :                                 return;
    1095             :                         }
    1096             :         }
    1097             :         }
    1098             : 
    1099       12458 :         if (!Z_OBJ_HT_P(object)->write_property) {
    1100           0 :                 zend_error(E_WARNING, "Attempt to assign property of non-object");
    1101           0 :                 if (retval) {
    1102           0 :                         ZVAL_NULL(retval);
    1103             :                 }
    1104           0 :                 FREE_OP(free_value);
    1105             :                 return;
    1106             :         }
    1107             : 
    1108             :         /* separate our value if necessary */
    1109       12458 :         if (value_type == IS_CONST) {
    1110        1186 :                 if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
    1111          42 :                         ZVAL_COPY_VALUE(&tmp, value);
    1112          42 :                         zval_copy_ctor_func(&tmp);
    1113          42 :                         value = &tmp;
    1114             :                 }
    1115       11272 :         } else if (value_type != IS_TMP_VAR) {
    1116       11116 :                 ZVAL_DEREF(value);
    1117             :         }
    1118             : 
    1119       12458 :         Z_OBJ_HT_P(object)->write_property(object, property_name, value, cache_slot);
    1120             : 
    1121       12458 :         if (retval && EXPECTED(!EG(exception))) {
    1122          25 :                 ZVAL_COPY(retval, value);
    1123             :         }
    1124       12458 :         if (value_type == IS_CONST) {
    1125             :                 zval_ptr_dtor_nogc(value);
    1126             :         } else {
    1127       11272 :                 FREE_OP(free_value);
    1128             :         }
    1129             : }
    1130             : 
    1131        1556 : static zend_never_inline void zend_assign_to_object_dim(zval *retval, zval *object, zval *property_name, int value_type, znode_op value_op, const zend_execute_data *execute_data)
    1132             : {
    1133             :         zend_free_op free_value;
    1134        1556 :         zval *value = get_zval_ptr_deref(value_type, value_op, execute_data, &free_value, BP_VAR_R);
    1135             :         zval tmp;
    1136             : 
    1137             :         /* Note:  property_name in this case is really the array index! */
    1138        1556 :         if (!Z_OBJ_HT_P(object)->write_dimension) {
    1139           0 :                 zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
    1140           0 :                 FREE_OP(free_value);
    1141           0 :                 return;
    1142             :         }
    1143             : 
    1144             :         /* separate our value if necessary */
    1145        1556 :         if (value_type == IS_CONST) {
    1146        1447 :                 if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) {
    1147           1 :                         ZVAL_COPY_VALUE(&tmp, value);
    1148           1 :                         zval_copy_ctor_func(&tmp);
    1149           1 :                         value = &tmp;
    1150             :                 }
    1151             :         }
    1152             : 
    1153        1556 :         Z_OBJ_HT_P(object)->write_dimension(object, property_name, value);
    1154             : 
    1155        1555 :         if (retval && EXPECTED(!EG(exception))) {
    1156           5 :                 ZVAL_COPY(retval, value);
    1157             :         }
    1158        1555 :         if (value_type == IS_CONST) {
    1159             :                 zval_ptr_dtor_nogc(value);
    1160             :         } else {
    1161         109 :                 FREE_OP(free_value);
    1162             :         }
    1163             : }
    1164             : 
    1165          12 : static zend_never_inline void zend_binary_assign_op_obj_dim(zval *object, zval *property, zval *value, zval *retval, binary_op_type binary_op)
    1166             : {
    1167             :         zval *z;
    1168             :         zval rv, res;
    1169             : 
    1170          36 :         if (Z_OBJ_HT_P(object)->read_dimension &&
    1171          12 :                 (z = Z_OBJ_HT_P(object)->read_dimension(object, property, BP_VAR_R, &rv)) != NULL) {
    1172             : 
    1173          12 :                 if (Z_TYPE_P(z) == IS_OBJECT && Z_OBJ_HT_P(z)->get) {
    1174             :                         zval rv2;
    1175           4 :                         zval *value = Z_OBJ_HT_P(z)->get(z, &rv2);
    1176             : 
    1177           4 :                         if (z == &rv) {
    1178             :                                 zval_ptr_dtor(&rv);
    1179             :                         }
    1180           4 :                         ZVAL_COPY_VALUE(z, value);
    1181             :                 }
    1182          12 :                 binary_op(&res, Z_ISREF_P(z) ? Z_REFVAL_P(z) : z, value);
    1183          12 :                 Z_OBJ_HT_P(object)->write_dimension(object, property, &res);
    1184          12 :                 if (z == &rv) {
    1185             :                         zval_ptr_dtor(&rv);
    1186             :                 }
    1187          12 :                 if (retval) {
    1188           0 :                         ZVAL_COPY(retval, &res);
    1189             :                 }
    1190             :                 zval_ptr_dtor(&res);
    1191             :         } else {
    1192           0 :                 zend_error(E_WARNING, "Attempt to assign property of non-object");
    1193           0 :                 if (retval) {
    1194           0 :                         ZVAL_NULL(retval);
    1195             :                 }
    1196             :         }
    1197          12 : }
    1198             : 
    1199         145 : static void zend_assign_to_string_offset(zval *str, zend_long offset, zval *value, zval *result)
    1200             : {
    1201             :         zend_string *old_str;
    1202             : 
    1203         145 :         if (offset < 0) {
    1204           1 :                 zend_error(E_WARNING, "Illegal string offset:  " ZEND_LONG_FMT, offset);
    1205           1 :                 zend_string_release(Z_STR_P(str));
    1206           1 :                 if (result) {
    1207           0 :                         ZVAL_NULL(result);
    1208             :                 }
    1209           1 :                 return;
    1210             :         }
    1211             : 
    1212         144 :         old_str = Z_STR_P(str);
    1213         144 :         if ((size_t)offset >= Z_STRLEN_P(str)) {
    1214           3 :                 zend_long old_len = Z_STRLEN_P(str);
    1215           6 :                 Z_STR_P(str) = zend_string_extend(Z_STR_P(str), offset + 1, 0);
    1216           3 :                 Z_TYPE_INFO_P(str) = IS_STRING_EX;
    1217           3 :                 memset(Z_STRVAL_P(str) + old_len, ' ', offset - old_len);
    1218           3 :                 Z_STRVAL_P(str)[offset+1] = 0;
    1219         141 :         } else if (!Z_REFCOUNTED_P(str)) {
    1220          16 :                 Z_STR_P(str) = zend_string_init(Z_STRVAL_P(str), Z_STRLEN_P(str), 0);
    1221           8 :                 Z_TYPE_INFO_P(str) = IS_STRING_EX;
    1222             :         }
    1223             : 
    1224         144 :         if (Z_TYPE_P(value) != IS_STRING) {
    1225          11 :                 zend_string *tmp = zval_get_string(value);
    1226             : 
    1227          11 :                 Z_STRVAL_P(str)[offset] = tmp->val[0];
    1228             :                 zend_string_release(tmp);
    1229             :         } else {
    1230         133 :                 Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0];
    1231             :         }
    1232             :         /*
    1233             :          * the value of an assignment to a string offset is undefined
    1234             :         T(result->u.var).var = &T->str_offset.str;
    1235             :         */
    1236             : 
    1237             :         zend_string_release(old_str);
    1238         144 :         if (result) {
    1239          12 :                 zend_uchar c = (zend_uchar)Z_STRVAL_P(str)[offset];
    1240             : 
    1241          12 :                 if (CG(one_char_string)[c]) {
    1242           0 :                         ZVAL_INTERNED_STR(result, CG(one_char_string)[c]);
    1243             :                 } else {
    1244          24 :                         ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(str) + offset, 1, 0));
    1245             :                 }
    1246             :         }
    1247             : }
    1248             : 
    1249             : /* Utility Functions for Extensions */
    1250           0 : static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array)
    1251             : {
    1252           0 :         if (extension->statement_handler) {
    1253           0 :                 extension->statement_handler(op_array);
    1254             :         }
    1255           0 : }
    1256             : 
    1257             : 
    1258           0 : static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array)
    1259             : {
    1260           0 :         if (extension->fcall_begin_handler) {
    1261           0 :                 extension->fcall_begin_handler(op_array);
    1262             :         }
    1263           0 : }
    1264             : 
    1265             : 
    1266           0 : static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array)
    1267             : {
    1268           0 :         if (extension->fcall_end_handler) {
    1269           0 :                 extension->fcall_end_handler(op_array);
    1270             :         }
    1271           0 : }
    1272             : 
    1273             : 
    1274             : static zend_always_inline HashTable *zend_get_target_symbol_table(zend_execute_data *execute_data, int fetch_type)
    1275             : {
    1276             :         HashTable *ht;
    1277             : 
    1278      214846 :         if (EXPECTED(fetch_type == ZEND_FETCH_GLOBAL_LOCK) ||
    1279      107423 :             EXPECTED(fetch_type == ZEND_FETCH_GLOBAL)) {
    1280       13564 :                 ht = &EG(symbol_table);
    1281       93859 :         } else if (EXPECTED(fetch_type == ZEND_FETCH_STATIC)) {
    1282             :                 ZEND_ASSERT(EX(func)->op_array.static_variables != NULL);
    1283        1408 :                 ht = EX(func)->op_array.static_variables;
    1284        1408 :                 if (GC_REFCOUNT(ht) > 1) {
    1285          17 :                         if (!(GC_FLAGS(ht) & IS_ARRAY_IMMUTABLE)) {
    1286           5 :                                 GC_REFCOUNT(ht)--;
    1287             :                         }
    1288          17 :                         EX(func)->op_array.static_variables = ht = zend_array_dup(ht);
    1289             :                 }
    1290             :         } else {
    1291             :                 ZEND_ASSERT(fetch_type == ZEND_FETCH_LOCAL);
    1292       92451 :                 if (!EX(symbol_table)) {
    1293       87389 :                         zend_rebuild_symbol_table();
    1294             :                 }
    1295       92451 :                 ht = EX(symbol_table);
    1296             :         }
    1297      107423 :         return ht;
    1298             : }
    1299             : 
    1300             : static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type)
    1301             : {
    1302             :         zval *retval;
    1303             :         zend_string *offset_key;
    1304             :         zend_ulong hval;
    1305             : 
    1306             : try_again:
    1307     9329542 :         if (EXPECTED(Z_TYPE_P(dim) == IS_LONG)) {
    1308     4494104 :                 hval = Z_LVAL_P(dim);
    1309             : num_index:
    1310     4674256 :                 retval = zend_hash_index_find(ht, hval);
    1311     4674256 :                 if (retval == NULL) {
    1312      397092 :                         switch (type) {
    1313             :                                 case BP_VAR_R:
    1314          10 :                                         zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval);
    1315             :                                         /* break missing intentionally */
    1316             :                                 case BP_VAR_UNSET:
    1317             :                                 case BP_VAR_IS:
    1318          13 :                                         retval = &EG(uninitialized_zval);
    1319             :                                         break;
    1320             :                                 case BP_VAR_RW:
    1321           6 :                                         zend_error(E_NOTICE,"Undefined offset: " ZEND_ULONG_FMT, hval);
    1322             :                                         /* break missing intentionally */
    1323             :                                 case BP_VAR_W:
    1324      397079 :                                         retval = zend_hash_index_add_new(ht, hval, &EG(uninitialized_zval));
    1325             :                                         break;
    1326             :                         }
    1327             :                 }
    1328     4835438 :         } else if (EXPECTED(Z_TYPE_P(dim) == IS_STRING)) {
    1329     3741942 :                 offset_key = Z_STR_P(dim);
    1330     3741942 :                 if (dim_type != IS_CONST) {
    1331     6072026 :                         if (ZEND_HANDLE_NUMERIC(offset_key, hval)) {
    1332             :                                 goto num_index;
    1333             :                         }
    1334             :                 }
    1335             : str_index:
    1336     3561873 :                 retval = zend_hash_find(ht, offset_key);
    1337     3561873 :                 if (retval) {
    1338             :                         /* support for $GLOBALS[...] */
    1339     1602459 :                         if (UNEXPECTED(Z_TYPE_P(retval) == IS_INDIRECT)) {
    1340        7888 :                                 retval = Z_INDIRECT_P(retval);
    1341        7888 :                                 if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
    1342          21 :                                         switch (type) {
    1343             :                                                 case BP_VAR_R:
    1344           1 :                                                         zend_error(E_NOTICE, "Undefined index: %s", offset_key->val);
    1345             :                                                         /* break missing intentionally */
    1346             :                                                 case BP_VAR_UNSET:
    1347             :                                                 case BP_VAR_IS:
    1348           1 :                                                         retval = &EG(uninitialized_zval);
    1349             :                                                         break;
    1350             :                                                 case BP_VAR_RW:
    1351           0 :                                                         zend_error(E_NOTICE,"Undefined index: %s", offset_key->val);
    1352             :                                                         /* break missing intentionally */
    1353             :                                                 case BP_VAR_W:
    1354          20 :                                                         ZVAL_NULL(retval);
    1355             :                                                         break;
    1356             :                                         }
    1357             :                                 }
    1358             :                         }
    1359             :                 } else {
    1360     1959414 :                         switch (type) {
    1361             :                                 case BP_VAR_R:
    1362      160734 :                                         zend_error(E_NOTICE, "Undefined index: %s", offset_key->val);
    1363             :                                         /* break missing intentionally */
    1364             :                                 case BP_VAR_UNSET:
    1365             :                                 case BP_VAR_IS:
    1366      160734 :                                         retval = &EG(uninitialized_zval);
    1367             :                                         break;
    1368             :                                 case BP_VAR_RW:
    1369           1 :                                         zend_error(E_NOTICE,"Undefined index: %s", offset_key->val);
    1370             :                                         /* break missing intentionally */
    1371             :                                 case BP_VAR_W:
    1372     1798680 :                                         retval = zend_hash_add_new(ht, offset_key, &EG(uninitialized_zval));
    1373             :                                         break;
    1374             :                         }
    1375             :                 }
    1376             :         } else {
    1377     1093496 :                 switch (Z_TYPE_P(dim)) {
    1378             :                         case IS_NULL:
    1379          12 :                                 offset_key = STR_EMPTY_ALLOC();
    1380             :                                 goto str_index;
    1381             :                         case IS_DOUBLE:
    1382         118 :                                 hval = zend_dval_to_lval(Z_DVAL_P(dim));
    1383             :                                 goto num_index;
    1384             :                         case IS_RESOURCE:
    1385           3 :                                 zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
    1386           3 :                                 hval = Z_RES_HANDLE_P(dim);
    1387             :                                 goto num_index;
    1388             :                         case IS_FALSE:
    1389           6 :                                 hval = 0;
    1390             :                                 goto num_index;
    1391             :                         case IS_TRUE:
    1392           3 :                                 hval = 1;
    1393             :                                 goto num_index;
    1394             :                         case IS_REFERENCE:
    1395     1093407 :                                 dim = Z_REFVAL_P(dim);
    1396             :                                 goto try_again;
    1397             :                         default:
    1398           6 :                                 zend_error(E_WARNING, "Illegal offset type");
    1399           6 :                                 retval = (type == BP_VAR_W || type == BP_VAR_RW) ?
    1400             :                                         &EG(error_zval) : &EG(uninitialized_zval);
    1401             :                 }
    1402             :         }
    1403     8236135 :         return retval;
    1404             : }
    1405             : 
    1406         152 : static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type)
    1407             : {
    1408             :         zend_long offset;
    1409             : 
    1410             : try_again:
    1411         152 :         if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
    1412          15 :                 switch(Z_TYPE_P(dim)) {
    1413             :                         case IS_STRING:
    1414          30 :                                 if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
    1415           0 :                                         break;
    1416             :                                 }
    1417          15 :                                 if (type != BP_VAR_UNSET) {
    1418          14 :                                         zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
    1419             :                                 }
    1420          15 :                                 break;
    1421             :                         case IS_DOUBLE:
    1422             :                         case IS_NULL:
    1423             :                         case IS_FALSE:
    1424             :                         case IS_TRUE:
    1425           0 :                                 zend_error(E_NOTICE, "String offset cast occurred");
    1426           0 :                                 break;
    1427             :                         case IS_REFERENCE:
    1428           0 :                                 dim = Z_REFVAL_P(dim);
    1429           0 :                                 goto try_again;
    1430             :                         default:
    1431           0 :                                 zend_error(E_WARNING, "Illegal offset type");
    1432             :                                 break;
    1433             :                 }
    1434             : 
    1435          15 :                 offset = zval_get_long(dim);
    1436             :         } else {
    1437         137 :                 offset = Z_LVAL_P(dim);
    1438             :         }
    1439             : 
    1440         152 :         return offset;
    1441             : }
    1442             : 
    1443             : static zend_always_inline zend_long zend_fetch_string_offset(zval *container, zval *dim, int type)
    1444             : {
    1445         145 :         zend_long offset = zend_check_string_offset(dim, type);
    1446             : 
    1447         145 :         if (Z_REFCOUNTED_P(container)) {
    1448         136 :                 if (Z_REFCOUNT_P(container) > 1) {
    1449             :                         Z_DELREF_P(container);
    1450           6 :                         zval_copy_ctor_func(container);
    1451             :                 }
    1452             :                 Z_ADDREF_P(container);
    1453             :         }
    1454         145 :         return offset;
    1455             : }
    1456             : 
    1457             : static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *container, zval *dim, int dim_type, int type)
    1458             : {
    1459             :     zval *retval;
    1460             : 
    1461             : try_again:
    1462     1611117 :         if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
    1463     3173781 :                 SEPARATE_ARRAY(container);
    1464             : fetch_from_array:
    1465     1587186 :                 if (dim == NULL) {
    1466       66560 :                         retval = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
    1467       66560 :                         if (UNEXPECTED(retval == NULL)) {
    1468           0 :                                 zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
    1469           0 :                                 retval = &EG(error_zval);
    1470             :                         }
    1471             :                 } else {
    1472     3041252 :                         retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type);
    1473             :                 }
    1474     1587186 :                 ZVAL_INDIRECT(result, retval);
    1475       24267 :         } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
    1476           9 :                 if (type != BP_VAR_UNSET && UNEXPECTED(Z_STRLEN_P(container) == 0)) {
    1477             :                         zval_ptr_dtor_nogc(container);
    1478             : convert_to_array:
    1479         336 :                         ZVAL_NEW_ARR(container);
    1480         336 :                         zend_hash_init(Z_ARRVAL_P(container), 8, NULL, ZVAL_PTR_DTOR, 0);
    1481             :                         goto fetch_from_array;
    1482             :                 }
    1483             : 
    1484           7 :                 if (dim == NULL) {
    1485           0 :                         zend_error(E_EXCEPTION | E_ERROR, "[] operator not supported for strings");
    1486             :                 } else {
    1487           7 :                         zend_check_string_offset(dim, type);
    1488             :                 }
    1489             : 
    1490           7 :                 ZVAL_INDIRECT(result, NULL); /* wrong string offset */
    1491       24258 :         } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
    1492          52 :                 if (!Z_OBJ_HT_P(container)->read_dimension) {
    1493           0 :                         zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
    1494           0 :                         retval = &EG(error_zval);
    1495             :                 } else {
    1496          52 :                         retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
    1497             : 
    1498          52 :                         if (UNEXPECTED(retval == &EG(uninitialized_zval))) {
    1499           2 :                                 zend_class_entry *ce = Z_OBJCE_P(container);
    1500             : 
    1501           2 :                                 ZVAL_NULL(result);
    1502           2 :                                 zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name->val);
    1503          96 :                         } else if (EXPECTED(retval && Z_TYPE_P(retval) != IS_UNDEF)) {
    1504          46 :                                 if (!Z_ISREF_P(retval)) {
    1505          76 :                                         if (Z_REFCOUNTED_P(retval) &&
    1506             :                                             Z_REFCOUNT_P(retval) > 1) {
    1507           7 :                                                 if (Z_TYPE_P(retval) != IS_OBJECT) {
    1508             :                                                         Z_DELREF_P(retval);
    1509           5 :                                                         ZVAL_DUP(result, retval);
    1510           5 :                                                         retval = result;
    1511             :                                                 } else {
    1512           2 :                                                         ZVAL_COPY(result, retval);
    1513           2 :                                                         retval = result;
    1514             :                                                 }
    1515             :                                         }
    1516          40 :                                         if (Z_TYPE_P(retval) != IS_OBJECT) {
    1517           9 :                                                 zend_class_entry *ce = Z_OBJCE_P(container);
    1518           9 :                                                 zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name->val);
    1519             :                                         }
    1520             :                                 }
    1521          46 :                                 if (result != retval) {
    1522           4 :                                         ZVAL_INDIRECT(result, retval);
    1523             :                                 }
    1524             :                         } else {
    1525           4 :                                 ZVAL_INDIRECT(result, &EG(error_zval));
    1526             :                         }
    1527             :                 }
    1528       24206 :         } else if (EXPECTED(Z_TYPE_P(container) <= IS_FALSE)) {
    1529         334 :                 if (UNEXPECTED(container == &EG(error_zval))) {
    1530           0 :                         ZVAL_INDIRECT(result, &EG(error_zval));
    1531         334 :                 } else if (type != BP_VAR_UNSET) {
    1532             :                         goto convert_to_array;
    1533             :                 } else {
    1534             :                         /* for read-mode only */
    1535           0 :                         ZVAL_NULL(result);
    1536             :                 }
    1537       23872 :         } else if (EXPECTED(Z_TYPE_P(container) == IS_REFERENCE)) {
    1538       23863 :                 container = Z_REFVAL_P(container);
    1539             :                 goto try_again;
    1540             :         } else {
    1541           9 :                 if (type == BP_VAR_UNSET) {
    1542           0 :                         zend_error(E_WARNING, "Cannot unset offset in a non-array variable");
    1543           0 :                         ZVAL_NULL(result);
    1544             :                 } else {
    1545           9 :                         zend_error(E_WARNING, "Cannot use a scalar value as an array");
    1546           9 :                         ZVAL_INDIRECT(result, &EG(error_zval));
    1547             :                 }
    1548             :         }
    1549             : }
    1550             : 
    1551      323606 : static zend_never_inline void zend_fetch_dimension_address_W(zval *result, zval *container_ptr, zval *dim, int dim_type)
    1552             : {
    1553             :         zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_W);
    1554      323606 : }
    1555             : 
    1556     1263630 : static zend_never_inline void zend_fetch_dimension_address_RW(zval *result, zval *container_ptr, zval *dim, int dim_type)
    1557             : {
    1558             :         zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_RW);
    1559     1263630 : }
    1560             : 
    1561          18 : static zend_never_inline void zend_fetch_dimension_address_UNSET(zval *result, zval *container_ptr, zval *dim, int dim_type)
    1562             : {
    1563             :         zend_fetch_dimension_address(result, container_ptr, dim, dim_type, BP_VAR_UNSET);
    1564          18 : }
    1565             : 
    1566             : static zend_always_inline void zend_fetch_dimension_address_read(zval *result, zval *container, zval *dim, int dim_type, int type)
    1567             : {
    1568             :         zval *retval;
    1569             : 
    1570             : try_again:
    1571     7764056 :         if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) {
    1572     8574968 :                 retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type);
    1573     4287484 :                 ZVAL_COPY(result, retval);
    1574     3476572 :         } else if (EXPECTED(Z_TYPE_P(container) == IS_STRING)) {
    1575             :                 zend_long offset;
    1576             : 
    1577             : try_string_offset:
    1578     2381858 :                 if (UNEXPECTED(Z_TYPE_P(dim) != IS_LONG)) {
    1579          46 :                         switch(Z_TYPE_P(dim)) {
    1580             :                                 /* case IS_LONG: */
    1581             :                                 case IS_STRING:
    1582          60 :                                         if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
    1583             :                                                 break;
    1584             :                                         }
    1585          29 :                                         if (type != BP_VAR_IS) {
    1586          21 :                                                 zend_error(E_WARNING, "Illegal string offset '%s'", Z_STRVAL_P(dim));
    1587             :                                         }
    1588             :                                         break;
    1589             :                                 case IS_DOUBLE:
    1590             :                                 case IS_NULL:
    1591             :                                 case IS_FALSE:
    1592             :                                 case IS_TRUE:
    1593          13 :                                         if (type != BP_VAR_IS) {
    1594          11 :                                                 zend_error(E_NOTICE, "String offset cast occurred");
    1595             :                                         }
    1596             :                                         break;
    1597             :                                 case IS_REFERENCE:
    1598           0 :                                         dim = Z_REFVAL_P(dim);
    1599             :                                         goto try_string_offset;
    1600             :                                 default:
    1601           3 :                                         zend_error(E_WARNING, "Illegal offset type");
    1602             :                                         break;
    1603             :                         }
    1604             : 
    1605          46 :                         offset = zval_get_long(dim);
    1606             :                 } else {
    1607     2381812 :                         offset = Z_LVAL_P(dim);
    1608             :                 }
    1609             : 
    1610     2381858 :                 if (UNEXPECTED(offset < 0) || UNEXPECTED(Z_STRLEN_P(container) <= (size_t)offset)) {
    1611          37 :                         if (type != BP_VAR_IS) {
    1612          33 :                                 zend_error(E_NOTICE, "Uninitialized string offset: %pd", offset);
    1613             :                         }
    1614          37 :                         ZVAL_EMPTY_STRING(result);
    1615             :                 } else {
    1616     2381821 :                         zend_uchar c = (zend_uchar)Z_STRVAL_P(container)[offset];
    1617             : 
    1618     2381821 :                         if (CG(one_char_string)[c]) {
    1619           0 :                                 ZVAL_INTERNED_STR(result, CG(one_char_string)[c]);
    1620             :                         } else {
    1621     4763642 :                                 ZVAL_NEW_STR(result, zend_string_init(Z_STRVAL_P(container) + offset, 1, 0));
    1622             :                         }
    1623             :                 }
    1624     1094714 :         } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
    1625         761 :                 if (!Z_OBJ_HT_P(container)->read_dimension) {
    1626           0 :                         zend_error(E_EXCEPTION | E_ERROR, "Cannot use object as array");
    1627           0 :                         ZVAL_NULL(result);
    1628             :                 } else {
    1629         761 :                         retval = Z_OBJ_HT_P(container)->read_dimension(container, dim, type, result);
    1630             : 
    1631             :                         ZEND_ASSERT(result != NULL);
    1632         761 :                         if (retval) {
    1633         752 :                                 if (result != retval) {
    1634         113 :                                         ZVAL_COPY(result, retval);
    1635             :                                 }
    1636             :                         } else {
    1637           9 :                                 ZVAL_NULL(result);
    1638             :                         }
    1639             :                 }
    1640     1093953 :         } else if (EXPECTED(Z_TYPE_P(container) == IS_REFERENCE)) {
    1641     1093853 :                 container = Z_REFVAL_P(container);
    1642             :                 goto try_again;
    1643             :         } else {
    1644         100 :                 ZVAL_NULL(result);
    1645             :         }
    1646             : }
    1647             : 
    1648     6669323 : static zend_never_inline void zend_fetch_dimension_address_read_R(zval *result, zval *container, zval *dim, int dim_type)
    1649             : {
    1650             :         zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_R);
    1651     6669323 : }
    1652             : 
    1653         880 : static zend_never_inline void zend_fetch_dimension_address_read_IS(zval *result, zval *container, zval *dim, int dim_type)
    1654             : {
    1655             :         zend_fetch_dimension_address_read(result, container, dim, dim_type, BP_VAR_IS);
    1656         880 : }
    1657             : 
    1658          11 : ZEND_API void zend_fetch_dimension_by_zval(zval *result, zval *container, zval *dim)
    1659             : {
    1660          11 :         zend_fetch_dimension_address_read_R(result, container, dim, IS_TMP_VAR);
    1661          11 : }
    1662             : 
    1663             : static zend_always_inline void zend_fetch_property_address(zval *result, zval *container, uint32_t container_op_type, zval *prop_ptr, uint32_t prop_op_type, void **cache_slot, int type)
    1664             : {
    1665      263446 :     if (container_op_type != IS_UNUSED && UNEXPECTED(Z_TYPE_P(container) != IS_OBJECT)) {
    1666             :                 do {
    1667          85 :                         if (container_op_type == IS_VAR && UNEXPECTED(container == &EG(error_zval))) {
    1668           1 :                                 ZVAL_INDIRECT(result, &EG(error_zval));
    1669             :                                 return;
    1670             :                         }
    1671             : 
    1672          84 :                         if (Z_ISREF_P(container)) {
    1673          41 :                                 container = Z_REFVAL_P(container);
    1674          41 :                                 if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) {
    1675             :                                         break;
    1676             :                                 }
    1677             :                         }
    1678             : 
    1679             :                         /* this should modify object only if it's empty */
    1680          95 :                         if (type != BP_VAR_UNSET &&
    1681           3 :                             EXPECTED(Z_TYPE_P(container) <= IS_FALSE ||
    1682             :                               (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0))) {
    1683             :                                 zval_ptr_dtor_nogc(container);
    1684          37 :                                 object_init(container);
    1685             :                         } else {
    1686           6 :                                 zend_error(E_WARNING, "Attempt to modify property of non-object");
    1687           6 :                                 ZVAL_INDIRECT(result, &EG(error_zval));
    1688             :                                 return;
    1689             :                         }
    1690             :                 } while (0);
    1691             :         }
    1692      351146 :         if (prop_op_type == IS_CONST &&
    1693      175564 :             EXPECTED(Z_OBJCE_P(container) == CACHED_PTR_EX(cache_slot))) {
    1694      175154 :                 uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR_EX(cache_slot + 1);
    1695      175154 :                 zend_object *zobj = Z_OBJ_P(container);
    1696             :                 zval *retval;
    1697             : 
    1698      175154 :                 if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) {
    1699      174947 :                         retval = OBJ_PROP(zobj, prop_offset);
    1700      174947 :                         if (EXPECTED(Z_TYPE_P(retval) != IS_UNDEF)) {
    1701      174947 :                                 ZVAL_INDIRECT(result, retval);
    1702             :                                 return;
    1703             :                         }
    1704         207 :                 } else if (EXPECTED(zobj->properties != NULL)) {
    1705         201 :                         retval = zend_hash_find(zobj->properties, Z_STR_P(prop_ptr));
    1706         201 :                         if (EXPECTED(retval)) {
    1707           2 :                                 ZVAL_INDIRECT(result, retval);
    1708             :                                 return;
    1709             :                         }
    1710             :                 }
    1711             :         }
    1712         633 :         if (EXPECTED(Z_OBJ_HT_P(container)->get_property_ptr_ptr)) {
    1713         633 :                 zval *ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, cache_slot);
    1714         633 :                 if (NULL == ptr) {
    1715         112 :                         if (Z_OBJ_HT_P(container)->read_property &&
    1716          56 :                                 (ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result)) != NULL) {
    1717          56 :                                 if (ptr != result) {
    1718           3 :                                         ZVAL_INDIRECT(result, ptr);
    1719             :                                 }
    1720             :                         } else {
    1721           0 :                                 zend_error(E_EXCEPTION | E_ERROR, "Cannot access undefined property for object with overloaded property access");
    1722           0 :                                 ZVAL_INDIRECT(result, &EG(error_zval));
    1723             :                         }
    1724             :                 } else {
    1725         577 :                         ZVAL_INDIRECT(result, ptr);
    1726             :                 }
    1727           0 :         } else if (EXPECTED(Z_OBJ_HT_P(container)->read_property)) {
    1728           0 :                 zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, cache_slot, result);
    1729           0 :                 if (ptr != result) {
    1730           0 :                         ZVAL_INDIRECT(result, ptr);
    1731             :                 }
    1732             :         } else {
    1733           0 :                 zend_error(E_WARNING, "This object doesn't support property references");
    1734           0 :                 ZVAL_INDIRECT(result, &EG(error_zval));
    1735             :         }
    1736             : }
    1737             : 
    1738       79013 : static inline zend_brk_cont_element* zend_brk_cont(int nest_levels, int array_offset, const zend_op_array *op_array, const zend_execute_data *execute_data)
    1739             : {
    1740             :         zend_brk_cont_element *jmp_to;
    1741             : 
    1742             :         do {
    1743             :                 ZEND_ASSERT(array_offset != -1);
    1744       79013 :                 jmp_to = &op_array->brk_cont_array[array_offset];
    1745       79013 :                 if (nest_levels>1) {
    1746         170 :                         zend_op *brk_opline = &op_array->opcodes[jmp_to->brk];
    1747             : 
    1748         170 :                         if (brk_opline->opcode == ZEND_FREE) {
    1749           1 :                                 if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
    1750           1 :                                         zval_ptr_dtor_nogc(EX_VAR(brk_opline->op1.var));
    1751             :                                 }
    1752         169 :                         } else if (brk_opline->opcode == ZEND_FE_FREE) {
    1753          14 :                                 if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
    1754          12 :                                         zval *var = EX_VAR(brk_opline->op1.var);
    1755          12 :                                         if (Z_TYPE_P(var) != IS_ARRAY && Z_FE_ITER_P(var) != (uint32_t)-1) {
    1756           0 :                                                 zend_hash_iterator_del(Z_FE_ITER_P(var));
    1757             :                                         }
    1758             :                                         zval_ptr_dtor_nogc(var);
    1759             :                                 }
    1760             :                         }
    1761             :                 }
    1762       79013 :                 array_offset = jmp_to->parent;
    1763       79013 :         } while (--nest_levels > 0);
    1764       78843 :         return jmp_to;
    1765             : }
    1766             : 
    1767             : #if ZEND_INTENSIVE_DEBUGGING
    1768             : 
    1769             : #define CHECK_SYMBOL_TABLES()                                                                                                   \
    1770             :         zend_hash_apply(&EG(symbol_table), zend_check_symbol);                      \
    1771             :         if (&EG(symbol_table)!=EX(symbol_table)) {                                                  \
    1772             :                 zend_hash_apply(EX(symbol_table), zend_check_symbol);   \
    1773             :         }
    1774             : 
    1775             : static int zend_check_symbol(zval *pz)
    1776             : {
    1777             :         if (Z_TYPE_P(pz) == IS_INDIRECT) {
    1778             :                 pz = Z_INDIRECT_P(pz);
    1779             :         }
    1780             :         if (Z_TYPE_P(pz) > 10) {
    1781             :                 fprintf(stderr, "Warning!  %x has invalid type!\n", *pz);
    1782             : /* See http://support.microsoft.com/kb/190351 */
    1783             : #ifdef PHP_WIN32
    1784             :                 fflush(stderr);
    1785             : #endif
    1786             :         } else if (Z_TYPE_P(pz) == IS_ARRAY) {
    1787             :                 zend_hash_apply(Z_ARRVAL_P(pz), zend_check_symbol);
    1788             :         } else if (Z_TYPE_P(pz) == IS_OBJECT) {
    1789             :                 /* OBJ-TBI - doesn't support new object model! */
    1790             :                 zend_hash_apply(Z_OBJPROP_P(pz), zend_check_symbol);
    1791             :         }
    1792             : 
    1793             :         return 0;
    1794             : }
    1795             : 
    1796             : 
    1797             : #else
    1798             : #define CHECK_SYMBOL_TABLES()
    1799             : #endif
    1800             : 
    1801           0 : ZEND_API void execute_internal(zend_execute_data *execute_data, zval *return_value)
    1802             : {
    1803           0 :         execute_data->func->internal_function.handler(execute_data, return_value);
    1804           0 : }
    1805             : 
    1806       87836 : ZEND_API void zend_clean_and_cache_symbol_table(zend_array *symbol_table) /* {{{ */
    1807             : {
    1808       87836 :         if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
    1809           0 :                 zend_array_destroy(symbol_table);
    1810             :         } else {
    1811             :                 /* clean before putting into the cache, since clean
    1812             :                    could call dtors, which could use cached hash */
    1813       87836 :                 zend_symtable_clean(symbol_table);
    1814       87836 :                 *(++EG(symtable_cache_ptr)) = symbol_table;
    1815             :         }
    1816       87836 : }
    1817             : /* }}} */
    1818             : 
    1819             : static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
    1820             : {
    1821     1739235 :         zval *cv = EX_VAR_NUM(0);
    1822     1739235 :         zval *end = cv + EX(func)->op_array.last_var;
    1823     9623411 :         while (EXPECTED(cv != end)) {
    1824     7884176 :                 if (Z_REFCOUNTED_P(cv)) {
    1825     3912879 :                         if (!Z_DELREF_P(cv)) {
    1826      723111 :                                 zend_refcounted *r = Z_COUNTED_P(cv);
    1827      723111 :                                 ZVAL_NULL(cv);
    1828      723111 :                                 zval_dtor_func_for_ptr(r);
    1829             :                         } else {
    1830             :                                 GC_ZVAL_CHECK_POSSIBLE_ROOT(cv);
    1831             :                         }
    1832             :                 }
    1833     7884176 :                 cv++;
    1834             :         }
    1835             : }
    1836             : /* }}} */
    1837             : 
    1838       50385 : void zend_free_compiled_variables(zend_execute_data *execute_data) /* {{{ */
    1839             : {
    1840             :         i_free_compiled_variables(execute_data);
    1841       50385 : }
    1842             : /* }}} */
    1843             : 
    1844             : #ifdef ZEND_WIN32
    1845             : # define ZEND_VM_INTERRUPT_CHECK() do { \
    1846             :                 if (EG(timed_out)) { \
    1847             :                         zend_timeout(0); \
    1848             :                 } \
    1849             :         } while (0)
    1850             : #else
    1851             : # define ZEND_VM_INTERRUPT_CHECK() do { \
    1852             :         } while (0)
    1853             : #endif
    1854             : 
    1855             : /*
    1856             :  * Stack Frame Layout (the whole stack frame is allocated at once)
    1857             :  * ==================
    1858             :  *
    1859             :  *                             +========================================+
    1860             :  * EG(current_execute_data) -> | zend_execute_data                      |
    1861             :  *                             +----------------------------------------+
    1862             :  *     EX_CV_NUM(0) ---------> | VAR[0] = ARG[1]                        |
    1863             :  *                             | ...                                    |
    1864             :  *                             | VAR[op_array->num_args-1] = ARG[N]     |
    1865             :  *                             | ...                                    |
    1866             :  *                             | VAR[op_array->last_var-1]              |
    1867             :  *                             | VAR[op_array->last_var] = TMP[0]       |
    1868             :  *                             | ...                                    |
    1869             :  *                             | VAR[op_array->last_var+op_array->T-1]  |
    1870             :  *                             | ARG[N+1] (extra_args)                  |
    1871             :  *                             | ...                                    |
    1872             :  *                             +----------------------------------------+
    1873             :  */
    1874             : 
    1875             : static zend_always_inline void i_init_func_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value, int check_this) /* {{{ */
    1876             : {
    1877             :         uint32_t first_extra_arg, num_args;
    1878             :         ZEND_ASSERT(EX(func) == (zend_function*)op_array);
    1879             : 
    1880     1298125 :         EX(opline) = op_array->opcodes;
    1881     1298293 :         EX(call) = NULL;
    1882     1298293 :         EX(return_value) = return_value;
    1883             : 
    1884             :         /* Handle arguments */
    1885     1298293 :         first_extra_arg = op_array->num_args;
    1886     1298293 :         num_args = EX_NUM_ARGS();
    1887     1298293 :         if (UNEXPECTED(num_args > first_extra_arg)) {
    1888             :                 zval *end, *src, *dst;
    1889         472 :                 uint32_t type_flags = 0;
    1890             : 
    1891         472 :                 if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
    1892             :                         /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
    1893         469 :                         EX(opline) += first_extra_arg;
    1894             :                 }
    1895             : 
    1896             :                 /* move extra args into separate array after all CV and TMP vars */
    1897         472 :                 end = EX_VAR_NUM(first_extra_arg - 1);
    1898         472 :                 src = end + (num_args - first_extra_arg);
    1899         472 :                 dst = src + (op_array->last_var + op_array->T - first_extra_arg);
    1900         472 :                 if (EXPECTED(src != dst)) {
    1901             :                         do {
    1902       20214 :                                 type_flags |= Z_TYPE_INFO_P(src);
    1903       20214 :                                 ZVAL_COPY_VALUE(dst, src);
    1904       20214 :                                 ZVAL_UNDEF(src);
    1905       20214 :                                 src--;
    1906       20214 :                                 dst--;
    1907       20214 :                         } while (src != end);
    1908             :                 } else {
    1909             :                         do {
    1910         772 :                                 type_flags |= Z_TYPE_INFO_P(src);
    1911         772 :                                 src--;
    1912         772 :                         } while (src != end);
    1913             :                 }
    1914         472 :                 ZEND_ADD_CALL_FLAG(execute_data, ((type_flags >> Z_TYPE_FLAGS_SHIFT) & IS_TYPE_REFCOUNTED));
    1915     1297821 :         } else if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
    1916             :                 /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
    1917     1209558 :                 EX(opline) += num_args;
    1918             :         }
    1919             : 
    1920             :         /* Initialize CV variables (skip arguments) */
    1921     1298293 :         if (EXPECTED((int)num_args < op_array->last_var)) {
    1922      689977 :                 zval *var = EX_VAR_NUM(num_args);
    1923      689977 :                 zval *end = EX_VAR_NUM(op_array->last_var);
    1924             : 
    1925             :                 do {
    1926     3799327 :                         ZVAL_UNDEF(var);
    1927     3799327 :                         var++;
    1928     3799327 :                 } while (var != end);
    1929             :         }
    1930             : 
    1931     1298293 :         if (check_this && op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) {
    1932       97843 :                 ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This)));
    1933       97843 :                 GC_REFCOUNT(Z_OBJ(EX(This)))++;
    1934             :         }
    1935             : 
    1936     1298293 :         if (UNEXPECTED(!op_array->run_time_cache)) {
    1937       17032 :                 op_array->run_time_cache = zend_arena_alloc(&CG(arena), op_array->cache_size);
    1938        8516 :                 memset(op_array->run_time_cache, 0, op_array->cache_size);
    1939             :         }
    1940     1298293 :         EX_LOAD_RUN_TIME_CACHE(op_array);
    1941     1298293 :         EX_LOAD_LITERALS(op_array);
    1942             : 
    1943     1298293 :         EG(current_execute_data) = execute_data;
    1944             :         ZEND_VM_INTERRUPT_CHECK();
    1945             : }
    1946             : /* }}} */
    1947             : 
    1948             : static zend_always_inline void i_init_code_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
    1949             : {
    1950             :         ZEND_ASSERT(EX(func) == (zend_function*)op_array);
    1951             : 
    1952        8827 :         EX(opline) = op_array->opcodes;
    1953        8827 :         EX(call) = NULL;
    1954        8827 :         EX(return_value) = return_value;
    1955             : 
    1956        8827 :         zend_attach_symbol_table(execute_data);
    1957             : 
    1958        8827 :         if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) {
    1959           1 :                 ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This)));
    1960           1 :                 GC_REFCOUNT(Z_OBJ(EX(This)))++;
    1961             :         }
    1962             : 
    1963        8827 :         if (!op_array->run_time_cache) {
    1964        8827 :                 op_array->run_time_cache = emalloc(op_array->cache_size);
    1965        8827 :                 memset(op_array->run_time_cache, 0, op_array->cache_size);
    1966             :         }
    1967        8827 :         EX_LOAD_RUN_TIME_CACHE(op_array);
    1968        8827 :         EX_LOAD_LITERALS(op_array);
    1969             : 
    1970        8827 :         EG(current_execute_data) = execute_data;
    1971             :         ZEND_VM_INTERRUPT_CHECK();
    1972             : }
    1973             : /* }}} */
    1974             : 
    1975             : static zend_always_inline void i_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
    1976             : {
    1977             :         ZEND_ASSERT(EX(func) == (zend_function*)op_array);
    1978             : 
    1979      462264 :         EX(opline) = op_array->opcodes;
    1980      462264 :         EX(call) = NULL;
    1981      462264 :         EX(return_value) = return_value;
    1982             : 
    1983      462264 :         if (UNEXPECTED(EX(symbol_table) != NULL)) {
    1984       20742 :                 zend_attach_symbol_table(execute_data);
    1985             :         } else {
    1986             :                 uint32_t first_extra_arg, num_args;
    1987             : 
    1988             :                 /* Handle arguments */
    1989      441522 :                 first_extra_arg = op_array->num_args;
    1990      441522 :                 num_args = EX_NUM_ARGS();
    1991      441522 :                 if (UNEXPECTED(num_args > first_extra_arg)) {
    1992             :                         zval *end, *src, *dst;
    1993         626 :                         uint32_t type_flags = 0;
    1994             : 
    1995         626 :                         if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
    1996             :                                 /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
    1997         620 :                                 EX(opline) += first_extra_arg;
    1998             :                         }
    1999             : 
    2000             :                         /* move extra args into separate array after all CV and TMP vars */
    2001         626 :                         end = EX_VAR_NUM(first_extra_arg - 1);
    2002         626 :                         src = end + (num_args - first_extra_arg);
    2003         626 :                         dst = src + (op_array->last_var + op_array->T - first_extra_arg);
    2004         626 :                         if (EXPECTED(src != dst)) {
    2005             :                                 do {
    2006         574 :                                         type_flags |= Z_TYPE_INFO_P(src);
    2007         574 :                                         ZVAL_COPY_VALUE(dst, src);
    2008         574 :                                         ZVAL_UNDEF(src);
    2009         574 :                                         src--;
    2010         574 :                                         dst--;
    2011         574 :                                 } while (src != end);
    2012             :                         } else {
    2013             :                                 do {
    2014         735 :                                         type_flags |= Z_TYPE_INFO_P(src);
    2015         735 :                                         src--;
    2016         735 :                                 } while (src != end);
    2017             :                         }
    2018         626 :                         ZEND_ADD_CALL_FLAG(execute_data, ((type_flags >> Z_TYPE_FLAGS_SHIFT) & IS_TYPE_REFCOUNTED));
    2019      440896 :                 } else if (EXPECTED((op_array->fn_flags & ZEND_ACC_HAS_TYPE_HINTS) == 0)) {
    2020             :                         /* Skip useless ZEND_RECV and ZEND_RECV_INIT opcodes */
    2021      440882 :                         EX(opline) += num_args;
    2022             :                 }
    2023             : 
    2024             :                 /* Initialize CV variables (skip arguments) */
    2025      441522 :                 if (EXPECTED((int)num_args < op_array->last_var)) {
    2026      204867 :                         zval *var = EX_VAR_NUM(num_args);
    2027      204867 :                         zval *end = EX_VAR_NUM(op_array->last_var);
    2028             : 
    2029             :                         do {
    2030      588147 :                                 ZVAL_UNDEF(var);
    2031      588147 :                                 var++;
    2032      588147 :                         } while (var != end);
    2033             :                 }
    2034             :         }
    2035             : 
    2036      462264 :         if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) {
    2037       17451 :                 ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This)));
    2038       17451 :                 GC_REFCOUNT(Z_OBJ(EX(This)))++;
    2039             :         }
    2040             : 
    2041      462264 :         if (!op_array->run_time_cache) {
    2042       23686 :                 if (op_array->function_name) {
    2043        5888 :                         op_array->run_time_cache = zend_arena_alloc(&CG(arena), op_array->cache_size);
    2044             :                 } else {
    2045       20742 :                         op_array->run_time_cache = emalloc(op_array->cache_size);
    2046             :                 }
    2047       23686 :                 memset(op_array->run_time_cache, 0, op_array->cache_size);
    2048             :         }
    2049      462264 :         EX_LOAD_RUN_TIME_CACHE(op_array);
    2050      462264 :         EX_LOAD_LITERALS(op_array);
    2051             : 
    2052      462264 :         EG(current_execute_data) = execute_data;
    2053             :         ZEND_VM_INTERRUPT_CHECK();
    2054             : }
    2055             : /* }}} */
    2056             : 
    2057       50385 : ZEND_API zend_execute_data *zend_create_generator_execute_data(zend_execute_data *call, zend_op_array *op_array, zval *return_value) /* {{{ */
    2058             : {
    2059             :         /*
    2060             :          * Normally the execute_data is allocated on the VM stack (because it does
    2061             :          * not actually do any allocation and thus is faster). For generators
    2062             :          * though this behavior would be suboptimal, because the (rather large)
    2063             :          * structure would have to be copied back and forth every time execution is
    2064             :          * suspended or resumed. That's why for generators the execution context
    2065             :          * is allocated using a separate VM stack, thus allowing to save and
    2066             :          * restore it simply by replacing a pointer.
    2067             :          */
    2068             :         zend_execute_data *execute_data;
    2069       50385 :         uint32_t num_args = ZEND_CALL_NUM_ARGS(call);
    2070       50385 :         size_t stack_size = (ZEND_CALL_FRAME_SLOT + MAX(op_array->last_var + op_array->T, num_args)) * sizeof(zval);
    2071             :         uint32_t call_info;
    2072             : 
    2073      100770 :         EG(vm_stack) = zend_vm_stack_new_page(
    2074       50385 :                 EXPECTED(stack_size < ZEND_VM_STACK_FREE_PAGE_SIZE(1)) ?
    2075             :                         ZEND_VM_STACK_PAGE_SIZE(1) :
    2076           0 :                         ZEND_VM_STACK_PAGE_ALIGNED_SIZE(1, stack_size),
    2077             :                 NULL);
    2078       50385 :         EG(vm_stack_top) = EG(vm_stack)->top;
    2079       50385 :         EG(vm_stack_end) = EG(vm_stack)->end;
    2080             : 
    2081       50385 :         call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_ALLOCATED | (ZEND_CALL_INFO(call) & (ZEND_CALL_CLOSURE|ZEND_CALL_RELEASE_THIS));
    2082       50385 :         if (Z_OBJ(call->This)) {
    2083           5 :                 call_info |= ZEND_CALL_RELEASE_THIS;
    2084             :         }
    2085      100770 :         execute_data = zend_vm_stack_push_call_frame(
    2086             :                 call_info,
    2087             :                 (zend_function*)op_array,
    2088             :                 num_args,
    2089             :                 call->called_scope,
    2090             :                 Z_OBJ(call->This));
    2091       50385 :         EX(prev_execute_data) = NULL;
    2092       50385 :         EX_NUM_ARGS() = num_args;
    2093             : 
    2094             :         /* copy arguments */
    2095       50385 :         if (num_args > 0) {
    2096       50275 :                 zval *arg_src = ZEND_CALL_ARG(call, 1);
    2097       50275 :                 zval *arg_dst = ZEND_CALL_ARG(execute_data, 1);
    2098       50275 :                 zval *end = arg_src + num_args;
    2099             : 
    2100             :                 do {
    2101       50590 :                         ZVAL_COPY_VALUE(arg_dst, arg_src);
    2102       50590 :                         arg_src++;
    2103       50590 :                         arg_dst++;
    2104       50590 :                 } while (arg_src != end);
    2105             :         }
    2106             : 
    2107       50385 :         EX(symbol_table) = NULL;
    2108             : 
    2109             :         i_init_func_execute_data(execute_data, op_array, return_value, 1);
    2110             : 
    2111       50385 :         return execute_data;
    2112             : }
    2113             : /* }}} */
    2114             : 
    2115      441522 : ZEND_API void zend_init_execute_data(zend_execute_data *execute_data, zend_op_array *op_array, zval *return_value) /* {{{ */
    2116             : {
    2117      441522 :         EX(prev_execute_data) = EG(current_execute_data);
    2118             :         i_init_execute_data(execute_data, op_array, return_value);
    2119      441522 : }
    2120             : /* }}} */
    2121             : 
    2122             : static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(const zend_op *opline, zend_execute_data *call) /* {{{ */
    2123             : {
    2124     2353075 :         uint32_t arg_num = opline->extended_value & ZEND_FETCH_ARG_MASK;
    2125     4706150 :         return ARG_SHOULD_BE_SENT_BY_REF(call->func, arg_num);
    2126             : }
    2127             : /* }}} */
    2128             : 
    2129           3 : static zend_execute_data *zend_vm_stack_copy_call_frame(zend_execute_data *call, uint32_t passed_args, uint32_t additional_args) /* {{{ */
    2130             : {
    2131             :         zend_execute_data *new_call;
    2132           3 :         int used_stack = (EG(vm_stack_top) - (zval*)call) + additional_args;
    2133             : 
    2134             :         /* copy call frame into new stack segment */
    2135           3 :         new_call = zend_vm_stack_extend(used_stack * sizeof(zval));
    2136           3 :         *new_call = *call;
    2137           3 :         if (passed_args) {
    2138           1 :                 zval *src = ZEND_CALL_ARG(call, 1);
    2139           1 :                 zval *dst = ZEND_CALL_ARG(new_call, 1);
    2140             :                 do {
    2141       10000 :                         ZVAL_COPY_VALUE(dst, src);
    2142       10000 :                         passed_args--;
    2143       10000 :                         src++;
    2144       10000 :                         dst++;
    2145       10000 :                 } while (passed_args);
    2146             :         }
    2147             : 
    2148             :         /* delete old call_frame from previous stack segment */
    2149           3 :         EG(vm_stack)->prev->top = (zval*)call;
    2150             : 
    2151             :         /* delete previous stack segment if it becames empty */
    2152           3 :         if (UNEXPECTED(EG(vm_stack)->prev->top == ZEND_VM_STACK_ELEMETS(EG(vm_stack)->prev))) {
    2153           0 :                 zend_vm_stack r = EG(vm_stack)->prev;
    2154             : 
    2155           0 :                 EG(vm_stack)->prev = r->prev;
    2156           0 :                 efree(r);
    2157             :         }
    2158             : 
    2159           3 :         return new_call;
    2160             : }
    2161             : /* }}} */
    2162             : 
    2163             : static zend_always_inline void zend_vm_stack_extend_call_frame(zend_execute_data **call, uint32_t passed_args, uint32_t additional_args) /* {{{ */
    2164             : {
    2165         206 :         if (EXPECTED((uint32_t)(EG(vm_stack_end) - EG(vm_stack_top)) > additional_args)) {
    2166         203 :                 EG(vm_stack_top) += additional_args;
    2167             :         } else {
    2168           3 :                 *call = zend_vm_stack_copy_call_frame(*call, passed_args, additional_args);
    2169             :         }
    2170             : }
    2171             : /* }}} */
    2172             : 
    2173             : static zend_always_inline zend_generator *zend_get_running_generator(zend_execute_data *execute_data) /* {{{ */
    2174             : {
    2175             :         /* The generator object is stored in EX(return_value) */
    2176     2451615 :         zend_generator *generator = (zend_generator *) EX(return_value);
    2177             :         /* However control may currently be delegated to another generator.
    2178             :          * That's the one we're interested in. */
    2179     2451615 :         return generator;
    2180             : }
    2181             : /* }}} */
    2182             : 
    2183             : #ifdef HAVE_GCC_GLOBAL_REGS
    2184             : # if defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(i386)
    2185             : #  define ZEND_VM_FP_GLOBAL_REG "%esi"
    2186             : #  define ZEND_VM_IP_GLOBAL_REG "%edi"
    2187             : # elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__x86_64__)
    2188             : #  define ZEND_VM_FP_GLOBAL_REG "%r14"
    2189             : #  define ZEND_VM_IP_GLOBAL_REG "%r15"
    2190             : # elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(__powerpc64__)
    2191             : #  define ZEND_VM_FP_GLOBAL_REG "r28"
    2192             : #  define ZEND_VM_IP_GLOBAL_REG "r29"
    2193             : # endif
    2194             : #endif
    2195             : 
    2196             : #define ZEND_VM_NEXT_OPCODE() \
    2197             :         CHECK_SYMBOL_TABLES() \
    2198             :         ZEND_VM_INC_OPCODE(); \
    2199             :         ZEND_VM_CONTINUE()
    2200             : 
    2201             : #define ZEND_VM_SET_NEXT_OPCODE(new_op) \
    2202             :         CHECK_SYMBOL_TABLES() \
    2203             :         OPLINE = new_op
    2204             : 
    2205             : #define ZEND_VM_SET_OPCODE(new_op) \
    2206             :         CHECK_SYMBOL_TABLES() \
    2207             :         OPLINE = new_op; \
    2208             :         ZEND_VM_INTERRUPT_CHECK()
    2209             : 
    2210             : #define ZEND_VM_SET_RELATIVE_OPCODE(opline, offset) \
    2211             :         ZEND_VM_SET_OPCODE(ZEND_OFFSET_TO_OPLINE(opline, offset))
    2212             : 
    2213             : #define ZEND_VM_JMP(new_op) \
    2214             :         if (EXPECTED(!EG(exception))) { \
    2215             :                 ZEND_VM_SET_OPCODE(new_op); \
    2216             :         } else { \
    2217             :                 LOAD_OPLINE(); \
    2218             :         } \
    2219             :         ZEND_VM_CONTINUE()
    2220             : 
    2221             : #define ZEND_VM_INC_OPCODE() \
    2222             :         OPLINE++
    2223             : 
    2224             : 
    2225             : #ifndef VM_SMART_OPCODES
    2226             : # define VM_SMART_OPCODES 1
    2227             : #endif
    2228             : 
    2229             : #if VM_SMART_OPCODES
    2230             : # define ZEND_VM_REPEATABLE_OPCODE \
    2231             :         do {
    2232             : # define ZEND_VM_REPEAT_OPCODE(_opcode) \
    2233             :         } while (UNEXPECTED((++opline)->opcode == _opcode)); \
    2234             :         OPLINE = opline; \
    2235             :         ZEND_VM_CONTINUE()
    2236             : # define ZEND_VM_SMART_BRANCH(_result, _check) do { \
    2237             :                 int __result; \
    2238             :                 if (EXPECTED((opline+1)->opcode == ZEND_JMPZ)) { \
    2239             :                         __result = (_result); \
    2240             :                 } else if (EXPECTED((opline+1)->opcode == ZEND_JMPNZ)) { \
    2241             :                         __result = !(_result); \
    2242             :                 } else { \
    2243             :                         break; \
    2244             :                 } \
    2245             :                 if ((_check) && UNEXPECTED(EG(exception))) { \
    2246             :                         HANDLE_EXCEPTION(); \
    2247             :                 } \
    2248             :                 if (__result) { \
    2249             :                         ZEND_VM_SET_NEXT_OPCODE(opline + 2); \
    2250             :                 } else { \
    2251             :                         ZEND_VM_SET_OPCODE(OP_JMP_ADDR(opline + 1, (opline+1)->op2)); \
    2252             :                 } \
    2253             :                 ZEND_VM_CONTINUE(); \
    2254             :         } while (0)
    2255             : #else
    2256             : # define ZEND_VM_REPEATABLE_OPCODE
    2257             : # define ZEND_VM_REPEAT_OPCODE(_opcode)
    2258             : # define ZEND_VM_SMART_BRANCH(_result, _check)
    2259             : #endif
    2260             : 
    2261             : #ifdef __GNUC__
    2262             : # define ZEND_VM_GUARD(name) __asm__("#" #name)
    2263             : #else
    2264             : # define ZEND_VM_GUARD(name)
    2265             : #endif
    2266             : 
    2267             : #define GET_OP1_UNDEF_CV(ptr, type) \
    2268             :         _get_zval_cv_lookup_ ## type(ptr, opline->op1.var, execute_data)
    2269             : #define GET_OP2_UNDEF_CV(ptr, type) \
    2270             :         _get_zval_cv_lookup_ ## type(ptr, opline->op2.var, execute_data)
    2271             : 
    2272             : #include "zend_vm_execute.h"
    2273             : 
    2274           0 : ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler)
    2275             : {
    2276           0 :         if (opcode != ZEND_USER_OPCODE) {
    2277           0 :                 if (handler == NULL) {
    2278             :                         /* restore the original handler */
    2279           0 :                         zend_user_opcodes[opcode] = opcode;
    2280             :                 } else {
    2281           0 :                         zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
    2282             :                 }
    2283           0 :                 zend_user_opcode_handlers[opcode] = handler;
    2284           0 :                 return SUCCESS;
    2285             :         }
    2286           0 :         return FAILURE;
    2287             : }
    2288             : 
    2289           0 : ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode)
    2290             : {
    2291           0 :         return zend_user_opcode_handlers[opcode];
    2292             : }
    2293             : 
    2294           0 : ZEND_API zval *zend_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type) {
    2295           0 :         return get_zval_ptr(op_type, *node, execute_data, should_free, type);
    2296             : }
    2297             : 
    2298             : /*
    2299             :  * Local variables:
    2300             :  * tab-width: 4
    2301             :  * c-basic-offset: 4
    2302             :  * indent-tabs-mode: t
    2303             :  * End:
    2304             :  */

Generated by: LCOV version 1.10

Generated at Thu, 21 May 2015 19:58:51 +0000 (36 hours ago)

Copyright © 2005-2015 The PHP Group
All rights reserved.