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: 608 731 83.2 %
Date: 2014-04-16 Functions: 27 38 71.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend Engine                                                          |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2014 Zend Technologies Ltd. (http://www.zend.com) |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 2.00 of the Zend license,     |
       8             :    | that is bundled with this package in the file LICENSE, and is        |
       9             :    | available through the world-wide-web at the following url:           |
      10             :    | http://www.zend.com/license/2_00.txt.                                |
      11             :    | If you did not receive a copy of the Zend license and are unable to  |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@zend.com so we can mail you a copy immediately.              |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16             :    |          Zeev Suraski <zeev@zend.com>                                |
      17             :    +----------------------------------------------------------------------+
      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             : 
      42             : /* Virtual current working directory support */
      43             : #include "zend_virtual_cwd.h"
      44             : 
      45             : #define _CONST_CODE  0
      46             : #define _TMP_CODE    1
      47             : #define _VAR_CODE    2
      48             : #define _UNUSED_CODE 3
      49             : #define _CV_CODE     4
      50             : 
      51             : typedef int (*incdec_t)(zval *);
      52             : 
      53             : #define get_zval_ptr(op_type, node, ex, should_free, type) _get_zval_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
      54             : #define get_zval_ptr_ptr(op_type, node, ex, should_free, type) _get_zval_ptr_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
      55             : #define get_obj_zval_ptr(op_type, node, ex, should_free, type) _get_obj_zval_ptr(op_type, node, ex, should_free, type TSRMLS_CC)
      56             : #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 TSRMLS_CC)
      57             : 
      58             : /* Prototypes */
      59             : static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
      60             : static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
      61             : static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC);
      62             : 
      63             : #define RETURN_VALUE_USED(opline) (!((opline)->result_type & EXT_TYPE_UNUSED))
      64             : 
      65             : #define EX_T(offset) (*EX_TMP_VAR(execute_data, offset))
      66             : #define EX_CV(var)   (*EX_CV_NUM(execute_data, var))
      67             : 
      68             : #define TEMP_VAR_STACK_LIMIT 2000
      69             : 
      70             : static zend_always_inline void zend_pzval_unlock_func(zval *z, zend_free_op *should_free, int unref TSRMLS_DC)
      71             : {
      72     6502606 :         if (!Z_DELREF_P(z)) {
      73             :                 Z_SET_REFCOUNT_P(z, 1);
      74             :                 Z_UNSET_ISREF_P(z);
      75         214 :                 should_free->var = z;
      76             : /*              should_free->is_var = 1; */
      77             :         } else {
      78     6502392 :                 should_free->var = 0;
      79    13464097 :                 if (unref && Z_ISREF_P(z) && Z_REFCOUNT_P(z) == 1) {
      80             :                         Z_UNSET_ISREF_P(z);
      81             :                 }
      82             :         }
      83             : }
      84             : 
      85             : static zend_always_inline void zend_pzval_unlock_free_func(zval *z TSRMLS_DC)
      86             : {
      87             :         if (!Z_DELREF_P(z)) {
      88             :                 ZEND_ASSERT(z != &EG(uninitialized_zval));
      89             :                 GC_REMOVE_ZVAL_FROM_BUFFER(z);
      90             :                 zval_dtor(z);
      91             :                 efree(z);
      92             :         }
      93             : }
      94             : 
      95             : #undef zval_ptr_dtor
      96             : #define zval_ptr_dtor(pzv) i_zval_ptr_dtor(*(pzv) ZEND_FILE_LINE_CC TSRMLS_CC)
      97             : #define zval_ptr_dtor_nogc(pzv) i_zval_ptr_dtor_nogc(*(pzv) ZEND_FILE_LINE_CC TSRMLS_CC)
      98             : 
      99             : #define PZVAL_UNLOCK(z, f) zend_pzval_unlock_func(z, f, 1 TSRMLS_CC)
     100             : #define PZVAL_UNLOCK_EX(z, f, u) zend_pzval_unlock_func(z, f, u TSRMLS_CC)
     101             : #define PZVAL_UNLOCK_FREE(z) zend_pzval_unlock_free_func(z TSRMLS_CC)
     102             : #define PZVAL_LOCK(z) Z_ADDREF_P((z))
     103             : #define SELECTIVE_PZVAL_LOCK(pzv, opline)       if (RETURN_VALUE_USED(opline)) { PZVAL_LOCK(pzv); }
     104             : 
     105             : #define EXTRACT_ZVAL_PTR(t) do {                                \
     106             :                 temp_variable *__t = (t);                               \
     107             :                 __t->var.ptr = *__t->var.ptr_ptr;         \
     108             :                 __t->var.ptr_ptr = &__t->var.ptr;             \
     109             :                 if (!PZVAL_IS_REF(__t->var.ptr) &&           \
     110             :                     Z_REFCOUNT_P(__t->var.ptr) > 2) {     \
     111             :                         SEPARATE_ZVAL(__t->var.ptr_ptr);     \
     112             :                 }                                                                               \
     113             :         } while (0)
     114             : 
     115             : #define AI_SET_PTR(t, val) do {                         \
     116             :                 temp_variable *__t = (t);                       \
     117             :                 __t->var.ptr = (val);                                \
     118             :                 __t->var.ptr_ptr = &__t->var.ptr;     \
     119             :         } while (0)
     120             : 
     121             : #define FREE_OP(should_free) \
     122             :         if (should_free.var) { \
     123             :                 if ((zend_uintptr_t)should_free.var & 1L) { \
     124             :                         zval_dtor((zval*)((zend_uintptr_t)should_free.var & ~1L)); \
     125             :                 } else { \
     126             :                         zval_ptr_dtor_nogc(&should_free.var); \
     127             :                 } \
     128             :         }
     129             : 
     130             : #define FREE_OP_IF_VAR(should_free) \
     131             :         if (should_free.var != NULL && (((zend_uintptr_t)should_free.var & 1L) == 0)) { \
     132             :                 zval_ptr_dtor_nogc(&should_free.var); \
     133             :         }
     134             : 
     135             : #define FREE_OP_VAR_PTR(should_free) \
     136             :         if (should_free.var) { \
     137             :                 zval_ptr_dtor_nogc(&should_free.var); \
     138             :         }
     139             : 
     140             : #define TMP_FREE(z) (zval*)(((zend_uintptr_t)(z)) | 1L)
     141             : 
     142             : #define IS_TMP_FREE(should_free) ((zend_uintptr_t)should_free.var & 1L)
     143             : 
     144             : #define MAKE_REAL_ZVAL_PTR(val) \
     145             :         do { \
     146             :                 zval *_tmp; \
     147             :                 ALLOC_ZVAL(_tmp); \
     148             :                 INIT_PZVAL_COPY(_tmp, (val)); \
     149             :                 (val) = _tmp; \
     150             :         } while (0)
     151             : 
     152             : /* End of zend_execute_locks.h */
     153             : 
     154             : #define CV_DEF_OF(i) (EG(active_op_array)->vars[i])
     155             : 
     156             : #define CTOR_CALL_BIT    0x1
     157             : #define CTOR_USED_BIT    0x2
     158             : 
     159             : #define IS_CTOR_CALL(ce) (((zend_uintptr_t)(ce)) & CTOR_CALL_BIT)
     160             : #define IS_CTOR_USED(ce) (((zend_uintptr_t)(ce)) & CTOR_USED_BIT)
     161             : 
     162             : #define ENCODE_CTOR(ce, used) \
     163             :         ((zend_class_entry*)(((zend_uintptr_t)(ce)) | CTOR_CALL_BIT | ((used) ? CTOR_USED_BIT : 0)))
     164             : #define DECODE_CTOR(ce) \
     165             :         ((zend_class_entry*)(((zend_uintptr_t)(ce)) & ~(CTOR_CALL_BIT|CTOR_USED_BIT)))
     166             : 
     167             : #undef EX
     168             : #define EX(element) execute_data->element
     169             : 
     170           0 : ZEND_API zval** zend_get_compiled_variable_value(const zend_execute_data *execute_data, zend_uint var)
     171             : {
     172           0 :         return EX_CV(var);
     173             : }
     174             : 
     175             : static zend_always_inline zval *_get_zval_ptr_tmp(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
     176             : {
     177    32669756 :         return should_free->var = &EX_T(var).tmp_var;
     178             : }
     179             : 
     180             : static zend_always_inline zval *_get_zval_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
     181             : {
     182    28973493 :         zval *ptr = EX_T(var).var.ptr;
     183             : 
     184    28973493 :         return should_free->var = ptr;
     185             : }
     186             : 
     187          10 : static zend_never_inline zval **_get_zval_cv_lookup(zval ***ptr, zend_uint var, int type TSRMLS_DC)
     188             : {
     189          10 :         zend_compiled_variable *cv = &CV_DEF_OF(var);
     190             : 
     191          20 :         if (!EG(active_symbol_table) ||
     192          10 :             zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
     193          10 :                 switch (type) {
     194             :                         case BP_VAR_R:
     195             :                         case BP_VAR_UNSET:
     196          10 :                                 zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
     197             :                                 /* break missing intentionally */
     198             :                         case BP_VAR_IS:
     199          10 :                                 return &EG(uninitialized_zval_ptr);
     200             :                                 break;
     201             :                         case BP_VAR_RW:
     202           0 :                                 zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
     203             :                                 /* break missing intentionally */
     204             :                         case BP_VAR_W:
     205             :                                 Z_ADDREF(EG(uninitialized_zval));
     206           0 :                                 if (!EG(active_symbol_table)) {
     207           0 :                                         *ptr = (zval**)EX_CV_NUM(EG(current_execute_data), EG(active_op_array)->last_var + var);
     208           0 :                                         **ptr = &EG(uninitialized_zval);
     209             :                                 } else {
     210           0 :                                         zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr);
     211             :                                 }
     212             :                                 break;
     213             :                 }
     214             :         }
     215           0 :         return *ptr;
     216             : }
     217             : 
     218       13646 : static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_R(zval ***ptr, zend_uint var TSRMLS_DC)
     219             : {
     220       13646 :         zend_compiled_variable *cv = &CV_DEF_OF(var);
     221             : 
     222       27255 :         if (!EG(active_symbol_table) ||
     223       13609 :             zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
     224         591 :                 zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
     225         591 :                 return &EG(uninitialized_zval_ptr);
     226             :         }
     227       13055 :         return *ptr;
     228             : }
     229             : 
     230          40 : static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_UNSET(zval ***ptr, zend_uint var TSRMLS_DC)
     231             : {
     232          40 :         zend_compiled_variable *cv = &CV_DEF_OF(var);
     233             : 
     234          80 :         if (!EG(active_symbol_table) ||
     235          40 :             zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
     236           0 :                 zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
     237           0 :                 return &EG(uninitialized_zval_ptr);
     238             :         }
     239          40 :         return *ptr;
     240             : }
     241             : 
     242          67 : static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_IS(zval ***ptr, zend_uint var TSRMLS_DC)
     243             : {
     244          67 :         zend_compiled_variable *cv = &CV_DEF_OF(var);
     245             : 
     246         134 :         if (!EG(active_symbol_table) ||
     247          67 :             zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
     248           4 :                 return &EG(uninitialized_zval_ptr);
     249             :         }
     250          63 :         return *ptr;
     251             : }
     252             : 
     253           5 : static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_RW(zval ***ptr, zend_uint var TSRMLS_DC)
     254             : {
     255           5 :         zend_compiled_variable *cv = &CV_DEF_OF(var);
     256             : 
     257           5 :         if (!EG(active_symbol_table)) {
     258             :                 Z_ADDREF(EG(uninitialized_zval));
     259           1 :                 *ptr = (zval**)EX_CV_NUM(EG(current_execute_data), EG(active_op_array)->last_var + var);
     260           1 :                 **ptr = &EG(uninitialized_zval);
     261           1 :                 zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
     262           4 :         } else if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
     263             :                 Z_ADDREF(EG(uninitialized_zval));
     264           2 :                 zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr);
     265           2 :                 zend_error(E_NOTICE, "Undefined variable: %s", cv->name);
     266             :         }
     267           5 :         return *ptr;
     268             : }
     269             : 
     270     8664843 : static zend_never_inline zval **_get_zval_cv_lookup_BP_VAR_W(zval ***ptr, zend_uint var TSRMLS_DC)
     271             : {
     272     8664843 :         zend_compiled_variable *cv = &CV_DEF_OF(var);
     273             : 
     274     8664843 :         if (!EG(active_symbol_table)) {
     275             :                 Z_ADDREF(EG(uninitialized_zval));
     276     7959936 :                 *ptr = (zval**)EX_CV_NUM(EG(current_execute_data), EG(active_op_array)->last_var + var);
     277     7959936 :                 **ptr = &EG(uninitialized_zval);
     278      704907 :         } else if (zend_hash_quick_find(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, (void **)ptr)==FAILURE) {
     279             :                 Z_ADDREF(EG(uninitialized_zval));
     280      703986 :                 zend_hash_quick_update(EG(active_symbol_table), cv->name, cv->name_len+1, cv->hash_value, &EG(uninitialized_zval_ptr), sizeof(zval *), (void **)ptr);
     281             :         }
     282     8664843 :         return *ptr;
     283             : }
     284             : 
     285             : static zend_always_inline zval *_get_zval_ptr_cv(zend_uint var, int type TSRMLS_DC)
     286             : {
     287     3257706 :         zval ***ptr = EX_CV_NUM(EG(current_execute_data), var);
     288             : 
     289     3257706 :         if (UNEXPECTED(*ptr == NULL)) {
     290          10 :                 return *_get_zval_cv_lookup(ptr, var, type TSRMLS_CC);
     291             :         }
     292     3257696 :         return **ptr;
     293             : }
     294             : 
     295             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     296             : {
     297    55470081 :         zval ***ptr = EX_CV_NUM(execute_data, var);
     298             : 
     299    55470081 :         if (UNEXPECTED(*ptr == NULL)) {
     300       13646 :                 return *_get_zval_cv_lookup_BP_VAR_R(ptr, var TSRMLS_CC);
     301             :         }
     302    55456435 :         return **ptr;
     303             : }
     304             : 
     305             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     306             : {
     307             :         zval ***ptr = EX_CV_NUM(execute_data, var);
     308             : 
     309             :         if (UNEXPECTED(*ptr == NULL)) {
     310             :                 return *_get_zval_cv_lookup_BP_VAR_UNSET(ptr, var TSRMLS_CC);
     311             :         }
     312             :         return **ptr;
     313             : }
     314             : 
     315             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     316             : {
     317      461304 :         zval ***ptr = EX_CV_NUM(execute_data, var);
     318             : 
     319      461304 :         if (UNEXPECTED(*ptr == NULL)) {
     320          67 :                 return *_get_zval_cv_lookup_BP_VAR_IS(ptr, var TSRMLS_CC);
     321             :         }
     322      461237 :         return **ptr;
     323             : }
     324             : 
     325             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     326             : {
     327             :         zval ***ptr = EX_CV_NUM(execute_data, var);
     328             : 
     329             :         if (UNEXPECTED(*ptr == NULL)) {
     330             :                 return *_get_zval_cv_lookup_BP_VAR_RW(ptr, var TSRMLS_CC);
     331             :         }
     332             :         return **ptr;
     333             : }
     334             : 
     335             : static zend_always_inline zval *_get_zval_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     336             : {
     337             :         zval ***ptr = EX_CV_NUM(execute_data, var);
     338             : 
     339             :         if (UNEXPECTED(*ptr == NULL)) {
     340             :                 return *_get_zval_cv_lookup_BP_VAR_W(ptr, var TSRMLS_CC);
     341             :         }
     342             :         return **ptr;
     343             : }
     344             : 
     345     4252641 : static inline zval *_get_zval_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
     346             : {
     347             : /*      should_free->is_var = 0; */
     348     4252641 :         switch (op_type) {
     349             :                 case IS_CONST:
     350      533650 :                         should_free->var = 0;
     351      533650 :                         return node->zv;
     352             :                         break;
     353             :                 case IS_TMP_VAR:
     354      237591 :                         should_free->var = TMP_FREE(&EX_T(node->var).tmp_var);
     355      237591 :                         return &EX_T(node->var).tmp_var;
     356             :                         break;
     357             :                 case IS_VAR:
     358      447388 :                         return _get_zval_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
     359             :                         break;
     360             :                 case IS_UNUSED:
     361           0 :                         should_free->var = 0;
     362           0 :                         return NULL;
     363             :                         break;
     364             :                 case IS_CV:
     365     3257706 :                         should_free->var = 0;
     366     6515412 :                         return _get_zval_ptr_cv(node->var, type TSRMLS_CC);
     367             :                         break;
     368             :                 EMPTY_SWITCH_DEFAULT_CASE()
     369             :         }
     370           0 :         return NULL;
     371             : }
     372             : 
     373             : static zend_always_inline zval **_get_zval_ptr_ptr_var(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
     374             : {
     375     6502525 :         zval** ptr_ptr = EX_T(var).var.ptr_ptr;
     376             : 
     377     6502525 :         if (EXPECTED(ptr_ptr != NULL)) {
     378     6502375 :                 PZVAL_UNLOCK(*ptr_ptr, should_free);
     379             :         } else {
     380             :                 /* string offset */
     381         150 :                 PZVAL_UNLOCK(EX_T(var).str_offset.str, should_free);
     382             :         }
     383     6502525 :         return ptr_ptr;
     384             : }
     385             : 
     386             : static zend_always_inline zval **_get_zval_ptr_ptr_var_fast(zend_uint var, const zend_execute_data *execute_data, zend_free_op *should_free TSRMLS_DC)
     387             : {
     388             :         zval** ptr_ptr = EX_T(var).var.ptr_ptr;
     389             : 
     390             :         if (EXPECTED(ptr_ptr != NULL)) {
     391             :                 should_free->var = *ptr_ptr;
     392             :         } else {
     393             :                 /* string offset */
     394             :                 should_free->var = EX_T(var).str_offset.str;
     395             :         }
     396             :         return ptr_ptr;
     397             : }
     398             : 
     399             : static zend_always_inline zval **_get_zval_ptr_ptr_cv(zend_uint var, int type TSRMLS_DC)
     400             : {
     401           0 :         zval ***ptr = EX_CV_NUM(EG(current_execute_data), var);
     402             : 
     403           0 :         if (UNEXPECTED(*ptr == NULL)) {
     404           0 :                 return _get_zval_cv_lookup(ptr, var, type TSRMLS_CC);
     405             :         }
     406           0 :         return *ptr;
     407             : }
     408             : 
     409             : static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_R(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     410             : {
     411         119 :         zval ***ptr = EX_CV_NUM(execute_data, var);
     412             : 
     413         119 :         if (UNEXPECTED(*ptr == NULL)) {
     414           0 :                 return _get_zval_cv_lookup_BP_VAR_R(ptr, var TSRMLS_CC);
     415             :         }
     416         119 :         return *ptr;
     417             : }
     418             : 
     419             : static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_UNSET(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     420             : {
     421       22253 :         zval ***ptr = EX_CV_NUM(execute_data, var);
     422             : 
     423       22253 :         if (UNEXPECTED(*ptr == NULL)) {
     424          40 :                 return _get_zval_cv_lookup_BP_VAR_UNSET(ptr, var TSRMLS_CC);
     425             :         }
     426       22213 :         return *ptr;
     427             : }
     428             : 
     429             : static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_IS(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     430             : {
     431             :         zval ***ptr = EX_CV_NUM(execute_data, var);
     432             : 
     433             :         if (UNEXPECTED(*ptr == NULL)) {
     434             :                 return _get_zval_cv_lookup_BP_VAR_IS(ptr, var TSRMLS_CC);
     435             :         }
     436             :         return *ptr;
     437             : }
     438             : 
     439             : static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_RW(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     440             : {
     441    10360668 :         zval ***ptr = EX_CV_NUM(execute_data, var);
     442             : 
     443    10360668 :         if (UNEXPECTED(*ptr == NULL)) {
     444           5 :                 return _get_zval_cv_lookup_BP_VAR_RW(ptr, var TSRMLS_CC);
     445             :         }
     446    10360663 :         return *ptr;
     447             : }
     448             : 
     449             : static zend_always_inline zval **_get_zval_ptr_ptr_cv_BP_VAR_W(const zend_execute_data *execute_data, zend_uint var TSRMLS_DC)
     450             : {
     451    30174272 :         zval ***ptr = EX_CV_NUM(execute_data, var);
     452             : 
     453    30174272 :         if (UNEXPECTED(*ptr == NULL)) {
     454     8664843 :                 return _get_zval_cv_lookup_BP_VAR_W(ptr, var TSRMLS_CC);
     455             :         }
     456    21509429 :         return *ptr;
     457             : }
     458             : 
     459           0 : static inline zval **_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
     460             : {
     461           0 :         if (op_type == IS_CV) {
     462           0 :                 should_free->var = 0;
     463           0 :                 return _get_zval_ptr_ptr_cv(node->var, type TSRMLS_CC);
     464           0 :         } else if (op_type == IS_VAR) {
     465           0 :                 return _get_zval_ptr_ptr_var(node->var, execute_data, should_free TSRMLS_CC);
     466             :         } else {
     467           0 :                 should_free->var = 0;
     468           0 :                 return NULL;
     469             :         }
     470             : }
     471             : 
     472             : static zend_always_inline zval *_get_obj_zval_ptr_unused(TSRMLS_D)
     473             : {
     474       31533 :         if (EXPECTED(EG(This) != NULL)) {
     475       31531 :                 return EG(This);
     476             :         } else {
     477           2 :                 zend_error_noreturn(E_ERROR, "Using $this when not in object context");
     478             :                 return NULL;
     479             :         }
     480             : }
     481             : 
     482             : static inline zval **_get_obj_zval_ptr_ptr(int op_type, const znode_op *op, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
     483             : {
     484             :         if (op_type == IS_UNUSED) {
     485             :                 if (EXPECTED(EG(This) != NULL)) {
     486             :                         /* this should actually never be modified, _ptr_ptr is modified only when
     487             :                            the object is empty */
     488             :                         should_free->var = 0;
     489             :                         return &EG(This);
     490             :                 } else {
     491             :                         zend_error_noreturn(E_ERROR, "Using $this when not in object context");
     492             :                 }
     493             :         }
     494             :         return get_zval_ptr_ptr(op_type, op, execute_data, should_free, type);
     495             : }
     496             : 
     497             : static zend_always_inline zval **_get_obj_zval_ptr_ptr_unused(TSRMLS_D)
     498             : {
     499      194070 :         if (EXPECTED(EG(This) != NULL)) {
     500      194068 :                 return &EG(This);
     501             :         } else {
     502           2 :                 zend_error_noreturn(E_ERROR, "Using $this when not in object context");
     503             :                 return NULL;
     504             :         }
     505             : }
     506             : 
     507             : static inline zval *_get_obj_zval_ptr(int op_type, znode_op *op, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC)
     508             : {
     509             :         if (op_type == IS_UNUSED) {
     510             :                 if (EXPECTED(EG(This) != NULL)) {
     511             :                         should_free->var = 0;
     512             :                         return EG(This);
     513             :                 } else {
     514             :                         zend_error_noreturn(E_ERROR, "Using $this when not in object context");
     515             :                 }
     516             :         }
     517             :         return get_zval_ptr(op_type, op, execute_data, should_free, type);
     518             : }
     519             : 
     520      962952 : static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **value_ptr_ptr TSRMLS_DC)
     521             : {
     522      962952 :         zval *variable_ptr = *variable_ptr_ptr;
     523      962952 :         zval *value_ptr = *value_ptr_ptr;
     524             : 
     525      962963 :         if (variable_ptr == &EG(error_zval) || value_ptr == &EG(error_zval)) {
     526          11 :                 variable_ptr_ptr = &EG(uninitialized_zval_ptr);
     527      962941 :         } else if (variable_ptr != value_ptr) {
     528      951982 :                 if (!PZVAL_IS_REF(value_ptr)) {
     529             :                         /* break it away */
     530             :                         Z_DELREF_P(value_ptr);
     531      651845 :                         if (Z_REFCOUNT_P(value_ptr)>0) {
     532          51 :                                 ALLOC_ZVAL(*value_ptr_ptr);
     533          51 :                                 ZVAL_COPY_VALUE(*value_ptr_ptr, value_ptr);
     534          51 :                                 value_ptr = *value_ptr_ptr;
     535             :                                 zendi_zval_copy_ctor(*value_ptr);
     536             :                         }
     537             :                         Z_SET_REFCOUNT_P(value_ptr, 1);
     538             :                         Z_SET_ISREF_P(value_ptr);
     539             :                 }
     540             : 
     541      951982 :                 *variable_ptr_ptr = value_ptr;
     542             :                 Z_ADDREF_P(value_ptr);
     543             : 
     544      951982 :                 zval_ptr_dtor(&variable_ptr);
     545       21918 :         } else if (!Z_ISREF_P(variable_ptr)) {
     546         852 :                 if (variable_ptr_ptr == value_ptr_ptr) {
     547        1348 :                         SEPARATE_ZVAL(variable_ptr_ptr);
     548         280 :                 } else if (variable_ptr==&EG(uninitialized_zval)
     549         280 :                         || Z_REFCOUNT_P(variable_ptr)>2) {
     550             :                         /* we need to separate */
     551         552 :                         Z_SET_REFCOUNT_P(variable_ptr, Z_REFCOUNT_P(variable_ptr) - 2);
     552         276 :                         ALLOC_ZVAL(*variable_ptr_ptr);
     553         276 :                         ZVAL_COPY_VALUE(*variable_ptr_ptr, variable_ptr);
     554         276 :                         zval_copy_ctor(*variable_ptr_ptr);
     555         276 :                         *value_ptr_ptr = *variable_ptr_ptr;
     556         276 :                         Z_SET_REFCOUNT_PP(variable_ptr_ptr, 2);
     557             :                 }
     558         852 :                 Z_SET_ISREF_PP(variable_ptr_ptr);
     559             :         }
     560      962952 : }
     561             : 
     562             : /* this should modify object only if it's empty */
     563        4350 : static inline void make_real_object(zval **object_ptr TSRMLS_DC)
     564             : {
     565       17393 :         if (Z_TYPE_PP(object_ptr) == IS_NULL
     566        8698 :                 || (Z_TYPE_PP(object_ptr) == IS_BOOL && Z_LVAL_PP(object_ptr) == 0)
     567        4345 :                 || (Z_TYPE_PP(object_ptr) == IS_STRING && Z_STRLEN_PP(object_ptr) == 0)
     568             :         ) {
     569          47 :                 SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
     570          11 :                 zval_dtor(*object_ptr);
     571          11 :                 object_init(*object_ptr);
     572          11 :                 zend_error(E_WARNING, "Creating default object from empty value");
     573             :         }
     574        4350 : }
     575             : 
     576       89015 : ZEND_API char * zend_verify_arg_class_kind(const zend_arg_info *cur_arg_info, ulong fetch_type, const char **class_name, zend_class_entry **pce TSRMLS_DC)
     577             : {
     578       89015 :         *pce = zend_fetch_class(cur_arg_info->class_name, cur_arg_info->class_name_len, (fetch_type | ZEND_FETCH_CLASS_AUTO | ZEND_FETCH_CLASS_NO_AUTOLOAD) TSRMLS_CC);
     579             : 
     580       89015 :         *class_name = (*pce) ? (*pce)->name: cur_arg_info->class_name;
     581       89015 :         if (*pce && (*pce)->ce_flags & ZEND_ACC_INTERFACE) {
     582         683 :                 return "implement interface ";
     583             :         } else {
     584       88332 :                 return "be an instance of ";
     585             :         }
     586             : }
     587             : 
     588         161 : ZEND_API int zend_verify_arg_error(int error_type, const zend_function *zf, zend_uint arg_num, const char *need_msg, const char *need_kind, const char *given_msg, const char *given_kind TSRMLS_DC)
     589             : {
     590         161 :         zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
     591         161 :         const char *fname = zf->common.function_name;
     592             :         char *fsep;
     593             :         const char *fclass;
     594             : 
     595         161 :         if (zf->common.scope) {
     596          30 :                 fsep =  "::";
     597          30 :                 fclass = zf->common.scope->name;
     598             :         } else {
     599         131 :                 fsep =  "";
     600         131 :                 fclass = "";
     601             :         }
     602             : 
     603         165 :         if (ptr && ptr->op_array) {
     604          22 :                 zend_error(error_type, "Argument %d passed to %s%s%s() must %s%s, %s%s given, called in %s on line %d and defined", arg_num, fclass, fsep, fname, need_msg, need_kind, given_msg, given_kind, ptr->op_array->filename, ptr->opline->lineno);
     605             :         } else {
     606         139 :                 zend_error(error_type, "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);
     607             :         }
     608         101 :         return 0;
     609             : }
     610             : 
     611     5320880 : static inline int zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zval *arg, ulong fetch_type TSRMLS_DC)
     612             : {
     613             :         zend_arg_info *cur_arg_info;
     614             :         char *need_msg;
     615             :         zend_class_entry *ce;
     616             : 
     617     5320880 :         if (!zf->common.arg_info) {
     618           0 :                 return 1;
     619             :         }
     620             : 
     621     5320880 :         if (arg_num <= zf->common.num_args) {
     622     5300785 :                 cur_arg_info = &zf->common.arg_info[arg_num-1];
     623       20095 :         } else if (zf->common.fn_flags & ZEND_ACC_VARIADIC) {
     624       20062 :                 cur_arg_info = &zf->common.arg_info[zf->common.num_args-1];
     625             :         } else {
     626          33 :                 return 1;
     627             :         }
     628             : 
     629     5320847 :         if (cur_arg_info->class_name) {
     630             :                 const char *class_name;
     631             : 
     632       89055 :                 if (!arg) {
     633           2 :                         need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
     634           2 :                         return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "none", "" TSRMLS_CC);
     635             :                 }
     636       89053 :                 if (Z_TYPE_P(arg) == IS_OBJECT) {
     637       88944 :                         need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
     638       88944 :                         if (!ce || !instanceof_function(Z_OBJCE_P(arg), ce TSRMLS_CC)) {
     639          75 :                                 return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, "instance of ", Z_OBJCE_P(arg)->name TSRMLS_CC);
     640             :                         }
     641         109 :                 } else if (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null) {
     642          69 :                         need_msg = zend_verify_arg_class_kind(cur_arg_info, fetch_type, &class_name, &ce TSRMLS_CC);
     643          69 :                         return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, need_msg, class_name, zend_zval_type_name(arg), "" TSRMLS_CC);
     644             :                 }
     645     5231792 :         } else if (cur_arg_info->type_hint) {
     646         485 :                 switch(cur_arg_info->type_hint) {
     647             :                         case IS_ARRAY:
     648         476 :                                 if (!arg) {
     649           2 :                                         return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", "none", "" TSRMLS_CC);
     650             :                                 }
     651             : 
     652         474 :                                 if (Z_TYPE_P(arg) != IS_ARRAY && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
     653          12 :                                         return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be of the type array", "", zend_zval_type_name(arg), "" TSRMLS_CC);
     654             :                                 }
     655         462 :                                 break;
     656             : 
     657             :                         case IS_CALLABLE:
     658           9 :                                 if (!arg) {
     659           1 :                                         return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", "none", "" TSRMLS_CC);
     660             :                                 }
     661           8 :                                 if (!zend_is_callable(arg, IS_CALLABLE_CHECK_SILENT, NULL TSRMLS_CC) && (Z_TYPE_P(arg) != IS_NULL || !cur_arg_info->allow_null)) {
     662           0 :                                         return zend_verify_arg_error(E_RECOVERABLE_ERROR, zf, arg_num, "be callable", "", zend_zval_type_name(arg), "" TSRMLS_CC);
     663             :                                 }
     664           8 :                                 break;
     665             : 
     666             :                         default:
     667           0 :                                 zend_error(E_ERROR, "Unknown typehint");
     668             :                 }
     669             :         }
     670     5320686 :         return 1;
     671             : }
     672             : 
     673      114844 : static inline void zend_assign_to_object(zval **retval, zval **object_ptr, zval *property_name, int value_type, znode_op *value_op, const zend_execute_data *execute_data, int opcode, const zend_literal *key TSRMLS_DC)
     674             : {
     675      114844 :         zval *object = *object_ptr;
     676             :         zend_free_op free_value;
     677      114844 :         zval *value = get_zval_ptr(value_type, value_op, execute_data, &free_value, BP_VAR_R);
     678             : 
     679      114844 :         if (Z_TYPE_P(object) != IS_OBJECT) {
     680          27 :                 if (object == &EG(error_zval)) {
     681           0 :                         if (retval) {
     682           0 :                                 *retval = &EG(uninitialized_zval);
     683           0 :                                 PZVAL_LOCK(*retval);
     684             :                         }
     685           0 :                         FREE_OP(free_value);
     686           0 :                         return;
     687             :                 }
     688          65 :                 if (Z_TYPE_P(object) == IS_NULL ||
     689           9 :                     (Z_TYPE_P(object) == IS_BOOL && Z_LVAL_P(object) == 0) ||
     690           7 :                     (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0)) {
     691         103 :                         SEPARATE_ZVAL_IF_NOT_REF(object_ptr);
     692          23 :                         object = *object_ptr;
     693          23 :                         Z_ADDREF_P(object);
     694          23 :                         zend_error(E_WARNING, "Creating default object from empty value");
     695          46 :                         if (Z_REFCOUNT_P(object) == 1) {
     696             :                                 /* object was removed by error handler, nothing to assign to */
     697           1 :                                 zval_ptr_dtor(&object);
     698           1 :                                 if (retval) {
     699           1 :                                         *retval = &EG(uninitialized_zval);
     700           1 :                                         PZVAL_LOCK(*retval);
     701             :                                 }
     702           1 :                                 FREE_OP(free_value);
     703           1 :                                 return;
     704             :                         }
     705          22 :                         Z_DELREF_P(object);
     706          22 :                         zval_dtor(object);
     707          22 :                         object_init(object);
     708             :                 } else {
     709           4 :                         zend_error(E_WARNING, "Attempt to assign property of non-object");
     710           4 :                         if (retval) {
     711           0 :                                 *retval = &EG(uninitialized_zval);
     712           0 :                                 PZVAL_LOCK(*retval);
     713             :                         }
     714           4 :                         FREE_OP(free_value);
     715           4 :                         return;
     716             :                 }
     717             :         }
     718             : 
     719             :         /* separate our value if necessary */
     720      114839 :         if (value_type == IS_TMP_VAR) {
     721         632 :                 zval *orig_value = value;
     722             : 
     723         632 :                 ALLOC_ZVAL(value);
     724         632 :                 ZVAL_COPY_VALUE(value, orig_value);
     725         632 :                 Z_UNSET_ISREF_P(value);
     726         632 :                 Z_SET_REFCOUNT_P(value, 0);
     727      114207 :         } else if (value_type == IS_CONST) {
     728      100256 :                 zval *orig_value = value;
     729             : 
     730      100256 :                 ALLOC_ZVAL(value);
     731      100256 :                 ZVAL_COPY_VALUE(value, orig_value);
     732      100256 :                 Z_UNSET_ISREF_P(value);
     733      100256 :                 Z_SET_REFCOUNT_P(value, 0);
     734      100256 :                 zval_copy_ctor(value);
     735             :         }
     736             : 
     737             : 
     738      114839 :         Z_ADDREF_P(value);
     739      114839 :         if (opcode == ZEND_ASSIGN_OBJ) {
     740      113286 :                 if (!Z_OBJ_HT_P(object)->write_property) {
     741           0 :                         zend_error(E_WARNING, "Attempt to assign property of non-object");
     742           0 :                         if (retval) {
     743           0 :                                 *retval = &EG(uninitialized_zval);
     744             :                                 PZVAL_LOCK(&EG(uninitialized_zval));
     745             :                         }
     746           0 :                         if (value_type == IS_TMP_VAR) {
     747           0 :                                 FREE_ZVAL(value);
     748           0 :                         } else if (value_type == IS_CONST) {
     749           0 :                                 zval_ptr_dtor(&value);
     750             :                         }
     751           0 :                         FREE_OP(free_value);
     752           0 :                         return;
     753             :                 }
     754      113286 :                 Z_OBJ_HT_P(object)->write_property(object, property_name, value, key TSRMLS_CC);
     755             :         } else {
     756             :                 /* Note:  property_name in this case is really the array index! */
     757        1553 :                 if (!Z_OBJ_HT_P(object)->write_dimension) {
     758           0 :                         zend_error_noreturn(E_ERROR, "Cannot use object as array");
     759             :                 }
     760        1553 :                 Z_OBJ_HT_P(object)->write_dimension(object, property_name, value TSRMLS_CC);
     761             :         }
     762             : 
     763      114829 :         if (retval && !EG(exception)) {
     764          30 :                 *retval = value;
     765          30 :                 PZVAL_LOCK(value);
     766             :         }
     767      114829 :         zval_ptr_dtor(&value);
     768      114829 :         FREE_OP_IF_VAR(free_value);
     769             : }
     770             : 
     771         144 : static inline int zend_assign_to_string_offset(const temp_variable *T, const zval *value, int value_type TSRMLS_DC)
     772             : {
     773         144 :         zval *str = T->str_offset.str;
     774         144 :         zend_uint offset = T->str_offset.offset;
     775         144 :         if (Z_TYPE_P(str) == IS_STRING) {
     776         144 :                 if ((int)offset < 0) {
     777           1 :                         zend_error(E_WARNING, "Illegal string offset:  %d", offset);
     778           1 :                         return 0;
     779             :                 }
     780             : 
     781         143 :                 if (offset >= Z_STRLEN_P(str)) {
     782           3 :                         Z_STRVAL_P(str) = str_erealloc(Z_STRVAL_P(str), offset+1+1);
     783           3 :                         memset(Z_STRVAL_P(str) + Z_STRLEN_P(str), ' ', offset - Z_STRLEN_P(str));
     784           3 :                         Z_STRVAL_P(str)[offset+1] = 0;
     785           3 :                         Z_STRLEN_P(str) = offset+1;
     786         140 :                 } else if (IS_INTERNED(Z_STRVAL_P(str))) {
     787           8 :                         Z_STRVAL_P(str) = estrndup(Z_STRVAL_P(str), Z_STRLEN_P(str));
     788             :                 }
     789             : 
     790         143 :                 if (Z_TYPE_P(value) != IS_STRING) {
     791             :                         zval tmp;
     792             : 
     793          11 :                         ZVAL_COPY_VALUE(&tmp, value);
     794          11 :                         if (value_type != IS_TMP_VAR) {
     795             :                                 zval_copy_ctor(&tmp);
     796             :                         }
     797          11 :                         convert_to_string(&tmp);
     798          11 :                         Z_STRVAL_P(str)[offset] = Z_STRVAL(tmp)[0];
     799          11 :                         str_efree(Z_STRVAL(tmp));
     800             :                 } else {
     801         132 :                         Z_STRVAL_P(str)[offset] = Z_STRVAL_P(value)[0];
     802         132 :                         if (value_type == IS_TMP_VAR) {
     803             :                                 /* we can safely free final_value here
     804             :                                  * because separation is done only
     805             :                                  * in case value_type == IS_VAR */
     806          10 :                                 str_efree(Z_STRVAL_P(value));
     807             :                         }
     808             :                 }
     809             :                 /*
     810             :                  * the value of an assignment to a string offset is undefined
     811             :                 T(result->u.var).var = &T->str_offset.str;
     812             :                 */
     813             :         }
     814         143 :         return 1;
     815             : }
     816             : 
     817             : 
     818     3177657 : static inline zval* zend_assign_tmp_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
     819             : {
     820     3177657 :         zval *variable_ptr = *variable_ptr_ptr;
     821             :         zval garbage;
     822             : 
     823     3177694 :         if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
     824          37 :             UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
     825           0 :                 Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
     826           0 :                 return variable_ptr;
     827             :         }
     828             : 
     829     4446931 :         if (UNEXPECTED(Z_REFCOUNT_P(variable_ptr) > 1) &&
     830     1269274 :             EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
     831             :             /* we need to split */
     832             :                 Z_DELREF_P(variable_ptr);
     833             :                 GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
     834     1266927 :                 ALLOC_ZVAL(variable_ptr);
     835     1266927 :                 INIT_PZVAL_COPY(variable_ptr, value);
     836     1266927 :                 *variable_ptr_ptr = variable_ptr;
     837     1266927 :                 return variable_ptr;
     838             :         } else {
     839     1910730 :                 if (EXPECTED(Z_TYPE_P(variable_ptr) <= IS_BOOL)) {
     840             :                         /* nothing to destroy */
     841      225853 :                         ZVAL_COPY_VALUE(variable_ptr, value);
     842             :                 } else {
     843     1684877 :                         ZVAL_COPY_VALUE(&garbage, variable_ptr);
     844     1684877 :                         ZVAL_COPY_VALUE(variable_ptr, value);
     845     1684877 :                         _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
     846             :                 }
     847     1910730 :                 return variable_ptr;
     848             :         }
     849             : }
     850             : 
     851     2987950 : static inline zval* zend_assign_const_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
     852             : {
     853     2987950 :         zval *variable_ptr = *variable_ptr_ptr;
     854             :         zval garbage;
     855             : 
     856     2998067 :         if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
     857       10117 :             UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
     858           0 :                 Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
     859           0 :                 return variable_ptr;
     860             :         }
     861             : 
     862     3949077 :         if (UNEXPECTED(Z_REFCOUNT_P(variable_ptr) > 1) &&
     863      961127 :             EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
     864             :                 /* we need to split */
     865             :                 Z_DELREF_P(variable_ptr);
     866             :                 GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
     867      960319 :                 ALLOC_ZVAL(variable_ptr);
     868      960319 :                 INIT_PZVAL_COPY(variable_ptr, value);
     869             :                 zval_copy_ctor(variable_ptr);
     870      960319 :                 *variable_ptr_ptr = variable_ptr;
     871      960319 :                 return variable_ptr;
     872             :         } else {
     873     2027631 :                 if (EXPECTED(Z_TYPE_P(variable_ptr) <= IS_BOOL)) {
     874             :                         /* nothing to destroy */
     875     1859040 :                         ZVAL_COPY_VALUE(variable_ptr, value);
     876             :                         zendi_zval_copy_ctor(*variable_ptr);
     877             :                 } else {
     878      168591 :                         ZVAL_COPY_VALUE(&garbage, variable_ptr);
     879      168591 :                         ZVAL_COPY_VALUE(variable_ptr, value);
     880             :                         zendi_zval_copy_ctor(*variable_ptr);
     881      168591 :                         _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
     882             :                 }
     883     2027627 :                 return variable_ptr;
     884             :         }
     885             : }
     886             : 
     887    14463697 : static inline zval* zend_assign_to_variable(zval **variable_ptr_ptr, zval *value TSRMLS_DC)
     888             : {
     889    14463697 :         zval *variable_ptr = *variable_ptr_ptr;
     890             :         zval garbage;
     891             : 
     892    15327866 :         if (Z_TYPE_P(variable_ptr) == IS_OBJECT &&
     893      864169 :             UNEXPECTED(Z_OBJ_HANDLER_P(variable_ptr, set) != NULL)) {
     894           0 :                 Z_OBJ_HANDLER_P(variable_ptr, set)(variable_ptr_ptr, value TSRMLS_CC);
     895           0 :                 return variable_ptr;
     896             :         }
     897             : 
     898    14463697 :         if (EXPECTED(!PZVAL_IS_REF(variable_ptr))) {
     899    14434073 :                 if (Z_REFCOUNT_P(variable_ptr)==1) {
     900     7766929 :                         if (UNEXPECTED(variable_ptr == value)) {
     901         120 :                                 return variable_ptr;
     902     7766809 :                         } else if (EXPECTED(!PZVAL_IS_REF(value))) {
     903             :                                 Z_ADDREF_P(value);
     904     7591152 :                                 *variable_ptr_ptr = value;
     905             :                                 ZEND_ASSERT(variable_ptr != &EG(uninitialized_zval));
     906     7591152 :                                 GC_REMOVE_ZVAL_FROM_BUFFER(variable_ptr);
     907             :                                 zval_dtor(variable_ptr);
     908     7591152 :                                 efree(variable_ptr);
     909     7591152 :                                 return value;
     910             :                         } else {
     911      175657 :                                 goto copy_value;
     912             :                         }
     913             :                 } else { /* we need to split */
     914             :                         Z_DELREF_P(variable_ptr);
     915             :                         GC_ZVAL_CHECK_POSSIBLE_ROOT(variable_ptr);
     916     6667144 :                         if (PZVAL_IS_REF(value)) {
     917        3167 :                                 ALLOC_ZVAL(variable_ptr);
     918        3167 :                                 *variable_ptr_ptr = variable_ptr;
     919        3167 :                                 INIT_PZVAL_COPY(variable_ptr, value);
     920             :                                 zval_copy_ctor(variable_ptr);
     921        3167 :                                 return variable_ptr;
     922             :                         } else {
     923     6663977 :                                 *variable_ptr_ptr = value;
     924             :                                 Z_ADDREF_P(value);
     925     6663977 :                                 return value;
     926             :                         }
     927             :                 }
     928             :         } else {
     929       29624 :                 if (EXPECTED(variable_ptr != value)) {
     930             : copy_value:
     931      205281 :                         if (EXPECTED(Z_TYPE_P(variable_ptr) <= IS_BOOL)) {
     932             :                                 /* nothing to destroy */
     933       14315 :                                 ZVAL_COPY_VALUE(variable_ptr, value);
     934             :                                 zendi_zval_copy_ctor(*variable_ptr);
     935             :                         } else {
     936      190966 :                                 ZVAL_COPY_VALUE(&garbage, variable_ptr);
     937      190966 :                                 ZVAL_COPY_VALUE(variable_ptr, value);
     938             :                                 zendi_zval_copy_ctor(*variable_ptr);
     939      190966 :                                 _zval_dtor_func(&garbage ZEND_FILE_LINE_CC);
     940             :                         }
     941             :                 }
     942      205281 :                 return variable_ptr;
     943             :         }
     944             : }
     945             : 
     946             : /* Utility Functions for Extensions */
     947           0 : static void zend_extension_statement_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
     948             : {
     949           0 :         if (extension->statement_handler) {
     950           0 :                 extension->statement_handler(op_array);
     951             :         }
     952           0 : }
     953             : 
     954             : 
     955           0 : static void zend_extension_fcall_begin_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
     956             : {
     957           0 :         if (extension->fcall_begin_handler) {
     958           0 :                 extension->fcall_begin_handler(op_array);
     959             :         }
     960           0 : }
     961             : 
     962             : 
     963           0 : static void zend_extension_fcall_end_handler(const zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
     964             : {
     965           0 :         if (extension->fcall_end_handler) {
     966           0 :                 extension->fcall_end_handler(op_array);
     967             :         }
     968           0 : }
     969             : 
     970             : 
     971     2154026 : static inline HashTable *zend_get_target_symbol_table(int fetch_type TSRMLS_DC)
     972             : {
     973     2154026 :         switch (fetch_type) {
     974             :                 case ZEND_FETCH_LOCAL:
     975     1320007 :                         if (!EG(active_symbol_table)) {
     976       35862 :                                 zend_rebuild_symbol_table(TSRMLS_C);
     977             :                         }
     978     1320007 :                         return EG(active_symbol_table);
     979             :                         break;
     980             :                 case ZEND_FETCH_GLOBAL:
     981             :                 case ZEND_FETCH_GLOBAL_LOCK:
     982      832484 :                         return &EG(symbol_table);
     983             :                         break;
     984             :                 case ZEND_FETCH_STATIC:
     985        1535 :                         if (!EG(active_op_array)->static_variables) {
     986           0 :                                 ALLOC_HASHTABLE(EG(active_op_array)->static_variables);
     987           0 :                                 zend_hash_init(EG(active_op_array)->static_variables, 2, NULL, ZVAL_PTR_DTOR, 0);
     988             :                         }
     989        1535 :                         return EG(active_op_array)->static_variables;
     990             :                         break;
     991             :                 EMPTY_SWITCH_DEFAULT_CASE()
     992             :         }
     993           0 :         return NULL;
     994             : }
     995             : 
     996     9076293 : static inline zval **zend_fetch_dimension_address_inner(HashTable *ht, const zval *dim, int dim_type, int type TSRMLS_DC)
     997             : {
     998             :         zval **retval;
     999             :         char *offset_key;
    1000             :         int offset_key_length;
    1001             :         ulong hval;
    1002             : 
    1003     9076293 :         switch (dim->type) {
    1004             :                 case IS_NULL:
    1005          10 :                         offset_key = "";
    1006          10 :                         offset_key_length = 0;
    1007          10 :                         hval = zend_inline_hash_func("", 1);
    1008          10 :                         goto fetch_string_dim;
    1009             : 
    1010             :                 case IS_STRING:
    1011             : 
    1012     4042003 :                         offset_key = dim->value.str.val;
    1013     4042003 :                         offset_key_length = dim->value.str.len;
    1014             : 
    1015     4042003 :                         if (dim_type == IS_CONST) {
    1016      956261 :                                 hval = Z_HASH_P(dim);
    1017             :                         } else {
    1018     3085742 :                                 ZEND_HANDLE_NUMERIC_EX(offset_key, offset_key_length+1, hval, goto num_index);
    1019     2905657 :                                 hval = str_hash(offset_key, offset_key_length);
    1020             :                         }
    1021             : fetch_string_dim:
    1022     3861928 :                         if (zend_hash_quick_find(ht, offset_key, offset_key_length+1, hval, (void **) &retval) == FAILURE) {
    1023     1970596 :                                 switch (type) {
    1024             :                                         case BP_VAR_R:
    1025      160000 :                                                 zend_error(E_NOTICE, "Undefined index: %s", offset_key);
    1026             :                                                 /* break missing intentionally */
    1027             :                                         case BP_VAR_UNSET:
    1028             :                                         case BP_VAR_IS:
    1029      160000 :                                                 retval = &EG(uninitialized_zval_ptr);
    1030      160000 :                                                 break;
    1031             :                                         case BP_VAR_RW:
    1032           1 :                                                 zend_error(E_NOTICE,"Undefined index: %s", offset_key);
    1033             :                                                 /* break missing intentionally */
    1034             :                                         case BP_VAR_W: {
    1035     1810596 :                                                         zval *new_zval = &EG(uninitialized_zval);
    1036             : 
    1037     1810596 :                                                         Z_ADDREF_P(new_zval);
    1038     1810596 :                                                         zend_hash_quick_update(ht, offset_key, offset_key_length+1, hval, &new_zval, sizeof(zval *), (void **) &retval);
    1039             :                                                 }
    1040             :                                                 break;
    1041             :                                 }
    1042             :                         }
    1043     3861928 :                         break;
    1044             :                 case IS_DOUBLE:
    1045          92 :                         hval = zend_dval_to_lval(Z_DVAL_P(dim));
    1046          46 :                         goto num_index;
    1047             :                 case IS_RESOURCE:
    1048           3 :                         zend_error(E_STRICT, "Resource ID#%ld used as offset, casting to integer (%ld)", Z_LVAL_P(dim), Z_LVAL_P(dim));
    1049             :                         /* Fall Through */
    1050             :                 case IS_BOOL:
    1051             :                 case IS_LONG:
    1052     5034228 :                         hval = Z_LVAL_P(dim);
    1053             : num_index:
    1054     5214359 :                         if (zend_hash_index_find(ht, hval, (void **) &retval) == FAILURE) {
    1055      396105 :                                 switch (type) {
    1056             :                                         case BP_VAR_R:
    1057          16 :                                                 zend_error(E_NOTICE,"Undefined offset: %ld", hval);
    1058             :                                                 /* break missing intentionally */
    1059             :                                         case BP_VAR_UNSET:
    1060             :                                         case BP_VAR_IS:
    1061          18 :                                                 retval = &EG(uninitialized_zval_ptr);
    1062          18 :                                                 break;
    1063             :                                         case BP_VAR_RW:
    1064           6 :                                                 zend_error(E_NOTICE,"Undefined offset: %ld", hval);
    1065             :                                                 /* break missing intentionally */
    1066             :                                         case BP_VAR_W: {
    1067      396087 :                                                 zval *new_zval = &EG(uninitialized_zval);
    1068             : 
    1069      396087 :                                                 Z_ADDREF_P(new_zval);
    1070      396087 :                                                 zend_hash_index_update(ht, hval, &new_zval, sizeof(zval *), (void **) &retval);
    1071             :                                         }
    1072             :                                         break;
    1073             :                                 }
    1074             :                         }
    1075     5214359 :                         break;
    1076             : 
    1077             :                 default:
    1078           6 :                         zend_error(E_WARNING, "Illegal offset type");
    1079           6 :                         return (type == BP_VAR_W || type == BP_VAR_RW) ?
    1080             :                                 &EG(error_zval_ptr) : &EG(uninitialized_zval_ptr);
    1081             :         }
    1082     9076287 :         return retval;
    1083             : }
    1084             : 
    1085     4645205 : static void zend_fetch_dimension_address(temp_variable *result, zval **container_ptr, zval *dim, int dim_type, int type TSRMLS_DC)
    1086             : {
    1087     4645205 :         zval *container = *container_ptr;
    1088             :         zval **retval;
    1089             : 
    1090     4645205 :         switch (Z_TYPE_P(container)) {
    1091             : 
    1092             :                 case IS_ARRAY:
    1093     9939684 :                         if (type != BP_VAR_UNSET && Z_REFCOUNT_P(container)>1 && !PZVAL_IS_REF(container)) {
    1094      404268 :                                 SEPARATE_ZVAL(container_ptr);
    1095      101067 :                                 container = *container_ptr;
    1096             :                         }
    1097             : fetch_from_array:
    1098     4644984 :                         if (dim == NULL) {
    1099      665220 :                                 zval *new_zval = &EG(uninitialized_zval);
    1100             : 
    1101      665220 :                                 Z_ADDREF_P(new_zval);
    1102      665220 :                                 if (zend_hash_next_index_insert(Z_ARRVAL_P(container), &new_zval, sizeof(zval *), (void **) &retval) == FAILURE) {
    1103           1 :                                         zend_error(E_WARNING, "Cannot add element to the array as the next element is already occupied");
    1104           1 :                                         retval = &EG(error_zval_ptr);
    1105           1 :                                         Z_DELREF_P(new_zval);
    1106             :                                 }
    1107             :                         } else {
    1108     3979764 :                                 retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
    1109             :                         }
    1110     4644984 :                         result->var.ptr_ptr = retval;
    1111     4644984 :                         PZVAL_LOCK(*retval);
    1112     4644984 :                         return;
    1113             :                         break;
    1114             : 
    1115             :                 case IS_NULL:
    1116        1358 :                         if (container == &EG(error_zval)) {
    1117           1 :                                 result->var.ptr_ptr = &EG(error_zval_ptr);
    1118           1 :                                 PZVAL_LOCK(EG(error_zval_ptr));
    1119        1357 :                         } else if (type != BP_VAR_UNSET) {
    1120             : convert_to_array:
    1121        1368 :                                 if (!PZVAL_IS_REF(container)) {
    1122        5376 :                                         SEPARATE_ZVAL(container_ptr);
    1123        1365 :                                         container = *container_ptr;
    1124             :                                 }
    1125             :                                 zval_dtor(container);
    1126        1368 :                                 array_init(container);
    1127        1368 :                                 goto fetch_from_array;
    1128             :                         } else {
    1129             :                                 /* for read-mode only */
    1130           0 :                                 result->var.ptr_ptr = &EG(uninitialized_zval_ptr);
    1131           0 :                                 PZVAL_LOCK(EG(uninitialized_zval_ptr));
    1132             :                         }
    1133           1 :                         return;
    1134             :                         break;
    1135             : 
    1136             :                 case IS_STRING: {
    1137             :                                 zval tmp;
    1138             : 
    1139         155 :                                 if (type != BP_VAR_UNSET && Z_STRLEN_P(container)==0) {
    1140           4 :                                         goto convert_to_array;
    1141             :                                 }
    1142         151 :                                 if (dim == NULL) {
    1143           0 :                                         zend_error_noreturn(E_ERROR, "[] operator not supported for strings");
    1144             :                                 }
    1145             : 
    1146         151 :                                 if (type != BP_VAR_UNSET) {
    1147         460 :                                         SEPARATE_ZVAL_IF_NOT_REF(container_ptr);
    1148             :                                 }
    1149             : 
    1150         151 :                                 if (Z_TYPE_P(dim) != IS_LONG) {
    1151             : 
    1152          15 :                                         switch(Z_TYPE_P(dim)) {
    1153             :                                                 /* case IS_LONG: */
    1154             :                                                 case IS_STRING:
    1155          15 :                                                         if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
    1156           0 :                                                                 break;
    1157             :                                                         }
    1158          15 :                                                         if (type != BP_VAR_UNSET) {
    1159          14 :                                                                 zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val);
    1160             :                                                         }
    1161             : 
    1162          15 :                                                         break;
    1163             :                                                 case IS_DOUBLE:
    1164             :                                                 case IS_NULL:
    1165             :                                                 case IS_BOOL:
    1166           0 :                                                         zend_error(E_NOTICE, "String offset cast occurred");
    1167           0 :                                                         break;
    1168             :                                                 default:
    1169           0 :                                                         zend_error(E_WARNING, "Illegal offset type");
    1170             :                                                         break;
    1171             :                                         }
    1172             : 
    1173          15 :                                         tmp = *dim;
    1174             :                                         zval_copy_ctor(&tmp);
    1175          15 :                                         convert_to_long(&tmp);
    1176          15 :                                         dim = &tmp;
    1177             :                                 }
    1178         151 :                                 container = *container_ptr;
    1179         151 :                                 result->str_offset.str = container;
    1180             :                                 PZVAL_LOCK(container);
    1181         151 :                                 result->str_offset.offset = Z_LVAL_P(dim);
    1182         151 :                                 result->str_offset.ptr_ptr = NULL;
    1183         151 :                                 return;
    1184             :                         }
    1185             :                         break;
    1186             : 
    1187             :                 case IS_OBJECT:
    1188          50 :                         if (!Z_OBJ_HT_P(container)->read_dimension) {
    1189           0 :                                 zend_error_noreturn(E_ERROR, "Cannot use object as array");
    1190             :                         } else {
    1191             :                                 zval *overloaded_result;
    1192             : 
    1193          50 :                                 if (dim_type == IS_TMP_VAR) {
    1194           0 :                                         zval *orig = dim;
    1195           0 :                                         MAKE_REAL_ZVAL_PTR(dim);
    1196           0 :                                         ZVAL_NULL(orig);
    1197             :                                 }
    1198          50 :                                 overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
    1199             : 
    1200          50 :                                 if (overloaded_result) {
    1201          47 :                                         if (!Z_ISREF_P(overloaded_result)) {
    1202          40 :                                                 if (Z_REFCOUNT_P(overloaded_result) > 0) {
    1203           9 :                                                         zval *tmp = overloaded_result;
    1204             : 
    1205           9 :                                                         ALLOC_ZVAL(overloaded_result);
    1206           9 :                                                         ZVAL_COPY_VALUE(overloaded_result, tmp);
    1207             :                                                         zval_copy_ctor(overloaded_result);
    1208             :                                                         Z_UNSET_ISREF_P(overloaded_result);
    1209             :                                                         Z_SET_REFCOUNT_P(overloaded_result, 0);
    1210             :                                                 }
    1211          40 :                                                 if (Z_TYPE_P(overloaded_result) != IS_OBJECT) {
    1212           9 :                                                         zend_class_entry *ce = Z_OBJCE_P(container);
    1213           9 :                                                         zend_error(E_NOTICE, "Indirect modification of overloaded element of %s has no effect", ce->name);
    1214             :                                                 }
    1215             :                                         }
    1216          47 :                                         AI_SET_PTR(result, overloaded_result);
    1217             :                                         PZVAL_LOCK(overloaded_result);
    1218             :                                 } else {
    1219           3 :                                         result->var.ptr_ptr = &EG(error_zval_ptr);
    1220           3 :                                         PZVAL_LOCK(EG(error_zval_ptr));
    1221             :                                 }
    1222          50 :                                 if (dim_type == IS_TMP_VAR) {
    1223           0 :                                         zval_ptr_dtor(&dim);
    1224             :                                 }
    1225             :                         }
    1226          50 :                         return;
    1227             :                         break;
    1228             : 
    1229             :                 case IS_BOOL:
    1230          11 :                         if (type != BP_VAR_UNSET && Z_LVAL_P(container)==0) {
    1231           7 :                                 goto convert_to_array;
    1232             :                         }
    1233             :                         /* break missing intentionally */
    1234             : 
    1235             :                 default:
    1236          19 :                         if (type == BP_VAR_UNSET) {
    1237           0 :                                 zend_error(E_WARNING, "Cannot unset offset in a non-array variable");
    1238           0 :                                 result->var.ptr_ptr = &EG(uninitialized_zval_ptr);
    1239           0 :                                 PZVAL_LOCK(EG(uninitialized_zval_ptr));
    1240             :                         } else {
    1241          19 :                                 zend_error(E_WARNING, "Cannot use a scalar value as an array");
    1242          19 :                                 result->var.ptr_ptr = &EG(error_zval_ptr);
    1243          19 :                                 PZVAL_LOCK(EG(error_zval_ptr));
    1244             :                         }
    1245             :                         break;
    1246             :         }
    1247             : }
    1248             : 
    1249     5129530 : static void zend_fetch_dimension_address_read(temp_variable *result, zval *container, zval *dim, int dim_type, int type TSRMLS_DC)
    1250             : {
    1251             :         zval **retval;
    1252             : 
    1253     5129530 :         switch (Z_TYPE_P(container)) {
    1254             : 
    1255             :                 case IS_ARRAY:
    1256     5096476 :                         retval = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), dim, dim_type, type TSRMLS_CC);
    1257     5096476 :                         result->var.ptr = *retval;
    1258     5096476 :                         PZVAL_LOCK(*retval);
    1259     5096476 :                         return;
    1260             : 
    1261             :                 case IS_NULL:
    1262          85 :                         result->var.ptr = &EG(uninitialized_zval);
    1263             :                         PZVAL_LOCK(&EG(uninitialized_zval));
    1264          85 :                         return;
    1265             : 
    1266             :                 case IS_STRING: {
    1267             :                                 zval tmp;
    1268             :                                 zval *ptr;
    1269             : 
    1270       32101 :                                 if (Z_TYPE_P(dim) != IS_LONG) {
    1271          46 :                                         switch(Z_TYPE_P(dim)) {
    1272             :                                                 /* case IS_LONG: */
    1273             :                                                 case IS_STRING:
    1274          30 :                                                         if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) {
    1275           1 :                                                                 break;
    1276             :                                                         }
    1277          29 :                                                         if (type != BP_VAR_IS) {
    1278          21 :                                                                 zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val);
    1279             :                                                         }
    1280          29 :                                                         break;
    1281             :                                                 case IS_DOUBLE:
    1282             :                                                 case IS_NULL:
    1283             :                                                 case IS_BOOL:
    1284          13 :                                                         if (type != BP_VAR_IS) {
    1285          11 :                                                                 zend_error(E_NOTICE, "String offset cast occurred");
    1286             :                                                         }
    1287          13 :                                                         break;
    1288             :                                                 default:
    1289           3 :                                                         zend_error(E_WARNING, "Illegal offset type");
    1290             :                                                         break;
    1291             :                                         }
    1292             : 
    1293          46 :                                         ZVAL_COPY_VALUE(&tmp, dim);
    1294             :                                         zval_copy_ctor(&tmp);
    1295          46 :                                         convert_to_long(&tmp);
    1296          46 :                                         dim = &tmp;
    1297             :                                 }
    1298             : 
    1299       32101 :                                 ALLOC_ZVAL(ptr);
    1300       32101 :                                 INIT_PZVAL(ptr);
    1301       32101 :                                 Z_TYPE_P(ptr) = IS_STRING;
    1302             : 
    1303       32144 :                                 if (Z_LVAL_P(dim) < 0 || Z_STRLEN_P(container) <= Z_LVAL_P(dim)) {
    1304          43 :                                         if (type != BP_VAR_IS) {
    1305          39 :                                                 zend_error(E_NOTICE, "Uninitialized string offset: %ld", Z_LVAL_P(dim));
    1306             :                                         }
    1307          43 :                                         Z_STRVAL_P(ptr) = STR_EMPTY_ALLOC();
    1308          43 :                                         Z_STRLEN_P(ptr) = 0;
    1309             :                                 } else {
    1310       32058 :                                         Z_STRVAL_P(ptr) = (char*)emalloc(2);
    1311       32058 :                                         Z_STRVAL_P(ptr)[0] = Z_STRVAL_P(container)[Z_LVAL_P(dim)];
    1312       32058 :                                         Z_STRVAL_P(ptr)[1] = 0;
    1313       32058 :                                         Z_STRLEN_P(ptr) = 1;
    1314             :                                 }
    1315       32101 :                                 result->var.ptr = ptr;
    1316       32101 :                                 return;
    1317             :                         }
    1318             :                         break;
    1319             : 
    1320             :                 case IS_OBJECT:
    1321         754 :                         if (!Z_OBJ_HT_P(container)->read_dimension) {
    1322           0 :                                 zend_error_noreturn(E_ERROR, "Cannot use object as array");
    1323             :                         } else {
    1324             :                                 zval *overloaded_result;
    1325             : 
    1326         754 :                                 if (dim_type == IS_TMP_VAR) {
    1327           6 :                                         zval *orig = dim;
    1328          12 :                                         MAKE_REAL_ZVAL_PTR(dim);
    1329           6 :                                         ZVAL_NULL(orig);
    1330             :                                 }
    1331         754 :                                 overloaded_result = Z_OBJ_HT_P(container)->read_dimension(container, dim, type TSRMLS_CC);
    1332             : 
    1333         750 :                                 if (result) {
    1334         750 :                                         if (overloaded_result) {
    1335         742 :                                                 result->var.ptr = overloaded_result;
    1336             :                                                 PZVAL_LOCK(overloaded_result);
    1337             :                                         } else {
    1338           8 :                                                 result->var.ptr = &EG(uninitialized_zval);
    1339             :                                                 PZVAL_LOCK(&EG(uninitialized_zval));
    1340             :                                         }
    1341             :                                 }
    1342         750 :                                 if (dim_type == IS_TMP_VAR) {
    1343           6 :                                         zval_ptr_dtor(&dim);
    1344             :                                 }
    1345             :                         }
    1346         750 :                         return;
    1347             : 
    1348             :                 default:
    1349         114 :                         result->var.ptr = &EG(uninitialized_zval);
    1350             :                         PZVAL_LOCK(&EG(uninitialized_zval));
    1351         114 :                         return;
    1352             :         }
    1353             : }
    1354             : 
    1355           0 : ZEND_API void zend_fetch_dimension_by_zval(zval **result, zval *container, zval *dim TSRMLS_DC) {
    1356             :         temp_variable tmp;
    1357           0 :         zend_fetch_dimension_address_read(&tmp, container, dim, IS_TMP_VAR, BP_VAR_R TSRMLS_CC);
    1358           0 :         *result = tmp.var.ptr;
    1359           0 : }
    1360             : 
    1361      175470 : static void zend_fetch_property_address(temp_variable *result, zval **container_ptr, zval *prop_ptr, const zend_literal *key, int type TSRMLS_DC)
    1362             : {
    1363      175470 :         zval *container = *container_ptr;
    1364             : 
    1365      175470 :         if (Z_TYPE_P(container) != IS_OBJECT) {
    1366          44 :                 if (container == &EG(error_zval)) {
    1367           1 :                         result->var.ptr_ptr = &EG(error_zval_ptr);
    1368           1 :                         PZVAL_LOCK(EG(error_zval_ptr));
    1369           1 :                         return;
    1370             :                 }
    1371             : 
    1372             :                 /* this should modify object only if it's empty */
    1373         141 :                 if (type != BP_VAR_UNSET &&
    1374          43 :                     ((Z_TYPE_P(container) == IS_NULL ||
    1375           9 :                      (Z_TYPE_P(container) == IS_BOOL && Z_LVAL_P(container)==0) ||
    1376           9 :                      (Z_TYPE_P(container) == IS_STRING && Z_STRLEN_P(container)==0)))) {
    1377          37 :                         if (!PZVAL_IS_REF(container)) {
    1378         134 :                                 SEPARATE_ZVAL(container_ptr);
    1379          35 :                                 container = *container_ptr;
    1380             :                         }
    1381          37 :                         object_init(container);
    1382             :                 } else {
    1383           6 :                         zend_error(E_WARNING, "Attempt to modify property of non-object");
    1384           6 :                         result->var.ptr_ptr = &EG(error_zval_ptr);
    1385           6 :                         PZVAL_LOCK(EG(error_zval_ptr));
    1386           6 :                         return;
    1387             :                 }
    1388             :         }
    1389             : 
    1390      175463 :         if (Z_OBJ_HT_P(container)->get_property_ptr_ptr) {
    1391      175463 :                 zval **ptr_ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr, type, key TSRMLS_CC);
    1392      175462 :                 if (NULL == ptr_ptr) {
    1393             :                         zval *ptr;
    1394             : 
    1395         162 :                         if (Z_OBJ_HT_P(container)->read_property &&
    1396          54 :                                 (ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, key TSRMLS_CC)) != NULL) {
    1397          54 :                                 AI_SET_PTR(result, ptr);
    1398             :                                 PZVAL_LOCK(ptr);
    1399             :                         } else {
    1400           0 :                                 zend_error_noreturn(E_ERROR, "Cannot access undefined property for object with overloaded property access");
    1401             :                         }
    1402             :                 } else {
    1403      175408 :                         result->var.ptr_ptr = ptr_ptr;
    1404      175408 :                         PZVAL_LOCK(*ptr_ptr);
    1405             :                 }
    1406           0 :         } else if (Z_OBJ_HT_P(container)->read_property) {
    1407           0 :                 zval *ptr = Z_OBJ_HT_P(container)->read_property(container, prop_ptr, type, key TSRMLS_CC);
    1408             : 
    1409           0 :                 AI_SET_PTR(result, ptr);
    1410             :                 PZVAL_LOCK(ptr);
    1411             :         } else {
    1412           0 :                 zend_error(E_WARNING, "This object doesn't support property references");
    1413           0 :                 result->var.ptr_ptr = &EG(error_zval_ptr);
    1414           0 :                 PZVAL_LOCK(EG(error_zval_ptr));
    1415             :         }
    1416             : }
    1417             : 
    1418       79641 : 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 TSRMLS_DC)
    1419             : {
    1420       79641 :         int original_nest_levels = nest_levels;
    1421             :         zend_brk_cont_element *jmp_to;
    1422             : 
    1423             :         do {
    1424       79800 :                 if (array_offset==-1) {
    1425           0 :                         zend_error_noreturn(E_ERROR, "Cannot break/continue %d level%s", original_nest_levels, (original_nest_levels == 1) ? "" : "s");
    1426             :                 }
    1427       79800 :                 jmp_to = &op_array->brk_cont_array[array_offset];
    1428       79800 :                 if (nest_levels>1) {
    1429         159 :                         zend_op *brk_opline = &op_array->opcodes[jmp_to->brk];
    1430             : 
    1431         159 :                         switch (brk_opline->opcode) {
    1432             :                                 case ZEND_SWITCH_FREE:
    1433           4 :                                         if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
    1434           2 :                                                 zval_ptr_dtor(&EX_T(brk_opline->op1.var).var.ptr);
    1435             :                                         }
    1436           4 :                                         break;
    1437             :                                 case ZEND_FREE:
    1438           0 :                                         if (!(brk_opline->extended_value & EXT_TYPE_FREE_ON_RETURN)) {
    1439           0 :                                                 zendi_zval_dtor(EX_T(brk_opline->op1.var).tmp_var);
    1440             :                                         }
    1441             :                                         break;
    1442             :                         }
    1443             :                 }
    1444       79800 :                 array_offset = jmp_to->parent;
    1445       79800 :         } while (--nest_levels > 0);
    1446       79641 :         return jmp_to;
    1447             : }
    1448             : 
    1449             : #if ZEND_INTENSIVE_DEBUGGING
    1450             : 
    1451             : #define CHECK_SYMBOL_TABLES()                                                                                                           \
    1452             :         zend_hash_apply(&EG(symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC);     \
    1453             :         if (&EG(symbol_table)!=EG(active_symbol_table)) {                                                           \
    1454             :                 zend_hash_apply(EG(active_symbol_table), (apply_func_t) zend_check_symbol TSRMLS_CC);   \
    1455             :         }
    1456             : 
    1457             : static int zend_check_symbol(zval **pz TSRMLS_DC)
    1458             : {
    1459             :         if (Z_TYPE_PP(pz) > 9) {
    1460             :                 fprintf(stderr, "Warning!  %x has invalid type!\n", *pz);
    1461             : /* See http://support.microsoft.com/kb/190351 */
    1462             : #ifdef PHP_WIN32
    1463             :                 fflush(stderr);
    1464             : #endif
    1465             :         } else if (Z_TYPE_PP(pz) == IS_ARRAY) {
    1466             :                 zend_hash_apply(Z_ARRVAL_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
    1467             :         } else if (Z_TYPE_PP(pz) == IS_OBJECT) {
    1468             : 
    1469             :                 /* OBJ-TBI - doesn't support new object model! */
    1470             :                 zend_hash_apply(Z_OBJPROP_PP(pz), (apply_func_t) zend_check_symbol TSRMLS_CC);
    1471             :         }
    1472             : 
    1473             :         return 0;
    1474             : }
    1475             : 
    1476             : 
    1477             : #else
    1478             : #define CHECK_SYMBOL_TABLES()
    1479             : #endif
    1480             : 
    1481             : ZEND_API opcode_handler_t *zend_opcode_handlers;
    1482             : 
    1483           0 : ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC)
    1484             : {
    1485           0 :         if (fci != NULL) {
    1486           0 :                 execute_data_ptr->function_state.function->internal_function.handler(
    1487           0 :                         fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr,
    1488             :                         fci->object_ptr, 1 TSRMLS_CC
    1489             :                 );
    1490             :         } else {
    1491           0 :                 zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr;
    1492           0 :                 execute_data_ptr->function_state.function->internal_function.handler(
    1493           0 :                         execute_data_ptr->opline->extended_value, *return_value_ptr, return_value_ptr,
    1494             :                         execute_data_ptr->object, return_value_used TSRMLS_CC
    1495             :                 );
    1496             :         }
    1497           0 : }
    1498             : 
    1499       36941 : void zend_clean_and_cache_symbol_table(HashTable *symbol_table TSRMLS_DC) /* {{{ */
    1500             : {
    1501       36941 :         if (EG(symtable_cache_ptr) >= EG(symtable_cache_limit)) {
    1502           0 :                 zend_hash_destroy(symbol_table);
    1503           0 :                 FREE_HASHTABLE(symbol_table);
    1504             :         } else {
    1505             :                 /* clean before putting into the cache, since clean
    1506             :                    could call dtors, which could use cached hash */
    1507       36941 :                 zend_hash_clean(symbol_table);
    1508       36941 :                 *(++EG(symtable_cache_ptr)) = symbol_table;
    1509             :         }
    1510       36941 : }
    1511             : /* }}} */
    1512             : 
    1513             : static zend_always_inline void i_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
    1514             : {
    1515     2043670 :         zval ***cv = EX_CV_NUM(execute_data, 0);
    1516     2043670 :         zval ***end = cv + EX(op_array)->last_var;
    1517    10690987 :         while (cv != end) {
    1518     8647317 :                 if (*cv) {
    1519     7307431 :                         zval_ptr_dtor(*cv);
    1520             :                 }
    1521     8647317 :                 cv++;
    1522             :         }
    1523             : }
    1524             : /* }}} */
    1525             : 
    1526          79 : void zend_free_compiled_variables(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
    1527             : {
    1528             :         i_free_compiled_variables(execute_data TSRMLS_CC);
    1529          79 : }
    1530             : /* }}} */
    1531             : 
    1532             : /*
    1533             :  * Stack Frame Layout (the whole stack frame is allocated at once)
    1534             :  * ==================
    1535             :  *
    1536             :  *                             +========================================+
    1537             :  *                             | zend_execute_data                      |<---+
    1538             :  *                             |     EX(function_state).arguments       |--+ |
    1539             :  *                             |  ...                                   |  | |
    1540             :  *                             | ARGUMENT [1]                           |  | |
    1541             :  *                             | ...                                    |  | |
    1542             :  *                             | ARGUMENT [ARGS_NUMBER]                 |  | |
    1543             :  *                             | ARGS_NUMBER                            |<-+ |
    1544             :  *                             +========================================+    |
    1545             :  *                                                                           |
    1546             :  *                             +========================================+    |
    1547             :  *                             | TMP_VAR[op_arrat->T-1]                 |    |
    1548             :  *                             | ...                                    |    |
    1549             :  *     EX_TMP_VAR_NUM(0) ----> | TMP_VAR[0]                             |    |
    1550             :  *                             +----------------------------------------+    |
    1551             :  * EG(current_execute_data) -> | zend_execute_data                      |    |
    1552             :  *                             |     EX(prev_execute_data)              |----+
    1553             :  *                             +----------------------------------------+
    1554             :  *     EX_CV_NUM(0) ---------> | CV[0]                                  |--+
    1555             :  *                             | ...                                    |  |
    1556             :  *                             | CV[op_array->last_var-1]               |  |
    1557             :  *                             +----------------------------------------+  |
    1558             :  *                             | Optional slot for CV[0] zval*          |<-+
    1559             :  *                             | ...                                    |
    1560             :  *                             | ...for CV [op_array->last_var-1] zval* |
    1561             :  *                             +----------------------------------------+
    1562             :  *           EX(call_slots) -> | CALL_SLOT[0]                           |
    1563             :  *                             | ...                                    |
    1564             :  *                             | CALL_SLOT[op_array->nested_calls-1]    |
    1565             :  *                             +----------------------------------------+
    1566             :  * zend_vm_stack_frame_base -> | ARGUMENTS STACK [0]                    |
    1567             :  *                             | ...                                    |
    1568             :  * zend_vm_stack_top --------> | ...                                    |
    1569             :  *                             | ...                                    |
    1570             :  *                             | ARGUMENTS STACK [op_array->used_stack] |
    1571             :  *                             +----------------------------------------+
    1572             :  */
    1573             : 
    1574             : static zend_always_inline zend_execute_data *i_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) /* {{{ */
    1575             : {
    1576             :         zend_execute_data *execute_data;
    1577             : 
    1578             :         /*
    1579             :          * When allocating the execute_data, memory for compiled variables and
    1580             :          * temporary variables is also allocated before and after the actual
    1581             :          * zend_execute_data struct. In addition we also allocate space to store
    1582             :          * information about syntactically nested called functions and actual
    1583             :          * parameters. op_array->last_var specifies the number of compiled
    1584             :          * variables and op_array->T is the number of temporary variables. If there
    1585             :          * is no symbol table, then twice as much memory is allocated for compiled
    1586             :          * variables. In that case the first half contains zval**s and the second
    1587             :          * half the actual zval*s (which would otherwise be in the symbol table).
    1588             :          */
    1589     2112502 :         size_t execute_data_size = ZEND_MM_ALIGNED_SIZE(sizeof(zend_execute_data));
    1590     2112502 :         size_t CVs_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval **) * op_array->last_var * (EG(active_symbol_table) ? 1 : 2));
    1591     2112502 :         size_t Ts_size = ZEND_MM_ALIGNED_SIZE(sizeof(temp_variable)) * op_array->T;
    1592     2112502 :         size_t call_slots_size = ZEND_MM_ALIGNED_SIZE(sizeof(call_slot)) * op_array->nested_calls;
    1593     2112502 :         size_t stack_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * op_array->used_stack;
    1594     2112502 :         size_t total_size = execute_data_size + Ts_size + CVs_size + call_slots_size + stack_size;
    1595             : 
    1596             :         /*
    1597             :          * Normally the execute_data is allocated on the VM stack (because it does
    1598             :          * not actually do any allocation and thus is faster). For generators
    1599             :          * though this behavior would be suboptimal, because the (rather large)
    1600             :          * structure would have to be copied back and forth every time execution is
    1601             :          * suspended or resumed. That's why for generators the execution context
    1602             :          * is allocated using a separate VM stack, thus allowing to save and
    1603             :          * restore it simply by replacing a pointer. The same segment also keeps
    1604             :          * a copy of previous execute_data and passed parameters.
    1605             :          */
    1606     2112502 :         if (UNEXPECTED((op_array->fn_flags & ZEND_ACC_GENERATOR) != 0)) {
    1607             :                 /* Prepend the regular stack frame with a copy of prev_execute_data
    1608             :                  * and the passed arguments
    1609             :                  */
    1610         162 :                 int args_count = zend_vm_stack_get_args_count_ex(EG(current_execute_data));
    1611          81 :                 size_t args_size = ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * (args_count + 1);
    1612             : 
    1613          81 :                 total_size += args_size + execute_data_size;
    1614             : 
    1615         162 :                 EG(argument_stack) = zend_vm_stack_new_page((total_size + (sizeof(void*) - 1)) / sizeof(void*));
    1616          81 :                 EG(argument_stack)->prev = NULL;
    1617          81 :                 execute_data = (zend_execute_data*)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + args_size + execute_data_size + Ts_size);
    1618             : 
    1619             :                 /* copy prev_execute_data */
    1620          81 :                 EX(prev_execute_data) = (zend_execute_data*)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + args_size);
    1621          81 :                 memset(EX(prev_execute_data), 0, sizeof(zend_execute_data));
    1622          81 :                 EX(prev_execute_data)->function_state.function = (zend_function*)op_array;
    1623          81 :                 EX(prev_execute_data)->function_state.arguments = (void**)((char*)ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + ZEND_MM_ALIGNED_SIZE(sizeof(zval*)) * args_count);
    1624             : 
    1625             :                 /* copy arguments */
    1626          81 :                 *EX(prev_execute_data)->function_state.arguments = (void*)(zend_uintptr_t)args_count;
    1627          81 :                 if (args_count > 0) {
    1628          50 :                         zval **arg_src = (zval**)zend_vm_stack_get_arg_ex(EG(current_execute_data), 1);
    1629          50 :                         zval **arg_dst = (zval**)zend_vm_stack_get_arg_ex(EX(prev_execute_data), 1);
    1630             :                         int i;
    1631             : 
    1632          59 :                         for (i = 0; i < args_count; i++) {
    1633          34 :                                 arg_dst[i] = arg_src[i];
    1634          34 :                                 Z_ADDREF_P(arg_dst[i]);
    1635             :                         }
    1636             :                 }
    1637             :         } else {
    1638     2112421 :                 execute_data = zend_vm_stack_alloc(total_size TSRMLS_CC);
    1639     2112421 :                 execute_data = (zend_execute_data*)((char*)execute_data + Ts_size);
    1640     2112421 :                 EX(prev_execute_data) = EG(current_execute_data);
    1641             :         }
    1642             : 
    1643     2112502 :         memset(EX_CV_NUM(execute_data, 0), 0, sizeof(zval **) * op_array->last_var);
    1644             : 
    1645     2112502 :         EX(call_slots) = (call_slot*)((char *)execute_data + execute_data_size + CVs_size);
    1646             : 
    1647             : 
    1648     2112502 :         EX(op_array) = op_array;
    1649             : 
    1650     4225004 :         EG(argument_stack)->top = zend_vm_stack_frame_base(execute_data);
    1651             : 
    1652     2112502 :         EX(object) = NULL;
    1653     2112502 :         EX(current_this) = NULL;
    1654     2112502 :         EX(old_error_reporting) = NULL;
    1655     2112502 :         EX(symbol_table) = EG(active_symbol_table);
    1656     2112502 :         EX(call) = NULL;
    1657     2112502 :         EG(current_execute_data) = execute_data;
    1658     2112502 :         EX(nested) = nested;
    1659     2112502 :         EX(delayed_exception) = NULL;
    1660             : 
    1661     2112502 :         if (!op_array->run_time_cache && op_array->last_cache_slot) {
    1662       37032 :                 op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*));
    1663             :         }
    1664             : 
    1665     2112502 :         if (op_array->this_var != -1 && EG(This)) {
    1666      107954 :                 Z_ADDREF_P(EG(This)); /* For $this pointer */
    1667      107954 :                 if (!EG(active_symbol_table)) {
    1668      107954 :                         EX_CV(op_array->this_var) = (zval **) EX_CV_NUM(execute_data, op_array->last_var + op_array->this_var);
    1669      107954 :                         *EX_CV(op_array->this_var) = EG(This);
    1670             :                 } else {
    1671           0 :                         if (zend_hash_add(EG(active_symbol_table), "this", sizeof("this"), &EG(This), sizeof(zval *), (void **) EX_CV_NUM(execute_data, op_array->this_var))==FAILURE) {
    1672           0 :                                 Z_DELREF_P(EG(This));
    1673             :                         }
    1674             :                 }
    1675             :         }
    1676             : 
    1677     2112502 :         EX(opline) = UNEXPECTED((op_array->fn_flags & ZEND_ACC_INTERACTIVE) != 0) && EG(start_op) ? EG(start_op) : op_array->opcodes;
    1678     2112502 :         EG(opline_ptr) = &EX(opline);
    1679             : 
    1680     2112502 :         EX(function_state).function = (zend_function *) op_array;
    1681     2112502 :         EX(function_state).arguments = NULL;
    1682             : 
    1683     2112502 :         return execute_data;
    1684             : }
    1685             : /* }}} */
    1686             : 
    1687          81 : ZEND_API zend_execute_data *zend_create_execute_data_from_op_array(zend_op_array *op_array, zend_bool nested TSRMLS_DC) /* {{{ */
    1688             : {
    1689         162 :         return i_create_execute_data_from_op_array(op_array, nested TSRMLS_CC);
    1690             : }
    1691             : /* }}} */
    1692             : 
    1693             : static zend_always_inline zend_bool zend_is_by_ref_func_arg_fetch(zend_op *opline, call_slot *call TSRMLS_DC) /* {{{ */
    1694             : {
    1695        3458 :         zend_uint arg_num = opline->extended_value & ZEND_FETCH_ARG_MASK;
    1696        3458 :         return ARG_SHOULD_BE_SENT_BY_REF(call->fbc, arg_num);
    1697             : }
    1698             : /* }}} */
    1699             : 
    1700           1 : static void **zend_vm_stack_push_args_with_copy(int count TSRMLS_DC) /* {{{ */
    1701             : {
    1702           1 :         zend_vm_stack p = EG(argument_stack);
    1703             : 
    1704           1 :         zend_vm_stack_extend(count + 1 TSRMLS_CC);
    1705             : 
    1706           1 :         EG(argument_stack)->top += count;
    1707           1 :         *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
    1708       20002 :         while (count-- > 0) {
    1709       20000 :                 void *data = *(--p->top);
    1710             : 
    1711       20000 :                 if (UNEXPECTED(p->top == ZEND_VM_STACK_ELEMETS(p))) {
    1712           1 :                         zend_vm_stack r = p;
    1713             : 
    1714           1 :                         EG(argument_stack)->prev = p->prev;
    1715           1 :                         p = p->prev;
    1716           1 :                         efree(r);
    1717             :                 }
    1718       20000 :                 *(ZEND_VM_STACK_ELEMETS(EG(argument_stack)) + count) = data;
    1719             :         }
    1720           1 :         return EG(argument_stack)->top++;
    1721             : }
    1722             : /* }}} */
    1723             : 
    1724             : static zend_always_inline void** zend_vm_stack_push_args(int count TSRMLS_DC) /* {{{ */
    1725             : {
    1726          98 :         if (UNEXPECTED(EG(argument_stack)->top - ZEND_VM_STACK_ELEMETS(EG(argument_stack)) < count)
    1727          65 :                 || UNEXPECTED(EG(argument_stack)->top == EG(argument_stack)->end)) {
    1728           1 :                 return zend_vm_stack_push_args_with_copy(count TSRMLS_CC);
    1729             :         }
    1730          32 :         *(EG(argument_stack)->top) = (void*)(zend_uintptr_t)count;
    1731          32 :         return EG(argument_stack)->top++;
    1732             : }
    1733             : /* }}} */
    1734             : 
    1735             : 
    1736             : #define ZEND_VM_NEXT_OPCODE() \
    1737             :         CHECK_SYMBOL_TABLES() \
    1738             :         ZEND_VM_INC_OPCODE(); \
    1739             :         ZEND_VM_CONTINUE()
    1740             : 
    1741             : #define ZEND_VM_SET_OPCODE(new_op) \
    1742             :         CHECK_SYMBOL_TABLES() \
    1743             :         OPLINE = new_op
    1744             : 
    1745             : #define ZEND_VM_JMP(new_op) \
    1746             :         if (EXPECTED(!EG(exception))) { \
    1747             :                 ZEND_VM_SET_OPCODE(new_op); \
    1748             :         } else { \
    1749             :                 LOAD_OPLINE(); \
    1750             :         } \
    1751             :         ZEND_VM_CONTINUE()
    1752             : 
    1753             : #define ZEND_VM_INC_OPCODE() \
    1754             :         OPLINE++
    1755             : 
    1756             : #ifdef __GNUC__
    1757             : # define ZEND_VM_GUARD(name) __asm__("#" #name)
    1758             : #else
    1759             : # define ZEND_VM_GUARD(name)
    1760             : #endif
    1761             : 
    1762             : #include "zend_vm_execute.h"
    1763             : 
    1764           0 : ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, user_opcode_handler_t handler)
    1765             : {
    1766           0 :         if (opcode != ZEND_USER_OPCODE) {
    1767           0 :                 if (handler == NULL) {
    1768             :                         /* restore the original handler */
    1769           0 :                         zend_user_opcodes[opcode] = opcode;
    1770             :                 } else {
    1771           0 :                         zend_user_opcodes[opcode] = ZEND_USER_OPCODE;
    1772             :                 }
    1773           0 :                 zend_user_opcode_handlers[opcode] = handler;
    1774           0 :                 return SUCCESS;
    1775             :         }
    1776           0 :         return FAILURE;
    1777             : }
    1778             : 
    1779           0 : ZEND_API user_opcode_handler_t zend_get_user_opcode_handler(zend_uchar opcode)
    1780             : {
    1781           0 :         return zend_user_opcode_handlers[opcode];
    1782             : }
    1783             : 
    1784           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 TSRMLS_DC) {
    1785           0 :         return get_zval_ptr(op_type, node, execute_data, should_free, type);
    1786             : }
    1787             : 
    1788           0 : ZEND_API zval **zend_get_zval_ptr_ptr(int op_type, const znode_op *node, const zend_execute_data *execute_data, zend_free_op *should_free, int type TSRMLS_DC) {
    1789           0 :         return get_zval_ptr_ptr(op_type, node, execute_data, should_free, type);
    1790             : }
    1791             : 
    1792             : /*
    1793             :  * Local variables:
    1794             :  * tab-width: 4
    1795             :  * c-basic-offset: 4
    1796             :  * indent-tabs-mode: t
    1797             :  * End:
    1798             :  */

Generated by: LCOV version 1.10

Generated at Wed, 16 Apr 2014 12:47:44 +0000 (2 days ago)

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