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.c (source / functions) Hit Total Coverage
Test: PHP Code Coverage Lines: 478 531 90.0 %
Date: 2015-07-26 Functions: 41 43 95.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :    +----------------------------------------------------------------------+
       3             :    | Zend Engine                                                          |
       4             :    +----------------------------------------------------------------------+
       5             :    | Copyright (c) 1998-2015 Zend Technologies Ltd. (http://www.zend.com) |
       6             :    +----------------------------------------------------------------------+
       7             :    | This source file is subject to version 2.00 of the Zend license,     |
       8             :    | that is bundled with this package in the file LICENSE, and is        |
       9             :    | available through the world-wide-web at the following url:           |
      10             :    | http://www.zend.com/license/2_00.txt.                                |
      11             :    | If you did not receive a copy of the Zend license and are unable to  |
      12             :    | obtain it through the world-wide-web, please send a note to          |
      13             :    | license@zend.com so we can mail you a copy immediately.              |
      14             :    +----------------------------------------------------------------------+
      15             :    | Authors: Andi Gutmans <andi@zend.com>                                |
      16             :    |          Zeev Suraski <zeev@zend.com>                                |
      17             :    +----------------------------------------------------------------------+
      18             : */
      19             : 
      20             : /* $Id$ */
      21             : 
      22             : #include "zend.h"
      23             : #include "zend_extensions.h"
      24             : #include "zend_modules.h"
      25             : #include "zend_constants.h"
      26             : #include "zend_list.h"
      27             : #include "zend_API.h"
      28             : #include "zend_exceptions.h"
      29             : #include "zend_builtin_functions.h"
      30             : #include "zend_ini.h"
      31             : #include "zend_vm.h"
      32             : #include "zend_dtrace.h"
      33             : #include "zend_virtual_cwd.h"
      34             : 
      35             : #ifdef ZTS
      36             : # define GLOBAL_FUNCTION_TABLE          global_function_table
      37             : # define GLOBAL_CLASS_TABLE                     global_class_table
      38             : # define GLOBAL_CONSTANTS_TABLE         global_constants_table
      39             : # define GLOBAL_AUTO_GLOBALS_TABLE      global_auto_globals_table
      40             : #else
      41             : # define GLOBAL_FUNCTION_TABLE          CG(function_table)
      42             : # define GLOBAL_CLASS_TABLE                     CG(class_table)
      43             : # define GLOBAL_AUTO_GLOBALS_TABLE      CG(auto_globals)
      44             : # define GLOBAL_CONSTANTS_TABLE         EG(zend_constants)
      45             : #endif
      46             : 
      47             : /* true multithread-shared globals */
      48             : ZEND_API zend_class_entry *zend_standard_class_def = NULL;
      49             : ZEND_API size_t (*zend_printf)(const char *format, ...);
      50             : ZEND_API zend_write_func_t zend_write;
      51             : ZEND_API FILE *(*zend_fopen)(const char *filename, zend_string **opened_path);
      52             : ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle);
      53             : ZEND_API void (*zend_block_interruptions)(void);
      54             : ZEND_API void (*zend_unblock_interruptions)(void);
      55             : ZEND_API void (*zend_ticks_function)(int ticks);
      56             : ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
      57             : size_t (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
      58             : zend_string *(*zend_vstrpprintf)(size_t max_len, const char *format, va_list ap);
      59             : ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
      60             : ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len);
      61             : 
      62             : void (*zend_on_timeout)(int seconds);
      63             : 
      64             : static void (*zend_message_dispatcher_p)(zend_long message, const void *data);
      65             : static zval *(*zend_get_configuration_directive_p)(zend_string *name);
      66             : 
      67       23558 : static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
      68             : {
      69       23558 :         if (!new_value) {
      70         190 :                 EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
      71             :         } else {
      72       23368 :                 EG(error_reporting) = atoi(new_value->val);
      73             :         }
      74       23558 :         return SUCCESS;
      75             : }
      76             : /* }}} */
      77             : 
      78       21069 : static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
      79             : {
      80       21069 :         OnUpdateBool(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
      81             : 
      82       21069 :         if (GC_G(gc_enabled)) {
      83       21062 :                 gc_init();
      84             :         }
      85             : 
      86       21069 :         return SUCCESS;
      87             : }
      88             : /* }}} */
      89             : 
      90       21049 : static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */
      91             : {
      92       21049 :         if (!CG(multibyte)) {
      93       21006 :                 return FAILURE;
      94             :         }
      95          43 :         if (!zend_multibyte_get_functions()) {
      96          43 :                 return SUCCESS;
      97             :         }
      98           0 :         return zend_multibyte_set_script_encoding_by_string(new_value ? new_value->val : NULL, new_value ? new_value->len : 0);
      99             : }
     100             : /* }}} */
     101             : 
     102       21062 : static ZEND_INI_MH(OnUpdateAssertions) /* {{{ */
     103             : {
     104             :         zend_long *p, val;
     105             : #ifndef ZTS
     106       21062 :         char *base = (char *) mh_arg2;
     107             : #else
     108             :         char *base;
     109             : 
     110             :         base = (char *) ts_resource(*((int *) mh_arg2));
     111             : #endif
     112             : 
     113       21062 :         p = (zend_long *) (base+(size_t) mh_arg1);
     114             : 
     115       21062 :         val = zend_atol(new_value->val, (int)new_value->len);
     116             : 
     117       21084 :         if (stage != ZEND_INI_STAGE_STARTUP &&
     118             :             stage != ZEND_INI_STAGE_SHUTDOWN &&
     119          13 :             *p != val &&
     120           9 :             (*p < 0 || val < 0)) {
     121           3 :                 zend_error(E_WARNING, "zend.assertions may be completely enabled or disabled only in php.ini");
     122           3 :                 return FAILURE;
     123             :         }
     124             : 
     125       21059 :         *p = val;
     126       21059 :         return SUCCESS;
     127             : }
     128             : /* }}} */
     129             : 
     130             : ZEND_INI_BEGIN()
     131             :         ZEND_INI_ENTRY("error_reporting",                             NULL,           ZEND_INI_ALL,           OnUpdateErrorReporting)
     132             :         STD_ZEND_INI_BOOLEAN("zend.assertions",                               "1",    ZEND_INI_ALL,       OnUpdateAssertions,           assertions,   zend_executor_globals,  executor_globals)
     133             :         STD_ZEND_INI_BOOLEAN("zend.enable_gc",                                "1",  ZEND_INI_ALL,           OnUpdateGCEnabled,      gc_enabled,     zend_gc_globals,        gc_globals)
     134             :         STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte,      zend_compiler_globals, compiler_globals)
     135             :         ZEND_INI_ENTRY("zend.script_encoding",                        NULL,           ZEND_INI_ALL,           OnUpdateScriptEncoding)
     136             :         STD_ZEND_INI_BOOLEAN("zend.detect_unicode",                   "1",  ZEND_INI_ALL,           OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
     137             : #ifdef ZEND_SIGNALS
     138             :         STD_ZEND_INI_BOOLEAN("zend.signal_check", "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
     139             : #endif
     140             : ZEND_INI_END()
     141             : 
     142             : 
     143             : #ifdef ZTS
     144             : ZEND_API int compiler_globals_id;
     145             : ZEND_API int executor_globals_id;
     146             : static HashTable *global_function_table = NULL;
     147             : static HashTable *global_class_table = NULL;
     148             : static HashTable *global_constants_table = NULL;
     149             : static HashTable *global_auto_globals_table = NULL;
     150             : static HashTable *global_persistent_list = NULL;
     151             : ZEND_TSRMLS_CACHE_DEFINE();
     152             : #endif
     153             : 
     154             : ZEND_API zend_utility_values zend_uv;
     155             : 
     156             : /* version information */
     157             : static char *zend_version_info;
     158             : static uint zend_version_info_length;
     159             : #define ZEND_CORE_VERSION_INFO  "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2015 Zend Technologies\n"
     160             : #define PRINT_ZVAL_INDENT 4
     161             : 
     162        1372 : static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object) /* {{{ */
     163             : {
     164             :         zval *tmp;
     165             :         zend_string *string_key;
     166             :         zend_ulong num_key;
     167             :         int i;
     168             : 
     169        6404 :         for (i = 0; i < indent; i++) {
     170        5032 :                 ZEND_PUTS_EX(" ");
     171             :         }
     172        1372 :         ZEND_PUTS_EX("(\n");
     173        1372 :         indent += PRINT_ZVAL_INDENT;
     174       14302 :         ZEND_HASH_FOREACH_KEY_VAL(ht, num_key, string_key, tmp) {
     175        6346 :                 if (Z_TYPE_P(tmp) == IS_INDIRECT) {
     176         394 :                         tmp = Z_INDIRECT_P(tmp);
     177         394 :                         if (Z_TYPE_P(tmp) == IS_UNDEF) {
     178           0 :                                 continue;
     179             :                         }
     180             :                 }
     181       46082 :                 for (i = 0; i < indent; i++) {
     182       39736 :                         ZEND_PUTS_EX(" ");
     183             :                 }
     184        6346 :                 ZEND_PUTS_EX("[");
     185        6346 :                 if (string_key) {
     186        4374 :                         if (is_object) {
     187             :                                 const char *prop_name, *class_name;
     188             :                                 size_t prop_len;
     189         775 :                                 int mangled = zend_unmangle_property_name_ex(string_key, &class_name, &prop_name, &prop_len);
     190             : 
     191         775 :                                 ZEND_WRITE_EX(prop_name, prop_len);
     192         775 :                                 if (class_name && mangled == SUCCESS) {
     193         215 :                                         if (class_name[0]=='*') {
     194         105 :                                                 ZEND_PUTS_EX(":protected");
     195             :                                         } else {
     196         110 :                                                 ZEND_PUTS_EX(":");
     197         110 :                                                 ZEND_PUTS_EX(class_name);
     198         110 :                                                 ZEND_PUTS_EX(":private");
     199             :                                         }
     200             :                                 }
     201             :                         } else {
     202        3599 :                                 ZEND_WRITE_EX(string_key->val, string_key->len);
     203             :                         }
     204             :                 } else {
     205             :                         char key[25];
     206        1972 :                         snprintf(key, sizeof(key), ZEND_LONG_FMT, num_key);
     207        1972 :                         ZEND_PUTS_EX(key);
     208             :                 }
     209        6346 :                 ZEND_PUTS_EX("] => ");
     210        6346 :                 zend_print_zval_r_ex(write_func, tmp, indent+PRINT_ZVAL_INDENT);
     211        6346 :                 ZEND_PUTS_EX("\n");
     212             :         } ZEND_HASH_FOREACH_END();
     213        1372 :         indent -= PRINT_ZVAL_INDENT;
     214        6404 :         for (i = 0; i < indent; i++) {
     215        5032 :                 ZEND_PUTS_EX(" ");
     216             :         }
     217        1372 :         ZEND_PUTS_EX(")\n");
     218        1372 : }
     219             : /* }}} */
     220             : 
     221          19 : static void print_flat_hash(HashTable *ht) /* {{{ */
     222             : {
     223             :         zval *tmp;
     224             :         zend_string *string_key;
     225             :         zend_ulong num_key;
     226          19 :         int i = 0;
     227             : 
     228         406 :         ZEND_HASH_FOREACH_KEY_VAL_IND(ht, num_key, string_key, tmp) {
     229         129 :                 if (i++ > 0) {
     230         120 :                         ZEND_PUTS(",");
     231             :                 }
     232         129 :                 ZEND_PUTS("[");
     233         129 :                 if (string_key) {
     234         125 :                         ZEND_WRITE(string_key->val, string_key->len);
     235             :                 } else {
     236           4 :                         zend_printf(ZEND_ULONG_FMT, num_key);
     237             :                 }
     238         129 :                 ZEND_PUTS("] => ");
     239         129 :                 zend_print_flat_zval_r(tmp);
     240             :         } ZEND_HASH_FOREACH_END();
     241          19 : }
     242             : /* }}} */
     243             : 
     244     1427833 : ZEND_API int zend_make_printable_zval(zval *expr, zval *expr_copy) /* {{{ */
     245             : {
     246     1427833 :         if (Z_TYPE_P(expr) == IS_STRING) {
     247           1 :                 return 0;
     248             :         } else {
     249     1427832 :                 ZVAL_STR(expr_copy, _zval_get_string_func(expr));
     250     1427832 :                 return 1;
     251             :         }
     252             : }
     253             : /* }}} */
     254             : 
     255        1069 : ZEND_API size_t zend_print_zval(zval *expr, int indent) /* {{{ */
     256             : {
     257        1069 :         return zend_print_zval_ex(zend_write, expr, indent);
     258             : }
     259             : /* }}} */
     260             : 
     261        7289 : ZEND_API size_t zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
     262             : {
     263        7289 :         zend_string *str = zval_get_string(expr);
     264        7289 :         size_t len = str->len;
     265             : 
     266        7289 :         if (len != 0) {
     267        6983 :                 write_func(str->val, len);
     268             :         }
     269             : 
     270             :         zend_string_release(str);
     271        7289 :         return len;
     272             : }
     273             : /* }}} */
     274             : 
     275         182 : ZEND_API void zend_print_flat_zval_r(zval *expr) /* {{{ */
     276             : {
     277         182 :         switch (Z_TYPE_P(expr)) {
     278             :                 case IS_ARRAY:
     279          17 :                         ZEND_PUTS("Array (");
     280          51 :                         if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr)) &&
     281          34 :                             ++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
     282           0 :                                 ZEND_PUTS(" *RECURSION*");
     283           0 :                                 Z_ARRVAL_P(expr)->u.v.nApplyCount--;
     284           0 :                                 return;
     285             :                         }
     286          17 :                         print_flat_hash(Z_ARRVAL_P(expr));
     287          17 :                         ZEND_PUTS(")");
     288          17 :                         if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr))) {
     289          17 :                                 Z_ARRVAL_P(expr)->u.v.nApplyCount--;
     290             :                         }
     291          17 :                         break;
     292             :                 case IS_OBJECT:
     293             :                 {
     294           2 :                         HashTable *properties = NULL;
     295           2 :                         zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
     296           2 :                         zend_printf("%s Object (", class_name->val);
     297             :                         zend_string_release(class_name);
     298             : 
     299           2 :                         if (Z_OBJ_APPLY_COUNT_P(expr) > 0) {
     300           0 :                                 ZEND_PUTS(" *RECURSION*");
     301           0 :                                 return;
     302             :                         }
     303             : 
     304           2 :                         if (Z_OBJ_HANDLER_P(expr, get_properties)) {
     305           2 :                                 properties = Z_OBJPROP_P(expr);
     306             :                         }
     307           2 :                         if (properties) {
     308           2 :                                 Z_OBJ_INC_APPLY_COUNT_P(expr);
     309           2 :                                 print_flat_hash(properties);
     310           2 :                                 Z_OBJ_DEC_APPLY_COUNT_P(expr);
     311             :                         }
     312           2 :                         ZEND_PUTS(")");
     313           2 :                         break;
     314             :                 }
     315             :                 default:
     316         163 :                         zend_print_variable(expr);
     317             :                         break;
     318             :         }
     319             : }
     320             : /* }}} */
     321             : 
     322        1258 : ZEND_API void zend_print_zval_r(zval *expr, int indent) /* {{{ */
     323             : {
     324        1258 :         zend_print_zval_r_ex(zend_write, expr, indent);
     325        1258 : }
     326             : /* }}} */
     327             : 
     328        7605 : ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
     329             : {
     330        7605 :         ZVAL_DEREF(expr);
     331        7605 :         switch (Z_TYPE_P(expr)) {
     332             :                 case IS_ARRAY:
     333        1073 :                         ZEND_PUTS_EX("Array\n");
     334        3219 :                         if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr)) &&
     335        2146 :                             ++Z_ARRVAL_P(expr)->u.v.nApplyCount>1) {
     336           0 :                                 ZEND_PUTS_EX(" *RECURSION*");
     337           0 :                                 Z_ARRVAL_P(expr)->u.v.nApplyCount--;
     338           0 :                                 return;
     339             :                         }
     340        1073 :                         print_hash(write_func, Z_ARRVAL_P(expr), indent, 0);
     341        1073 :                         if (ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(expr))) {
     342        1073 :                                 Z_ARRVAL_P(expr)->u.v.nApplyCount--;
     343             :                         }
     344        1073 :                         break;
     345             :                 case IS_OBJECT:
     346             :                         {
     347             :                                 HashTable *properties;
     348             :                                 int is_temp;
     349             : 
     350         312 :                                 zend_string *class_name = Z_OBJ_HANDLER_P(expr, get_class_name)(Z_OBJ_P(expr));
     351         312 :                                 ZEND_PUTS_EX(class_name->val);
     352             :                                 zend_string_release(class_name);
     353             : 
     354         312 :                                 ZEND_PUTS_EX(" Object\n");
     355         312 :                                 if (Z_OBJ_APPLY_COUNT_P(expr) > 0) {
     356          13 :                                         ZEND_PUTS_EX(" *RECURSION*");
     357          13 :                                         return;
     358             :                                 }
     359         299 :                                 if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
     360           0 :                                         break;
     361             :                                 }
     362             : 
     363         299 :                                 Z_OBJ_INC_APPLY_COUNT_P(expr);
     364         299 :                                 print_hash(write_func, properties, indent, 1);
     365         299 :                                 Z_OBJ_DEC_APPLY_COUNT_P(expr);
     366             : 
     367         299 :                                 if (is_temp) {
     368          47 :                                         zend_hash_destroy(properties);
     369          47 :                                         FREE_HASHTABLE(properties);
     370             :                                 }
     371         299 :                                 break;
     372             :                         }
     373             :                 default:
     374        6220 :                         zend_print_zval_ex(write_func, expr, indent);
     375             :                         break;
     376             :         }
     377             : }
     378             : /* }}} */
     379             : 
     380           0 : static FILE *zend_fopen_wrapper(const char *filename, zend_string **opened_path) /* {{{ */
     381             : {
     382           0 :         if (opened_path) {
     383           0 :                 *opened_path = zend_string_init(filename, strlen(filename), 0);
     384             :         }
     385           0 :         return fopen(filename, "rb");
     386             : }
     387             : /* }}} */
     388             : 
     389             : #ifdef ZTS
     390             : static zend_bool short_tags_default      = 1;
     391             : static uint32_t compiler_options_default = ZEND_COMPILE_DEFAULT;
     392             : #else
     393             : # define short_tags_default                     1
     394             : # define compiler_options_default       ZEND_COMPILE_DEFAULT
     395             : #endif
     396             : 
     397       21049 : static void zend_set_default_compile_time_values(void) /* {{{ */
     398             : {
     399             :         /* default compile-time values */
     400       21049 :         CG(short_tags) = short_tags_default;
     401       21049 :         CG(compiler_options) = compiler_options_default;
     402       21049 : }
     403             : /* }}} */
     404             : 
     405             : #ifdef ZEND_WIN32
     406             : static void zend_get_windows_version_info(OSVERSIONINFOEX *osvi) /* {{{ */
     407             : {
     408             :         ZeroMemory(osvi, sizeof(OSVERSIONINFOEX));
     409             :         osvi->dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
     410             :         if(!GetVersionEx((OSVERSIONINFO *) osvi)) {
     411             :                 ZEND_ASSERT(0); /* Should not happen as sizeof is used. */
     412             :         }
     413             : }
     414             : /* }}} */
     415             : #endif
     416             : 
     417       21049 : static void zend_init_exception_op(void) /* {{{ */
     418             : {
     419       21049 :         memset(EG(exception_op), 0, sizeof(EG(exception_op)));
     420       21049 :         EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
     421       21049 :         EG(exception_op)[0].op1_type = IS_UNUSED;
     422       21049 :         EG(exception_op)[0].op2_type = IS_UNUSED;
     423       21049 :         EG(exception_op)[0].result_type = IS_UNUSED;
     424       21049 :         ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
     425       21049 :         EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
     426       21049 :         EG(exception_op)[1].op1_type = IS_UNUSED;
     427       21049 :         EG(exception_op)[1].op2_type = IS_UNUSED;
     428       21049 :         EG(exception_op)[1].result_type = IS_UNUSED;
     429       21049 :         ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
     430       21049 :         EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
     431       21049 :         EG(exception_op)[2].op1_type = IS_UNUSED;
     432       21049 :         EG(exception_op)[2].op2_type = IS_UNUSED;
     433       21049 :         EG(exception_op)[2].result_type = IS_UNUSED;
     434       21049 :         ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
     435       21049 : }
     436             : /* }}} */
     437             : 
     438       21049 : static void zend_init_call_trampoline_op(void) /* {{{ */
     439             : {
     440       21049 :         memset(&EG(call_trampoline_op), 0, sizeof(EG(call_trampoline_op)));
     441       21049 :         EG(call_trampoline_op).opcode = ZEND_CALL_TRAMPOLINE;
     442       21049 :         EG(call_trampoline_op).op1_type = IS_UNUSED;
     443       21049 :         EG(call_trampoline_op).op2_type = IS_UNUSED;
     444       21049 :         EG(call_trampoline_op).result_type = IS_UNUSED;
     445       21049 :         ZEND_VM_SET_OPCODE_HANDLER(&EG(call_trampoline_op));
     446       21049 : }
     447             : /* }}} */
     448             : 
     449             : #ifdef ZTS
     450             : static void function_copy_ctor(zval *zv)
     451             : {
     452             :         zend_function *old_func = Z_FUNC_P(zv);
     453             :         Z_FUNC_P(zv) = pemalloc(sizeof(zend_internal_function), 1);
     454             :         memcpy(Z_FUNC_P(zv), old_func, sizeof(zend_internal_function));
     455             :         function_add_ref(Z_FUNC_P(zv));
     456             : }
     457             : 
     458             : static void compiler_globals_ctor(zend_compiler_globals *compiler_globals) /* {{{ */
     459             : {
     460             :         compiler_globals->compiled_filename = NULL;
     461             : 
     462             :         compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
     463             :         zend_hash_init_ex(compiler_globals->function_table, 1024, NULL, ZEND_FUNCTION_DTOR, 1, 0);
     464             :         zend_hash_copy(compiler_globals->function_table, global_function_table, function_copy_ctor);
     465             : 
     466             :         compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
     467             :         zend_hash_init_ex(compiler_globals->class_table, 64, NULL, ZEND_CLASS_DTOR, 1, 0);
     468             :         zend_hash_copy(compiler_globals->class_table, global_class_table, zend_class_add_ref);
     469             : 
     470             :         zend_set_default_compile_time_values();
     471             : 
     472             :         compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
     473             :         zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
     474             :         zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL /* empty element */);
     475             : 
     476             :         compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table);
     477             :         if (compiler_globals->last_static_member) {
     478             :                 compiler_globals->static_members_table = calloc(compiler_globals->last_static_member, sizeof(zval*));
     479             :         } else {
     480             :                 compiler_globals->static_members_table = NULL;
     481             :         }
     482             :         compiler_globals->script_encoding_list = NULL;
     483             : 
     484             : #ifdef ZTS
     485             :         zend_interned_empty_string_init(&compiler_globals->empty_string);
     486             : 
     487             :         memset(compiler_globals->one_char_string, 0, sizeof(compiler_globals->one_char_string));
     488             : #endif
     489             : }
     490             : /* }}} */
     491             : 
     492             : static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) /* {{{ */
     493             : {
     494             :         if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
     495             :                 zend_hash_destroy(compiler_globals->function_table);
     496             :                 free(compiler_globals->function_table);
     497             :         }
     498             :         if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
     499             :                 zend_hash_destroy(compiler_globals->class_table);
     500             :                 free(compiler_globals->class_table);
     501             :         }
     502             :         if (compiler_globals->auto_globals != GLOBAL_AUTO_GLOBALS_TABLE) {
     503             :                 zend_hash_destroy(compiler_globals->auto_globals);
     504             :                 free(compiler_globals->auto_globals);
     505             :         }
     506             :         if (compiler_globals->static_members_table) {
     507             :                 free(compiler_globals->static_members_table);
     508             :         }
     509             :         if (compiler_globals->script_encoding_list) {
     510             :                 pefree((char*)compiler_globals->script_encoding_list, 1);
     511             :         }
     512             :         compiler_globals->last_static_member = 0;
     513             : 
     514             : #ifdef ZTS
     515             :         zend_interned_empty_string_free(&compiler_globals->empty_string);
     516             : #endif
     517             : }
     518             : /* }}} */
     519             : 
     520             : static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{{ */
     521             : {
     522             :         ZEND_TSRMLS_CACHE_UPDATE();
     523             : 
     524             :         zend_startup_constants();
     525             :         zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
     526             :         zend_init_rsrc_plist();
     527             :         zend_init_exception_op();
     528             :         zend_init_call_trampoline_op();
     529             :         memset(&executor_globals->trampoline, 0, sizeof(zend_op_array));
     530             :         executor_globals->lambda_count = 0;
     531             :         ZVAL_UNDEF(&executor_globals->user_error_handler);
     532             :         ZVAL_UNDEF(&executor_globals->user_exception_handler);
     533             :         executor_globals->in_autoload = NULL;
     534             :         executor_globals->current_execute_data = NULL;
     535             :         executor_globals->current_module = NULL;
     536             :         executor_globals->exit_status = 0;
     537             : #if XPFPA_HAVE_CW
     538             :         executor_globals->saved_fpu_cw = 0;
     539             : #endif
     540             :         executor_globals->saved_fpu_cw_ptr = NULL;
     541             :         executor_globals->active = 0;
     542             :         executor_globals->bailout = NULL;
     543             :         executor_globals->error_handling  = EH_NORMAL;
     544             :         executor_globals->exception_class = NULL;
     545             :         executor_globals->exception = NULL;
     546             :         executor_globals->objects_store.object_buckets = NULL;
     547             : #ifdef ZEND_WIN32
     548             :         zend_get_windows_version_info(&executor_globals->windows_version_info);
     549             : #endif
     550             : }
     551             : /* }}} */
     552             : 
     553             : static void executor_globals_dtor(zend_executor_globals *executor_globals) /* {{{ */
     554             : {
     555             : #ifdef ZTS
     556             :         zend_ini_dtor(executor_globals->ini_directives);
     557             : #else
     558             :         zend_ini_shutdown();
     559             : #endif
     560             :         if (&executor_globals->persistent_list != global_persistent_list) {
     561             :                 zend_destroy_rsrc_list(&executor_globals->persistent_list);
     562             :         }
     563             :         if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
     564             :                 zend_hash_destroy(executor_globals->zend_constants);
     565             :                 free(executor_globals->zend_constants);
     566             :         }
     567             : }
     568             : /* }}} */
     569             : 
     570             : static void zend_new_thread_end_handler(THREAD_T thread_id) /* {{{ */
     571             : {
     572             :         if (zend_copy_ini_directives() == SUCCESS) {
     573             :                 zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP);
     574             :         }
     575             : }
     576             : /* }}} */
     577             : #endif
     578             : 
     579             : #if defined(__FreeBSD__) || defined(__DragonFly__)
     580             : /* FreeBSD and DragonFly floating point precision fix */
     581             : #include <floatingpoint.h>
     582             : #endif
     583             : 
     584       21049 : static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p) /* {{{ */
     585             : {
     586       21049 :         memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
     587       21049 : }
     588             : /* }}} */
     589             : 
     590       21049 : static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p) /* {{{ */
     591             : {
     592       21049 :         memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
     593       21049 : }
     594             : /* }}} */
     595             : 
     596             : void zend_init_opcodes_handlers(void);
     597             : 
     598     1434020 : static void module_destructor_zval(zval *zv) /* {{{ */
     599             : {
     600     1434020 :         zend_module_entry *module = (zend_module_entry*)Z_PTR_P(zv);
     601             : 
     602     1434020 :         module_destructor(module);
     603     1434020 :         free(module);
     604     1434020 : }
     605             : /* }}} */
     606             : 
     607      189765 : static void auto_global_dtor(zval *zv) /* {{{ */
     608             : {
     609      189765 :         free(Z_PTR_P(zv));
     610      189765 : }
     611             : /* }}} */
     612             : 
     613         173 : static zend_bool php_auto_globals_create_globals(zend_string *name) /* {{{ */
     614             : {
     615             :         zval globals;
     616             : 
     617         173 :         ZVAL_ARR(&globals, &EG(symbol_table));
     618         173 :         Z_TYPE_INFO_P(&globals) = IS_ARRAY | (IS_TYPE_SYMBOLTABLE << Z_TYPE_FLAGS_SHIFT);
     619         173 :         ZVAL_NEW_REF(&globals, &globals);
     620         173 :         zend_hash_update(&EG(symbol_table), name, &globals);
     621         173 :         return 0;
     622             : }
     623             : /* }}} */
     624             : 
     625       21049 : int zend_startup(zend_utility_functions *utility_functions, char **extensions) /* {{{ */
     626             : {
     627             : #ifdef ZTS
     628             :         zend_compiler_globals *compiler_globals;
     629             :         zend_executor_globals *executor_globals;
     630             :         extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
     631             :         extern ZEND_API ts_rsrc_id language_scanner_globals_id;
     632             :         ZEND_TSRMLS_CACHE_UPDATE();
     633             : #else
     634             :         extern zend_ini_scanner_globals ini_scanner_globals;
     635             :         extern zend_php_scanner_globals language_scanner_globals;
     636             : #endif
     637             : 
     638       21049 :         start_memory_manager();
     639             : 
     640       21049 :         virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
     641             : 
     642             : #if defined(__FreeBSD__) || defined(__DragonFly__)
     643             :         /* FreeBSD and DragonFly floating point precision fix */
     644             :         fpsetmask(0);
     645             : #endif
     646             : 
     647       21049 :         zend_startup_strtod();
     648       21049 :         zend_startup_extensions_mechanism();
     649             : 
     650             :         /* Set up utility functions and values */
     651       21049 :         zend_error_cb = utility_functions->error_function;
     652       21049 :         zend_printf = utility_functions->printf_function;
     653       21049 :         zend_write = (zend_write_func_t) utility_functions->write_function;
     654       21049 :         zend_fopen = utility_functions->fopen_function;
     655       21049 :         if (!zend_fopen) {
     656           0 :                 zend_fopen = zend_fopen_wrapper;
     657             :         }
     658       21049 :         zend_stream_open_function = utility_functions->stream_open_function;
     659       21049 :         zend_message_dispatcher_p = utility_functions->message_handler;
     660             : #ifndef ZEND_SIGNALS
     661       21049 :         zend_block_interruptions = utility_functions->block_interruptions;
     662       21049 :         zend_unblock_interruptions = utility_functions->unblock_interruptions;
     663             : #endif
     664       21049 :         zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
     665       21049 :         zend_ticks_function = utility_functions->ticks_function;
     666       21049 :         zend_on_timeout = utility_functions->on_timeout;
     667       21049 :         zend_vspprintf = utility_functions->vspprintf_function;
     668       21049 :         zend_vstrpprintf = utility_functions->vstrpprintf_function;
     669       21049 :         zend_getenv = utility_functions->getenv_function;
     670       21049 :         zend_resolve_path = utility_functions->resolve_path_function;
     671             : 
     672             : #if HAVE_DTRACE
     673             : /* build with dtrace support */
     674             :         zend_compile_file = dtrace_compile_file;
     675             :         zend_execute_ex = dtrace_execute_ex;
     676             :         zend_execute_internal = dtrace_execute_internal;
     677             : #else
     678       21049 :         zend_compile_file = compile_file;
     679       21049 :         zend_execute_ex = execute_ex;
     680       21049 :         zend_execute_internal = NULL;
     681             : #endif /* HAVE_SYS_SDT_H */
     682       21049 :         zend_compile_string = compile_string;
     683       21049 :         zend_throw_exception_hook = NULL;
     684             : 
     685             :         /* Set up the default garbage collection implementation. */
     686       21049 :         gc_collect_cycles = zend_gc_collect_cycles;
     687             : 
     688       21049 :         zend_init_opcodes_handlers();
     689             : 
     690             :         /* set up version */
     691       21049 :         zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
     692       21049 :         zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO) - 1;
     693             : 
     694       21049 :         GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
     695       21049 :         GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
     696       21049 :         GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
     697       21049 :         GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable));
     698             : 
     699       21049 :         zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 1024, NULL, ZEND_FUNCTION_DTOR, 1, 0);
     700       21049 :         zend_hash_init_ex(GLOBAL_CLASS_TABLE, 64, NULL, ZEND_CLASS_DTOR, 1, 0);
     701       21049 :         zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, auto_global_dtor, 1, 0);
     702       21049 :         zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 128, NULL, ZEND_CONSTANT_DTOR, 1, 0);
     703             : 
     704       21049 :         zend_hash_init_ex(&module_registry, 32, NULL, module_destructor_zval, 1, 0);
     705       21049 :         zend_init_rsrc_list_dtors();
     706             : 
     707             : #ifdef ZTS
     708             :         ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
     709             :         ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
     710             :         ts_allocate_id(&language_scanner_globals_id, sizeof(zend_php_scanner_globals), (ts_allocate_ctor) php_scanner_globals_ctor, NULL);
     711             :         ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_ini_scanner_globals), (ts_allocate_ctor) ini_scanner_globals_ctor, NULL);
     712             :         compiler_globals = ts_resource(compiler_globals_id);
     713             :         executor_globals = ts_resource(executor_globals_id);
     714             : 
     715             :         compiler_globals_dtor(compiler_globals);
     716             :         compiler_globals->in_compilation = 0;
     717             :         compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
     718             :         compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
     719             : 
     720             :         *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
     721             :         *compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
     722             :         compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
     723             : 
     724             :         zend_hash_destroy(executor_globals->zend_constants);
     725             :         *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
     726             : #else
     727       21049 :         ini_scanner_globals_ctor(&ini_scanner_globals);
     728       21049 :         php_scanner_globals_ctor(&language_scanner_globals);
     729       21049 :         zend_set_default_compile_time_values();
     730             : #ifdef ZEND_WIN32
     731             :         zend_get_windows_version_info(&EG(windows_version_info));
     732             : #endif
     733             : #endif
     734       21049 :         EG(error_reporting) = E_ALL & ~E_NOTICE;
     735             : 
     736       21049 :         zend_interned_strings_init();
     737       21049 :         zend_startup_builtin_functions();
     738       21049 :         zend_register_standard_constants();
     739       21049 :         zend_register_auto_global(zend_string_init("GLOBALS", sizeof("GLOBALS") - 1, 1), 1, php_auto_globals_create_globals);
     740             : 
     741             : #ifndef ZTS
     742       21049 :         zend_init_rsrc_plist();
     743       21049 :         zend_init_exception_op();
     744       21049 :         zend_init_call_trampoline_op();
     745             : #endif
     746             : 
     747       21049 :         zend_ini_startup();
     748             : 
     749             : #ifdef ZTS
     750             :         tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
     751             : #endif
     752             : 
     753             : #ifdef ZEND_SIGNALS
     754             :         zend_signal_startup();
     755             : #endif
     756             : 
     757       21049 :         return SUCCESS;
     758             : }
     759             : /* }}} */
     760             : 
     761       21049 : void zend_register_standard_ini_entries(void) /* {{{ */
     762             : {
     763       21049 :         int module_number = 0;
     764             : 
     765       21049 :         REGISTER_INI_ENTRIES();
     766       21049 : }
     767             : /* }}} */
     768             : 
     769             : /* Unlink the global (r/o) copies of the class, function and constant tables,
     770             :  * and use a fresh r/w copy for the startup thread
     771             :  */
     772       21049 : void zend_post_startup(void) /* {{{ */
     773             : {
     774             : #ifdef ZTS
     775             :         zend_encoding **script_encoding_list;
     776             : 
     777             :         zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
     778             :         zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
     779             : 
     780             :         *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
     781             :         *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
     782             :         *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
     783             : 
     784             :         short_tags_default = CG(short_tags);
     785             :         compiler_options_default = CG(compiler_options);
     786             : 
     787             :         zend_destroy_rsrc_list(&EG(persistent_list));
     788             :         free(compiler_globals->function_table);
     789             :         free(compiler_globals->class_table);
     790             :         if ((script_encoding_list = (zend_encoding **)compiler_globals->script_encoding_list)) {
     791             :                 compiler_globals_ctor(compiler_globals);
     792             :                 compiler_globals->script_encoding_list = (const zend_encoding **)script_encoding_list;
     793             :         } else {
     794             :                 compiler_globals_ctor(compiler_globals);
     795             :         }
     796             :         free(EG(zend_constants));
     797             : 
     798             :         virtual_cwd_deactivate();
     799             : 
     800             :         executor_globals_ctor(executor_globals);
     801             :         global_persistent_list = &EG(persistent_list);
     802             :         zend_copy_ini_directives();
     803             : #else
     804       21049 :         virtual_cwd_deactivate();
     805             : #endif
     806       21049 : }
     807             : /* }}} */
     808             : 
     809       21085 : void zend_shutdown(void) /* {{{ */
     810             : {
     811       21085 :         zend_destroy_rsrc_list(&EG(persistent_list));
     812       21085 :         if (EG(active))
     813             :         {
     814             :                 /*
     815             :                  * The order of destruction is important here.
     816             :                  * See bugs #65463 and 66036.
     817             :                  */
     818             :                 zend_function *func;
     819             :                 zend_class_entry *ce;
     820             : 
     821           0 :                 ZEND_HASH_REVERSE_FOREACH_PTR(GLOBAL_FUNCTION_TABLE, func) {
     822           0 :                         if (func->type == ZEND_USER_FUNCTION) {
     823           0 :                                 zend_cleanup_op_array_data((zend_op_array *) func);
     824             :                         }
     825             :                 } ZEND_HASH_FOREACH_END();
     826           0 :                 ZEND_HASH_REVERSE_FOREACH_PTR(GLOBAL_CLASS_TABLE, ce) {
     827           0 :                         if (ce->type == ZEND_USER_CLASS) {
     828           0 :                                 zend_cleanup_user_class_data(ce);
     829             :                         } else {
     830           0 :                                 break;
     831             :                         }
     832             :                 } ZEND_HASH_FOREACH_END();
     833           0 :                 zend_cleanup_internal_classes();
     834           0 :                 zend_hash_reverse_apply(GLOBAL_FUNCTION_TABLE, (apply_func_t) clean_non_persistent_function_full);
     835           0 :                 zend_hash_reverse_apply(GLOBAL_CLASS_TABLE, (apply_func_t) clean_non_persistent_class_full);
     836             :         }
     837       21085 :         zend_destroy_modules();
     838             : 
     839       21085 :         virtual_cwd_deactivate();
     840       21085 :         virtual_cwd_shutdown();
     841             : 
     842       21085 :         zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
     843       21085 :         zend_hash_destroy(GLOBAL_CLASS_TABLE);
     844             : 
     845       21085 :         zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
     846       21085 :         free(GLOBAL_AUTO_GLOBALS_TABLE);
     847             : 
     848       21085 :         zend_shutdown_extensions();
     849       21085 :         free(zend_version_info);
     850             : 
     851       21085 :         free(GLOBAL_FUNCTION_TABLE);
     852       21085 :         free(GLOBAL_CLASS_TABLE);
     853             : 
     854       21085 :         zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
     855       21085 :         free(GLOBAL_CONSTANTS_TABLE);
     856       21085 :         zend_shutdown_strtod();
     857             : 
     858             : #ifdef ZTS
     859             :         GLOBAL_FUNCTION_TABLE = NULL;
     860             :         GLOBAL_CLASS_TABLE = NULL;
     861             :         GLOBAL_AUTO_GLOBALS_TABLE = NULL;
     862             :         GLOBAL_CONSTANTS_TABLE = NULL;
     863             : #endif
     864       21085 :         zend_destroy_rsrc_list_dtors();
     865             : 
     866       21085 :         zend_interned_strings_dtor();
     867       21085 : }
     868             : /* }}} */
     869             : 
     870       21049 : void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */
     871             : {
     872       21049 :         zend_uv = *utility_values;
     873       21049 :         zend_uv.import_use_extension_length = (uint)strlen(zend_uv.import_use_extension);
     874       21049 : }
     875             : /* }}} */
     876             : 
     877             : /* this should be compatible with the standard zenderror */
     878          55 : void zenderror(const char *error) /* {{{ */
     879             : {
     880          55 :         if (EG(exception)) {
     881             :                 /* An exception was thrown in the lexer, don't throw another in the parser. */
     882          10 :                 return;
     883             :         }
     884             : 
     885          45 :         zend_throw_exception(zend_get_parse_error(), error, E_PARSE);
     886             : }
     887             : /* }}} */
     888             : 
     889             : BEGIN_EXTERN_C()
     890        2264 : ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
     891             : {
     892             : 
     893        2264 :         if (!EG(bailout)) {
     894           0 :                 zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
     895           0 :                 exit(-1);
     896             :         }
     897        2264 :         CG(unclean_shutdown) = 1;
     898        2264 :         CG(active_class_entry) = NULL;
     899        2264 :         CG(in_compilation) = 0;
     900        2264 :         EG(current_execute_data) = NULL;
     901        2264 :         LONGJMP(*EG(bailout), FAILURE);
     902             : }
     903             : /* }}} */
     904             : END_EXTERN_C()
     905             : 
     906       20883 : ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ */
     907             : {
     908             :         char *new_info;
     909             :         uint new_info_length;
     910             : 
     911       83532 :         new_info_length = (uint)(sizeof("    with  v, , by \n")
     912       20883 :                                                 + strlen(extension->name)
     913       20883 :                                                 + strlen(extension->version)
     914       20883 :                                                 + strlen(extension->copyright)
     915       20883 :                                                 + strlen(extension->author));
     916             : 
     917       20883 :         new_info = (char *) malloc(new_info_length + 1);
     918             : 
     919       20883 :         snprintf(new_info, new_info_length, "    with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
     920             : 
     921       20883 :         zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length + 1);
     922       20883 :         strncat(zend_version_info, new_info, new_info_length);
     923       20883 :         zend_version_info_length += new_info_length;
     924       20883 :         free(new_info);
     925       20883 : }
     926             : /* }}} */
     927             : 
     928         165 : ZEND_API char *get_zend_version(void) /* {{{ */
     929             : {
     930         165 :         return zend_version_info;
     931             : }
     932             : /* }}} */
     933             : 
     934       21006 : ZEND_API void zend_activate(void) /* {{{ */
     935             : {
     936             : #ifdef ZTS
     937             :         virtual_cwd_activate();
     938             : #endif
     939       21006 :         gc_reset();
     940       21006 :         init_compiler();
     941       21006 :         init_executor();
     942       21006 :         startup_scanner();
     943       21006 : }
     944             : /* }}} */
     945             : 
     946       21044 : void zend_call_destructors(void) /* {{{ */
     947             : {
     948       21044 :         zend_try {
     949       21044 :                 shutdown_destructors();
     950       21044 :         } zend_end_try();
     951       21044 : }
     952             : /* }}} */
     953             : 
     954       21044 : ZEND_API void zend_deactivate(void) /* {{{ */
     955             : {
     956             :         /* we're no longer executing anything */
     957       21044 :         EG(current_execute_data) = NULL;
     958             : 
     959       21044 :         zend_try {
     960       21044 :                 shutdown_scanner();
     961       21044 :         } zend_end_try();
     962             : 
     963             :         /* shutdown_executor() takes care of its own bailout handling */
     964       21044 :         shutdown_executor();
     965             : 
     966       21044 :         zend_try {
     967       21044 :                 shutdown_compiler();
     968       21044 :         } zend_end_try();
     969             : 
     970       21044 :         zend_destroy_rsrc_list(&EG(regular_list));
     971             : 
     972             : #if GC_BENCH
     973             :         fprintf(stderr, "GC Statistics\n");
     974             :         fprintf(stderr, "-------------\n");
     975             :         fprintf(stderr, "Runs:               %d\n", GC_G(gc_runs));
     976             :         fprintf(stderr, "Collected:          %d\n", GC_G(collected));
     977             :         fprintf(stderr, "Root buffer length: %d\n", GC_G(root_buf_length));
     978             :         fprintf(stderr, "Root buffer peak:   %d\n\n", GC_G(root_buf_peak));
     979             :         fprintf(stderr, "      Possible            Remove from  Marked\n");
     980             :         fprintf(stderr, "        Root    Buffered     buffer     grey\n");
     981             :         fprintf(stderr, "      --------  --------  -----------  ------\n");
     982             :         fprintf(stderr, "ZVAL  %8d  %8d  %9d  %8d\n", GC_G(zval_possible_root), GC_G(zval_buffered), GC_G(zval_remove_from_buffer), GC_G(zval_marked_grey));
     983             :         fprintf(stderr, "ZOBJ  %8d  %8d  %9d  %8d\n", GC_G(zobj_possible_root), GC_G(zobj_buffered), GC_G(zobj_remove_from_buffer), GC_G(zobj_marked_grey));
     984             : #endif
     985             : 
     986       21044 :         zend_try {
     987       21044 :                 zend_ini_deactivate();
     988       21044 :         } zend_end_try();
     989       21044 : }
     990             : /* }}} */
     991             : 
     992             : BEGIN_EXTERN_C()
     993          34 : ZEND_API void zend_message_dispatcher(zend_long message, const void *data) /* {{{ */
     994             : {
     995          34 :         if (zend_message_dispatcher_p) {
     996          34 :                 zend_message_dispatcher_p(message, data);
     997             :         }
     998          31 : }
     999             : /* }}} */
    1000             : END_EXTERN_C()
    1001             : 
    1002     5261208 : ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
    1003             : {
    1004     5261208 :         if (zend_get_configuration_directive_p) {
    1005     5261208 :                 return zend_get_configuration_directive_p(name);
    1006             :         } else {
    1007           0 :                 return NULL;
    1008             :         }
    1009             : }
    1010             : /* }}} */
    1011             : 
    1012             : #define SAVE_STACK(stack) do { \
    1013             :                 if (CG(stack).top) { \
    1014             :                         memcpy(&stack, &CG(stack), sizeof(zend_stack)); \
    1015             :                         CG(stack).top = CG(stack).max = 0; \
    1016             :                         CG(stack).elements = NULL; \
    1017             :                 } else { \
    1018             :                         stack.top = 0; \
    1019             :                 } \
    1020             :         } while (0)
    1021             : 
    1022             : #define RESTORE_STACK(stack) do { \
    1023             :                 if (stack.top) { \
    1024             :                         zend_stack_destroy(&CG(stack)); \
    1025             :                         memcpy(&CG(stack), &stack, sizeof(zend_stack)); \
    1026             :                 } \
    1027             :         } while (0)
    1028             : 
    1029             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1030      381555 : ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
    1031             : #else
    1032             : static void zend_error_va_list(int type, const char *format, va_list args)
    1033             : #endif
    1034             : {
    1035             :         char *str;
    1036             :         int len;
    1037             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1038             :         va_list args;
    1039             : #endif
    1040             :         va_list usr_copy;
    1041             :         zval params[5];
    1042             :         zval retval;
    1043             :         const char *error_filename;
    1044      381555 :         uint error_lineno = 0;
    1045             :         zval orig_user_error_handler;
    1046             :         zend_bool in_compilation;
    1047             :         zend_class_entry *saved_class_entry;
    1048             :         zend_stack loop_var_stack;
    1049             :         zend_stack delayed_oplines_stack;
    1050             :         zend_array *symbol_table;
    1051             : 
    1052      381555 :         if (type & E_EXCEPTION) {
    1053         302 :                 type &= ~E_EXCEPTION;
    1054             :                 //TODO: we can't convert compile-time errors to exceptions yet???
    1055         302 :                 if (EG(current_execute_data) && !CG(in_compilation)) {
    1056         299 :                         char *message = NULL;
    1057             : 
    1058             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1059         299 :                         va_start(args, format);
    1060             : #endif
    1061         299 :                         zend_vspprintf(&message, 0, format, args);
    1062         299 :                         zend_throw_exception(zend_get_error(), message, type);
    1063         299 :                         efree(message);
    1064             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1065         299 :                         va_end(args);
    1066             : #endif
    1067         299 :                         return;
    1068             :                 }
    1069             :         }
    1070             : 
    1071             :         /* Report about uncaught exception in case of fatal errors */
    1072      381256 :         if (EG(exception)) {
    1073             :                 zend_execute_data *ex;
    1074             :                 const zend_op *opline;
    1075             : 
    1076          51 :                 switch (type) {
    1077             :                         case E_CORE_ERROR:
    1078             :                         case E_ERROR:
    1079             :                         case E_RECOVERABLE_ERROR:
    1080             :                         case E_PARSE:
    1081             :                         case E_COMPILE_ERROR:
    1082             :                         case E_USER_ERROR:
    1083           9 :                                 ex = EG(current_execute_data);
    1084           9 :                                 opline = NULL;
    1085          26 :                                 while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
    1086           8 :                                         ex = ex->prev_execute_data;
    1087             :                                 }
    1088          10 :                                 if (ex && ex->opline->opcode == ZEND_HANDLE_EXCEPTION &&
    1089           1 :                                     EG(opline_before_exception)) {
    1090           1 :                                         opline = EG(opline_before_exception);
    1091             :                                 }
    1092           9 :                                 zend_exception_error(EG(exception), E_WARNING);
    1093           9 :                                 EG(exception) = NULL;
    1094           9 :                                 if (opline) {
    1095           1 :                                         ex->opline = opline;
    1096             :                                 }
    1097             :                                 break;
    1098             :                         default:
    1099             :                                 break;
    1100             :                 }
    1101             :         }
    1102             : 
    1103             :         /* Obtain relevant filename and lineno */
    1104      381256 :         switch (type) {
    1105             :                 case E_CORE_ERROR:
    1106             :                 case E_CORE_WARNING:
    1107           5 :                         error_filename = NULL;
    1108           5 :                         error_lineno = 0;
    1109           5 :                         break;
    1110             :                 case E_PARSE:
    1111             :                 case E_COMPILE_ERROR:
    1112             :                 case E_COMPILE_WARNING:
    1113             :                 case E_ERROR:
    1114             :                 case E_NOTICE:
    1115             :                 case E_STRICT:
    1116             :                 case E_DEPRECATED:
    1117             :                 case E_WARNING:
    1118             :                 case E_USER_ERROR:
    1119             :                 case E_USER_WARNING:
    1120             :                 case E_USER_NOTICE:
    1121             :                 case E_USER_DEPRECATED:
    1122             :                 case E_RECOVERABLE_ERROR:
    1123      381251 :                         if (zend_is_compiling()) {
    1124         338 :                                 error_filename = zend_get_compiled_filename()->val;
    1125         338 :                                 error_lineno = zend_get_compiled_lineno();
    1126      380913 :                         } else if (zend_is_executing()) {
    1127      380878 :                                 error_filename = zend_get_executed_filename();
    1128      380878 :                                 if (error_filename[0] == '[') { /* [no active file] */
    1129           6 :                                         error_filename = NULL;
    1130           6 :                                         error_lineno = 0;
    1131             :                                 } else {
    1132      380872 :                                         error_lineno = zend_get_executed_lineno();
    1133             :                                 }
    1134             :                         } else {
    1135          35 :                                 error_filename = NULL;
    1136          35 :                                 error_lineno = 0;
    1137             :                         }
    1138      381251 :                         break;
    1139             :                 default:
    1140           0 :                         error_filename = NULL;
    1141           0 :                         error_lineno = 0;
    1142             :                         break;
    1143             :         }
    1144      381256 :         if (!error_filename) {
    1145          46 :                 error_filename = "Unknown";
    1146             :         }
    1147             : 
    1148             : #ifdef HAVE_DTRACE
    1149             :         if (DTRACE_ERROR_ENABLED()) {
    1150             :                 char *dtrace_error_buffer;
    1151             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1152             :                 va_start(args, format);
    1153             : #endif
    1154             :                 zend_vspprintf(&dtrace_error_buffer, 0, format, args);
    1155             :                 DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
    1156             :                 efree(dtrace_error_buffer);
    1157             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1158             :                 va_end(args);
    1159             : #endif
    1160             :         }
    1161             : #endif /* HAVE_DTRACE */
    1162             : 
    1163             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1164      381256 :         va_start(args, format);
    1165             : #endif
    1166             : 
    1167             :         /* if we don't have a user defined error handler */
    1168      764235 :         if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF
    1169        2170 :                 || !(EG(user_error_handler_error_reporting) & type)
    1170        2143 :                 || EG(error_handling) != EH_NORMAL) {
    1171      379113 :                 zend_error_cb(type, error_filename, error_lineno, format, args);
    1172        2143 :         } else switch (type) {
    1173             :                 case E_ERROR:
    1174             :                 case E_PARSE:
    1175             :                 case E_CORE_ERROR:
    1176             :                 case E_CORE_WARNING:
    1177             :                 case E_COMPILE_ERROR:
    1178             :                 case E_COMPILE_WARNING:
    1179             :                         /* The error may not be safe to handle in user-space */
    1180           5 :                         zend_error_cb(type, error_filename, error_lineno, format, args);
    1181           0 :                         break;
    1182             :                 default:
    1183             :                         /* Handle the error in user space */
    1184             : /* va_copy() is __va_copy() in old gcc versions.
    1185             :  * According to the autoconf manual, using
    1186             :  * memcpy(&dst, &src, sizeof(va_list))
    1187             :  * gives maximum portability. */
    1188             : #ifndef va_copy
    1189             : # ifdef __va_copy
    1190             : #  define va_copy(dest, src)    __va_copy((dest), (src))
    1191             : # else
    1192             : #  define va_copy(dest, src)    memcpy(&(dest), &(src), sizeof(va_list))
    1193             : # endif
    1194             : #endif
    1195        2138 :                         va_copy(usr_copy, args);
    1196        2138 :                         len = (int)zend_vspprintf(&str, 0, format, usr_copy);
    1197        4276 :                         ZVAL_NEW_STR(&params[1], zend_string_init(str, len, 0));
    1198        2138 :                         efree(str);
    1199             : #ifdef va_copy
    1200        2138 :                         va_end(usr_copy);
    1201             : #endif
    1202             : 
    1203        2138 :                         ZVAL_LONG(&params[0], type);
    1204             : 
    1205        2138 :                         if (error_filename) {
    1206        4276 :                                 ZVAL_STRING(&params[2], error_filename);
    1207             :                         } else {
    1208           0 :                                 ZVAL_NULL(&params[2]);
    1209             :                         }
    1210             : 
    1211        2138 :                         ZVAL_LONG(&params[3], error_lineno);
    1212             : 
    1213        2138 :                         symbol_table = zend_rebuild_symbol_table();
    1214             : 
    1215             :                         /* during shutdown the symbol table table can be still null */
    1216        2138 :                         if (!symbol_table) {
    1217           0 :                                 ZVAL_NULL(&params[4]);
    1218             :                         } else {
    1219        2138 :                                 ZVAL_ARR(&params[4], zend_array_dup(symbol_table));
    1220             :                         }
    1221             : 
    1222        2138 :                         ZVAL_COPY_VALUE(&orig_user_error_handler, &EG(user_error_handler));
    1223        2138 :                         ZVAL_UNDEF(&EG(user_error_handler));
    1224             : 
    1225             :                         /* User error handler may include() additinal PHP files.
    1226             :                          * If an error was generated during comilation PHP will compile
    1227             :                          * such scripts recursivly, but some CG() variables may be
    1228             :                          * inconsistent. */
    1229             : 
    1230        2138 :                         in_compilation = CG(in_compilation);
    1231        2138 :                         if (in_compilation) {
    1232           5 :                                 saved_class_entry = CG(active_class_entry);
    1233           5 :                                 CG(active_class_entry) = NULL;
    1234           5 :                                 SAVE_STACK(loop_var_stack);
    1235           5 :                                 SAVE_STACK(delayed_oplines_stack);
    1236           5 :                                 CG(in_compilation) = 0;
    1237             :                         }
    1238             : 
    1239        2138 :                         if (call_user_function_ex(CG(function_table), NULL, &orig_user_error_handler, &retval, 5, params, 1, NULL) == SUCCESS) {
    1240        2138 :                                 if (Z_TYPE(retval) != IS_UNDEF) {
    1241        2116 :                                         if (Z_TYPE(retval) == IS_FALSE) {
    1242           3 :                                                 zend_error_cb(type, error_filename, error_lineno, format, args);
    1243             :                                         }
    1244        2116 :                                         zval_ptr_dtor(&retval);
    1245             :                                 }
    1246           0 :                         } else if (!EG(exception)) {
    1247             :                                 /* The user error handler failed, use built-in error handler */
    1248           0 :                                 zend_error_cb(type, error_filename, error_lineno, format, args);
    1249             :                         }
    1250             : 
    1251        2138 :                         if (in_compilation) {
    1252           5 :                                 CG(active_class_entry) = saved_class_entry;
    1253           5 :                                 RESTORE_STACK(loop_var_stack);
    1254           5 :                                 RESTORE_STACK(delayed_oplines_stack);
    1255           5 :                                 CG(in_compilation) = 1;
    1256             :                         }
    1257             : 
    1258        2138 :                         zval_ptr_dtor(&params[4]);
    1259        2138 :                         zval_ptr_dtor(&params[3]);
    1260        2138 :                         zval_ptr_dtor(&params[2]);
    1261        2138 :                         zval_ptr_dtor(&params[1]);
    1262        2138 :                         zval_ptr_dtor(&params[0]);
    1263             : 
    1264        2138 :                         if (Z_TYPE(EG(user_error_handler)) == IS_UNDEF) {
    1265        2138 :                                 ZVAL_COPY_VALUE(&EG(user_error_handler), &orig_user_error_handler);
    1266             :                         } else {
    1267           0 :                                 zval_ptr_dtor(&orig_user_error_handler);
    1268             :                         }
    1269             :                         break;
    1270             :         }
    1271             : 
    1272             : #if !defined(HAVE_NORETURN) || defined(HAVE_NORETURN_ALIAS)
    1273      380804 :         va_end(args);
    1274             : #endif
    1275             : 
    1276      380804 :         if (type == E_PARSE) {
    1277             :                 /* eval() errors do not affect exit_status */
    1278           0 :                 if (!(EG(current_execute_data) &&
    1279           0 :                         EG(current_execute_data)->func &&
    1280           0 :                         ZEND_USER_CODE(EG(current_execute_data)->func->type) &&
    1281           0 :                         EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL &&
    1282           0 :                         EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) {
    1283           0 :                         EG(exit_status) = 255;
    1284             :                 }
    1285             :         }
    1286             : }
    1287             : /* }}} */
    1288             : 
    1289             : #ifdef HAVE_NORETURN
    1290             : # ifdef HAVE_NORETURN_ALIAS
    1291             : void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));
    1292             : # else
    1293             : ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
    1294             : {
    1295             :         va_list va;
    1296             : 
    1297             :         va_start(va, format);
    1298             :         zend_error_va_list(type, format, va);
    1299             :         va_end(va);
    1300             : }
    1301             : 
    1302             : ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...)
    1303             : {
    1304             :         va_list va;
    1305             : 
    1306             :         va_start(va, format);
    1307             :         zend_error_va_list(type, format, va);
    1308             :         va_end(va);
    1309             : }
    1310             : /* }}} */
    1311             : # endif
    1312             : #endif
    1313             : 
    1314         382 : ZEND_API void zend_type_error(const char *format, ...) /* {{{ */
    1315             : {
    1316             :         va_list va;
    1317         382 :         char *message = NULL;
    1318             : 
    1319         382 :         va_start(va, format);
    1320         382 :         zend_vspprintf(&message, 0, format, va);
    1321         382 :         zend_throw_exception(zend_get_type_error(), message, E_ERROR);
    1322         382 :         efree(message);
    1323         382 :         va_end(va);
    1324         382 : } /* }}} */
    1325             : 
    1326       10997 : ZEND_API void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) /* {{{ */
    1327             : {
    1328             :         va_list va;
    1329       10997 :         char *message = NULL;
    1330             : 
    1331       10997 :         va_start(va, format);
    1332       10997 :         zend_vspprintf(&message, 0, format, va);
    1333       10997 :         if (throw_exception) {
    1334         111 :                 zend_throw_exception(zend_get_type_error(), message, E_ERROR);
    1335             :         } else {
    1336       10886 :                 zend_error(E_WARNING, message);
    1337             :         }
    1338       10997 :         efree(message);
    1339             : 
    1340       10997 :         va_end(va);
    1341       10997 : } /* }}} */
    1342             : 
    1343           0 : ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */
    1344             : {
    1345             : #if ZEND_DEBUG
    1346             :         va_list args;
    1347             : 
    1348             :         va_start(args, format);
    1349             : #       ifdef ZEND_WIN32
    1350             :         {
    1351             :                 char output_buf[1024];
    1352             : 
    1353             :                 vsnprintf(output_buf, 1024, format, args);
    1354             :                 OutputDebugString(output_buf);
    1355             :                 OutputDebugString("\n");
    1356             :                 if (trigger_break && IsDebuggerPresent()) {
    1357             :                         DebugBreak();
    1358             :                 }
    1359             :         }
    1360             : #       else
    1361             :         vfprintf(stderr, format, args);
    1362             :         fprintf(stderr, "\n");
    1363             : #       endif
    1364             :         va_end(args);
    1365             : #endif
    1366           0 : }
    1367             : /* }}} */
    1368             : 
    1369       20950 : ZEND_API int zend_execute_scripts(int type, zval *retval, int file_count, ...) /* {{{ */
    1370             : {
    1371             :         va_list files;
    1372             :         int i;
    1373             :         zend_file_handle *file_handle;
    1374             :         zend_op_array *op_array;
    1375             : 
    1376       20950 :         va_start(files, file_count);
    1377       79903 :         for (i = 0; i < file_count; i++) {
    1378       60897 :                 file_handle = va_arg(files, zend_file_handle *);
    1379       60897 :                 if (!file_handle) {
    1380       39947 :                         continue;
    1381             :                 }
    1382             : 
    1383       20950 :                 op_array = zend_compile_file(file_handle, type);
    1384       20719 :                 if (file_handle->opened_path) {
    1385       20716 :                         zend_hash_add_empty_element(&EG(included_files), file_handle->opened_path);
    1386             :                 }
    1387       20719 :                 zend_destroy_file_handle(file_handle);
    1388       20719 :                 if (op_array) {
    1389       20688 :                         zend_execute(op_array, retval);
    1390       19460 :                         zend_exception_restore();
    1391       19460 :                         if (EG(exception)) {
    1392         467 :                                 if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
    1393             :                                         zval orig_user_exception_handler;
    1394             :                                         zval params[1], retval2;
    1395             :                                         zend_object *old_exception;
    1396          10 :                                         old_exception = EG(exception);
    1397          10 :                                         EG(exception) = NULL;
    1398          10 :                                         ZVAL_OBJ(&params[0], old_exception);
    1399          10 :                                         ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler));
    1400             : 
    1401          10 :                                         if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL) == SUCCESS) {
    1402           8 :                                                 zval_ptr_dtor(&retval2);
    1403           8 :                                                 if (EG(exception)) {
    1404           0 :                                                         OBJ_RELEASE(EG(exception));
    1405           0 :                                                         EG(exception) = NULL;
    1406             :                                                 }
    1407             :                                                 OBJ_RELEASE(old_exception);
    1408             :                                         } else {
    1409           0 :                                                 EG(exception) = old_exception;
    1410           0 :                                                 zend_exception_error(EG(exception), E_ERROR);
    1411             :                                         }
    1412             :                                 } else {
    1413         457 :                                         zend_exception_error(EG(exception), E_ERROR);
    1414             :                                 }
    1415             :                         }
    1416       19006 :                         destroy_op_array(op_array);
    1417       19006 :                         efree_size(op_array, sizeof(zend_op_array));
    1418          31 :                 } else if (type==ZEND_REQUIRE) {
    1419          31 :                         va_end(files);
    1420          31 :                         return FAILURE;
    1421             :                 }
    1422             :         }
    1423       19006 :         va_end(files);
    1424             : 
    1425       19006 :         return SUCCESS;
    1426             : }
    1427             : /* }}} */
    1428             : 
    1429             : #define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
    1430             : 
    1431        1080 : ZEND_API char *zend_make_compiled_string_description(const char *name) /* {{{ */
    1432             : {
    1433             :         const char *cur_filename;
    1434             :         int cur_lineno;
    1435             :         char *compiled_string_description;
    1436             : 
    1437        1080 :         if (zend_is_compiling()) {
    1438           0 :                 cur_filename = zend_get_compiled_filename()->val;
    1439           0 :                 cur_lineno = zend_get_compiled_lineno();
    1440        1080 :         } else if (zend_is_executing()) {
    1441        1080 :                 cur_filename = zend_get_executed_filename();
    1442        1080 :                 cur_lineno = zend_get_executed_lineno();
    1443             :         } else {
    1444           0 :                 cur_filename = "Unknown";
    1445           0 :                 cur_lineno = 0;
    1446             :         }
    1447             : 
    1448        1080 :         zend_spprintf(&compiled_string_description, 0, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name);
    1449        1080 :         return compiled_string_description;
    1450             : }
    1451             : /* }}} */
    1452             : 
    1453       20883 : void free_estring(char **str_p) /* {{{ */
    1454             : {
    1455       20883 :         efree(*str_p);
    1456       20883 : }
    1457             : /* }}} */
    1458             : 
    1459       29353 : void free_string_zval(zval *zv) /* {{{ */
    1460             : {
    1461       29353 :         zend_string *str = Z_PTR_P(zv);
    1462             :         zend_string_release(str);
    1463       29353 : }
    1464             : /* }}} */
    1465             : 
    1466             : /*
    1467             :  * Local variables:
    1468             :  * tab-width: 4
    1469             :  * c-basic-offset: 4
    1470             :  * indent-tabs-mode: t
    1471             :  * End:
    1472             :  */

Generated by: LCOV version 1.10

Generated at Mon, 27 Jul 2015 02:32:15 +0000 (46 hours ago)

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