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: 0 563 0.0 %
Date: 2014-04-16 Functions: 0 36 0.0 %
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             : #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 int (*zend_printf)(const char *format, ...);
      50             : ZEND_API zend_write_func_t zend_write;
      51             : ZEND_API FILE *(*zend_fopen)(const char *filename, char **opened_path TSRMLS_DC);
      52             : ZEND_API int (*zend_stream_open_function)(const char *filename, zend_file_handle *handle TSRMLS_DC);
      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 TSRMLS_DC);
      56             : ZEND_API void (*zend_error_cb)(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args);
      57             : int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
      58             : ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
      59             : ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
      60             : 
      61             : void (*zend_on_timeout)(int seconds TSRMLS_DC);
      62             : 
      63             : static void (*zend_message_dispatcher_p)(long message, const void *data TSRMLS_DC);
      64             : static int (*zend_get_configuration_directive_p)(const char *name, uint name_length, zval *contents);
      65             : 
      66           0 : static ZEND_INI_MH(OnUpdateErrorReporting) /* {{{ */
      67             : {
      68           0 :         if (!new_value) {
      69           0 :                 EG(error_reporting) = E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED;
      70             :         } else {
      71           0 :                 EG(error_reporting) = atoi(new_value);
      72             :         }
      73           0 :         return SUCCESS;
      74             : }
      75             : /* }}} */
      76             : 
      77           0 : static ZEND_INI_MH(OnUpdateGCEnabled) /* {{{ */
      78             : {
      79           0 :         OnUpdateBool(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
      80             : 
      81           0 :         if (GC_G(gc_enabled)) {
      82           0 :                 gc_init(TSRMLS_C);
      83             :         }
      84             : 
      85           0 :         return SUCCESS;
      86             : }
      87             : /* }}} */
      88             : 
      89           0 : static ZEND_INI_MH(OnUpdateScriptEncoding) /* {{{ */
      90             : {
      91           0 :         if (!CG(multibyte)) {
      92           0 :                 return FAILURE;
      93             :         }
      94           0 :         if (!zend_multibyte_get_functions(TSRMLS_C)) {
      95           0 :                 return SUCCESS;
      96             :         }
      97           0 :         return zend_multibyte_set_script_encoding_by_string(new_value, new_value_length TSRMLS_CC);
      98             : }
      99             : /* }}} */
     100             : 
     101             : 
     102             : ZEND_INI_BEGIN()
     103             :         ZEND_INI_ENTRY("error_reporting",                             NULL,           ZEND_INI_ALL,           OnUpdateErrorReporting)
     104             :         STD_ZEND_INI_BOOLEAN("zend.enable_gc",                                "1",  ZEND_INI_ALL,           OnUpdateGCEnabled,      gc_enabled,     zend_gc_globals,        gc_globals)
     105             :         STD_ZEND_INI_BOOLEAN("zend.multibyte", "0", ZEND_INI_PERDIR, OnUpdateBool, multibyte,      zend_compiler_globals, compiler_globals)
     106             :         ZEND_INI_ENTRY("zend.script_encoding",                        NULL,           ZEND_INI_ALL,           OnUpdateScriptEncoding)
     107             :         STD_ZEND_INI_BOOLEAN("zend.detect_unicode",                   "1",  ZEND_INI_ALL,           OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
     108             : #ifdef ZEND_SIGNALS
     109             :         STD_ZEND_INI_BOOLEAN("zend.signal_check", "0", ZEND_INI_SYSTEM, OnUpdateBool, check, zend_signal_globals_t, zend_signal_globals)
     110             : #endif
     111             : ZEND_INI_END()
     112             : 
     113             : 
     114             : #ifdef ZTS
     115             : ZEND_API int compiler_globals_id;
     116             : ZEND_API int executor_globals_id;
     117             : static HashTable *global_function_table = NULL;
     118             : static HashTable *global_class_table = NULL;
     119             : static HashTable *global_constants_table = NULL;
     120             : static HashTable *global_auto_globals_table = NULL;
     121             : static HashTable *global_persistent_list = NULL;
     122             : #endif
     123             : 
     124             : ZEND_API zend_utility_values zend_uv;
     125             : 
     126             : ZEND_API zval zval_used_for_init; /* True global variable */
     127             : 
     128             : /* version information */
     129             : static char *zend_version_info;
     130             : static uint zend_version_info_length;
     131             : #define ZEND_CORE_VERSION_INFO  "Zend Engine v" ZEND_VERSION ", Copyright (c) 1998-2014 Zend Technologies\n"
     132             : #define PRINT_ZVAL_INDENT 4
     133             : 
     134           0 : static void print_hash(zend_write_func_t write_func, HashTable *ht, int indent, zend_bool is_object TSRMLS_DC) /* {{{ */
     135             : {
     136             :         zval **tmp;
     137             :         char *string_key;
     138             :         HashPosition iterator;
     139             :         ulong num_key;
     140             :         uint str_len;
     141             :         int i;
     142             : 
     143           0 :         for (i = 0; i < indent; i++) {
     144           0 :                 ZEND_PUTS_EX(" ");
     145             :         }
     146           0 :         ZEND_PUTS_EX("(\n");
     147           0 :         indent += PRINT_ZVAL_INDENT;
     148           0 :         zend_hash_internal_pointer_reset_ex(ht, &iterator);
     149           0 :         while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
     150           0 :                 for (i = 0; i < indent; i++) {
     151           0 :                         ZEND_PUTS_EX(" ");
     152             :                 }
     153           0 :                 ZEND_PUTS_EX("[");
     154           0 :                 switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
     155             :                         case HASH_KEY_IS_STRING:
     156           0 :                                 if (is_object) {
     157             :                                         const char *prop_name, *class_name;
     158             :                                         int prop_len;
     159           0 :                                         int mangled = zend_unmangle_property_name_ex(string_key, str_len - 1, &class_name, &prop_name, &prop_len);
     160             : 
     161           0 :                                         ZEND_WRITE_EX(prop_name, prop_len);
     162           0 :                                         if (class_name && mangled == SUCCESS) {
     163           0 :                                                 if (class_name[0]=='*') {
     164           0 :                                                         ZEND_PUTS_EX(":protected");
     165             :                                                 } else {
     166           0 :                                                         ZEND_PUTS_EX(":");
     167           0 :                                                         ZEND_PUTS_EX(class_name);
     168           0 :                                                         ZEND_PUTS_EX(":private");
     169             :                                                 }
     170             :                                         }
     171             :                                 } else {
     172           0 :                                         ZEND_WRITE_EX(string_key, str_len-1);
     173             :                                 }
     174           0 :                                 break;
     175             :                         case HASH_KEY_IS_LONG:
     176             :                                 {
     177             :                                         char key[25];
     178           0 :                                         snprintf(key, sizeof(key), "%ld", num_key);
     179           0 :                                         ZEND_PUTS_EX(key);
     180             :                                 }
     181             :                                 break;
     182             :                 }
     183           0 :                 ZEND_PUTS_EX("] => ");
     184           0 :                 zend_print_zval_r_ex(write_func, *tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
     185           0 :                 ZEND_PUTS_EX("\n");
     186           0 :                 zend_hash_move_forward_ex(ht, &iterator);
     187             :         }
     188           0 :         indent -= PRINT_ZVAL_INDENT;
     189           0 :         for (i = 0; i < indent; i++) {
     190           0 :                 ZEND_PUTS_EX(" ");
     191             :         }
     192           0 :         ZEND_PUTS_EX(")\n");
     193           0 : }
     194             : /* }}} */
     195             : 
     196           0 : static void print_flat_hash(HashTable *ht TSRMLS_DC) /* {{{ */
     197             : {
     198             :         zval **tmp;
     199             :         char *string_key;
     200             :         HashPosition iterator;
     201             :         ulong num_key;
     202             :         uint str_len;
     203           0 :         int i = 0;
     204             : 
     205           0 :         zend_hash_internal_pointer_reset_ex(ht, &iterator);
     206           0 :         while (zend_hash_get_current_data_ex(ht, (void **) &tmp, &iterator) == SUCCESS) {
     207           0 :                 if (i++ > 0) {
     208           0 :                         ZEND_PUTS(",");
     209             :                 }
     210           0 :                 ZEND_PUTS("[");
     211           0 :                 switch (zend_hash_get_current_key_ex(ht, &string_key, &str_len, &num_key, 0, &iterator)) {
     212             :                         case HASH_KEY_IS_STRING:
     213           0 :                                 ZEND_PUTS(string_key);
     214           0 :                                 break;
     215             :                         case HASH_KEY_IS_LONG:
     216           0 :                                 zend_printf("%ld", num_key);
     217             :                                 break;
     218             :                 }
     219           0 :                 ZEND_PUTS("] => ");
     220           0 :                 zend_print_flat_zval_r(*tmp TSRMLS_CC);
     221           0 :                 zend_hash_move_forward_ex(ht, &iterator);
     222             :         }
     223           0 : }
     224             : /* }}} */
     225             : 
     226           0 : ZEND_API void zend_make_printable_zval(zval *expr, zval *expr_copy, int *use_copy) /* {{{ */
     227             : {
     228           0 :         if (Z_TYPE_P(expr)==IS_STRING) {
     229           0 :                 *use_copy = 0;
     230           0 :                 return;
     231             :         }
     232           0 :         switch (Z_TYPE_P(expr)) {
     233             :                 case IS_NULL:
     234           0 :                         Z_STRLEN_P(expr_copy) = 0;
     235           0 :                         Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
     236           0 :                         break;
     237             :                 case IS_BOOL:
     238           0 :                         if (Z_LVAL_P(expr)) {
     239           0 :                                 Z_STRLEN_P(expr_copy) = 1;
     240           0 :                                 Z_STRVAL_P(expr_copy) = estrndup("1", 1);
     241             :                         } else {
     242           0 :                                 Z_STRLEN_P(expr_copy) = 0;
     243           0 :                                 Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
     244             :                         }
     245           0 :                         break;
     246             :                 case IS_RESOURCE:
     247           0 :                         Z_STRVAL_P(expr_copy) = (char *) emalloc(sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG);
     248           0 :                         Z_STRLEN_P(expr_copy) = snprintf(Z_STRVAL_P(expr_copy), sizeof("Resource id #") - 1 + MAX_LENGTH_OF_LONG, "Resource id #%ld", Z_LVAL_P(expr));
     249           0 :                         break;
     250             :                 case IS_ARRAY:
     251           0 :                         zend_error(E_NOTICE, "Array to string conversion");
     252           0 :                         Z_STRLEN_P(expr_copy) = sizeof("Array") - 1;
     253           0 :                         Z_STRVAL_P(expr_copy) = estrndup("Array", Z_STRLEN_P(expr_copy));
     254           0 :                         break;
     255             :                 case IS_OBJECT:
     256             :                         {
     257             :                                 TSRMLS_FETCH();
     258             : 
     259           0 :                                 if (zend_std_cast_object_tostring(expr, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
     260           0 :                                         break;
     261             :                                 }
     262           0 :                                 if (Z_OBJ_HANDLER_P(expr, cast_object)) {
     263             :                                         zval *val;
     264             : 
     265           0 :                                         ALLOC_ZVAL(val);
     266           0 :                                         INIT_PZVAL_COPY(val, expr);
     267           0 :                                         zval_copy_ctor(val);
     268           0 :                                         if (Z_OBJ_HANDLER_P(expr, cast_object)(val, expr_copy, IS_STRING TSRMLS_CC) == SUCCESS) {
     269           0 :                                                 zval_ptr_dtor(&val);
     270           0 :                                                 break;
     271             :                                         }
     272           0 :                                         zval_ptr_dtor(&val);
     273             :                                 }
     274           0 :                                 if (!Z_OBJ_HANDLER_P(expr, cast_object) && Z_OBJ_HANDLER_P(expr, get)) {
     275           0 :                                         zval *z = Z_OBJ_HANDLER_P(expr, get)(expr TSRMLS_CC);
     276             : 
     277           0 :                                         Z_ADDREF_P(z);
     278           0 :                                         if (Z_TYPE_P(z) != IS_OBJECT) {
     279           0 :                                                 zend_make_printable_zval(z, expr_copy, use_copy);
     280           0 :                                                 if (*use_copy) {
     281           0 :                                                         zval_ptr_dtor(&z);
     282             :                                                 } else {
     283           0 :                                                         ZVAL_ZVAL(expr_copy, z, 0, 1);
     284           0 :                                                         *use_copy = 1;
     285             :                                                 }
     286           0 :                                                 return;
     287             :                                         }
     288           0 :                                         zval_ptr_dtor(&z);
     289             :                                 }
     290           0 :                                 zend_error(EG(exception) ? E_ERROR : E_RECOVERABLE_ERROR, "Object of class %s could not be converted to string", Z_OBJCE_P(expr)->name);
     291           0 :                                 Z_STRLEN_P(expr_copy) = 0;
     292           0 :                                 Z_STRVAL_P(expr_copy) = STR_EMPTY_ALLOC();
     293             :                         }
     294           0 :                         break;
     295             :                 case IS_DOUBLE:
     296           0 :                         *expr_copy = *expr;
     297             :                         zval_copy_ctor(expr_copy);
     298           0 :                         zend_locale_sprintf_double(expr_copy ZEND_FILE_LINE_CC);
     299           0 :                         break;
     300             :                 default:
     301           0 :                         *expr_copy = *expr;
     302             :                         zval_copy_ctor(expr_copy);
     303           0 :                         convert_to_string(expr_copy);
     304             :                         break;
     305             :         }
     306           0 :         Z_TYPE_P(expr_copy) = IS_STRING;
     307           0 :         *use_copy = 1;
     308             : }
     309             : /* }}} */
     310             : 
     311           0 : ZEND_API int zend_print_zval(zval *expr, int indent) /* {{{ */
     312             : {
     313           0 :         return zend_print_zval_ex(zend_write, expr, indent);
     314             : }
     315             : /* }}} */
     316             : 
     317           0 : ZEND_API int zend_print_zval_ex(zend_write_func_t write_func, zval *expr, int indent) /* {{{ */
     318             : {
     319             :         zval expr_copy;
     320             :         int use_copy;
     321             : 
     322           0 :         zend_make_printable_zval(expr, &expr_copy, &use_copy);
     323           0 :         if (use_copy) {
     324           0 :                 expr = &expr_copy;
     325             :         }
     326           0 :         if (Z_STRLEN_P(expr) == 0) { /* optimize away empty strings */
     327           0 :                 if (use_copy) {
     328             :                         zval_dtor(expr);
     329             :                 }
     330           0 :                 return 0;
     331             :         }
     332           0 :         write_func(Z_STRVAL_P(expr), Z_STRLEN_P(expr));
     333           0 :         if (use_copy) {
     334             :                 zval_dtor(expr);
     335             :         }
     336           0 :         return Z_STRLEN_P(expr);
     337             : }
     338             : /* }}} */
     339             : 
     340           0 : ZEND_API void zend_print_flat_zval_r(zval *expr TSRMLS_DC) /* {{{ */
     341             : {
     342           0 :         switch (Z_TYPE_P(expr)) {
     343             :                 case IS_ARRAY:
     344           0 :                         ZEND_PUTS("Array (");
     345           0 :                         if (++Z_ARRVAL_P(expr)->nApplyCount>1) {
     346           0 :                                 ZEND_PUTS(" *RECURSION*");
     347           0 :                                 Z_ARRVAL_P(expr)->nApplyCount--;
     348           0 :                                 return;
     349             :                         }
     350           0 :                         print_flat_hash(Z_ARRVAL_P(expr) TSRMLS_CC);
     351           0 :                         ZEND_PUTS(")");
     352           0 :                         Z_ARRVAL_P(expr)->nApplyCount--;
     353           0 :                         break;
     354             :                 case IS_OBJECT:
     355             :                 {
     356           0 :                         HashTable *properties = NULL;
     357           0 :                         const char *class_name = NULL;
     358             :                         zend_uint clen;
     359             : 
     360           0 :                         if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
     361           0 :                                 Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
     362             :                         }
     363           0 :                         if (class_name) {
     364           0 :                                 zend_printf("%s Object (", class_name);
     365             :                         } else {
     366           0 :                                 zend_printf("%s Object (", "Unknown Class");
     367             :                         }
     368           0 :                         if (class_name) {
     369           0 :                                 efree((char*)class_name);
     370             :                         }
     371           0 :                         if (Z_OBJ_HANDLER_P(expr, get_properties)) {
     372           0 :                                 properties = Z_OBJPROP_P(expr);
     373             :                         }
     374           0 :                         if (properties) {
     375           0 :                                 if (++properties->nApplyCount>1) {
     376           0 :                                         ZEND_PUTS(" *RECURSION*");
     377           0 :                                         properties->nApplyCount--;
     378           0 :                                         return;
     379             :                                 }
     380           0 :                                 print_flat_hash(properties TSRMLS_CC);
     381           0 :                                 properties->nApplyCount--;
     382             :                         }
     383           0 :                         ZEND_PUTS(")");
     384           0 :                         break;
     385             :                 }
     386             :                 default:
     387           0 :                         zend_print_variable(expr);
     388             :                         break;
     389             :         }
     390             : }
     391             : /* }}} */
     392             : 
     393           0 : ZEND_API void zend_print_zval_r(zval *expr, int indent TSRMLS_DC) /* {{{ */
     394             : {
     395           0 :         zend_print_zval_r_ex(zend_write, expr, indent TSRMLS_CC);
     396           0 : }
     397             : /* }}} */
     398             : 
     399           0 : ZEND_API void zend_print_zval_r_ex(zend_write_func_t write_func, zval *expr, int indent TSRMLS_DC) /* {{{ */
     400             : {
     401           0 :         switch (Z_TYPE_P(expr)) {
     402             :                 case IS_ARRAY:
     403           0 :                         ZEND_PUTS_EX("Array\n");
     404           0 :                         if (++Z_ARRVAL_P(expr)->nApplyCount>1) {
     405           0 :                                 ZEND_PUTS_EX(" *RECURSION*");
     406           0 :                                 Z_ARRVAL_P(expr)->nApplyCount--;
     407           0 :                                 return;
     408             :                         }
     409           0 :                         print_hash(write_func, Z_ARRVAL_P(expr), indent, 0 TSRMLS_CC);
     410           0 :                         Z_ARRVAL_P(expr)->nApplyCount--;
     411           0 :                         break;
     412             :                 case IS_OBJECT:
     413             :                         {
     414             :                                 HashTable *properties;
     415           0 :                                 const char *class_name = NULL;
     416             :                                 zend_uint clen;
     417             :                                 int is_temp;
     418             : 
     419           0 :                                 if (Z_OBJ_HANDLER_P(expr, get_class_name)) {
     420           0 :                                         Z_OBJ_HANDLER_P(expr, get_class_name)(expr, &class_name, &clen, 0 TSRMLS_CC);
     421             :                                 }
     422           0 :                                 if (class_name) {
     423           0 :                                         ZEND_PUTS_EX(class_name);
     424             :                                 } else {
     425           0 :                                         ZEND_PUTS_EX("Unknown Class");
     426             :                                 }
     427           0 :                                 ZEND_PUTS_EX(" Object\n");
     428           0 :                                 if (class_name) {
     429           0 :                                         efree((char*)class_name);
     430             :                                 }
     431           0 :                                 if ((properties = Z_OBJDEBUG_P(expr, is_temp)) == NULL) {
     432           0 :                                         break;
     433             :                                 }
     434           0 :                                 if (++properties->nApplyCount>1) {
     435           0 :                                         ZEND_PUTS_EX(" *RECURSION*");
     436           0 :                                         properties->nApplyCount--;
     437           0 :                                         return;
     438             :                                 }
     439           0 :                                 print_hash(write_func, properties, indent, 1 TSRMLS_CC);
     440           0 :                                 properties->nApplyCount--;
     441           0 :                                 if (is_temp) {
     442           0 :                                         zend_hash_destroy(properties);
     443           0 :                                         efree(properties);
     444             :                                 }
     445           0 :                                 break;
     446             :                         }
     447             :                 default:
     448           0 :                         zend_print_zval_ex(write_func, expr, indent);
     449             :                         break;
     450             :         }
     451             : }
     452             : /* }}} */
     453             : 
     454           0 : static FILE *zend_fopen_wrapper(const char *filename, char **opened_path TSRMLS_DC) /* {{{ */
     455             : {
     456           0 :         if (opened_path) {
     457           0 :                 *opened_path = estrdup(filename);
     458             :         }
     459           0 :         return fopen(filename, "rb");
     460             : }
     461             : /* }}} */
     462             : 
     463             : #ifdef ZTS
     464             : static zend_bool asp_tags_default                 = 0;
     465             : static zend_bool short_tags_default               = 1;
     466             : static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT;
     467             : #else
     468             : # define asp_tags_default                       0
     469             : # define short_tags_default                     1
     470             : # define compiler_options_default       ZEND_COMPILE_DEFAULT
     471             : #endif
     472             : 
     473           0 : static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */
     474             : {
     475             :         /* default compile-time values */
     476           0 :         CG(asp_tags) = asp_tags_default;
     477           0 :         CG(short_tags) = short_tags_default;
     478           0 :         CG(compiler_options) = compiler_options_default;
     479           0 : }
     480             : /* }}} */
     481             : 
     482           0 : static void zend_init_exception_op(TSRMLS_D) /* {{{ */
     483             : {
     484           0 :         memset(EG(exception_op), 0, sizeof(EG(exception_op)));
     485           0 :         EG(exception_op)[0].opcode = ZEND_HANDLE_EXCEPTION;
     486           0 :         EG(exception_op)[0].op1_type = IS_UNUSED;
     487           0 :         EG(exception_op)[0].op2_type = IS_UNUSED;
     488           0 :         EG(exception_op)[0].result_type = IS_UNUSED;
     489           0 :         ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op));
     490           0 :         EG(exception_op)[1].opcode = ZEND_HANDLE_EXCEPTION;
     491           0 :         EG(exception_op)[1].op1_type = IS_UNUSED;
     492           0 :         EG(exception_op)[1].op2_type = IS_UNUSED;
     493           0 :         EG(exception_op)[1].result_type = IS_UNUSED;
     494           0 :         ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+1);
     495           0 :         EG(exception_op)[2].opcode = ZEND_HANDLE_EXCEPTION;
     496           0 :         EG(exception_op)[2].op1_type = IS_UNUSED;
     497           0 :         EG(exception_op)[2].op2_type = IS_UNUSED;
     498           0 :         EG(exception_op)[2].result_type = IS_UNUSED;
     499           0 :         ZEND_VM_SET_OPCODE_HANDLER(EG(exception_op)+2);
     500           0 : }
     501             : /* }}} */
     502             : 
     503             : #ifdef ZTS
     504             : static void compiler_globals_ctor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */
     505             : {
     506             :         zend_function tmp_func;
     507             :         zend_class_entry *tmp_class;
     508             : 
     509             :         compiler_globals->compiled_filename = NULL;
     510             : 
     511             :         compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
     512             :         zend_hash_init_ex(compiler_globals->function_table, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
     513             :         zend_hash_copy(compiler_globals->function_table, global_function_table, NULL, &tmp_func, sizeof(zend_function));
     514             : 
     515             :         compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
     516             :         zend_hash_init_ex(compiler_globals->class_table, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
     517             :         zend_hash_copy(compiler_globals->class_table, global_class_table, (copy_ctor_func_t) zend_class_add_ref, &tmp_class, sizeof(zend_class_entry *));
     518             : 
     519             :         zend_set_default_compile_time_values(TSRMLS_C);
     520             : 
     521             :         CG(interactive) = 0;
     522             : 
     523             :         compiler_globals->auto_globals = (HashTable *) malloc(sizeof(HashTable));
     524             :         zend_hash_init_ex(compiler_globals->auto_globals, 8, NULL, NULL, 1, 0);
     525             :         zend_hash_copy(compiler_globals->auto_globals, global_auto_globals_table, NULL, NULL, sizeof(zend_auto_global) /* empty element */);
     526             : 
     527             :         compiler_globals->last_static_member = zend_hash_num_elements(compiler_globals->class_table);
     528             :         if (compiler_globals->last_static_member) {
     529             :                 compiler_globals->static_members_table = calloc(compiler_globals->last_static_member, sizeof(zval**));
     530             :         } else {
     531             :                 compiler_globals->static_members_table = NULL;
     532             :         }
     533             :         compiler_globals->script_encoding_list = NULL;
     534             : }
     535             : /* }}} */
     536             : 
     537             : static void compiler_globals_dtor(zend_compiler_globals *compiler_globals TSRMLS_DC) /* {{{ */
     538             : {
     539             :         if (compiler_globals->function_table != GLOBAL_FUNCTION_TABLE) {
     540             :                 zend_hash_destroy(compiler_globals->function_table);
     541             :                 free(compiler_globals->function_table);
     542             :         }
     543             :         if (compiler_globals->class_table != GLOBAL_CLASS_TABLE) {
     544             :                 zend_hash_destroy(compiler_globals->class_table);
     545             :                 free(compiler_globals->class_table);
     546             :         }
     547             :         if (compiler_globals->auto_globals != GLOBAL_AUTO_GLOBALS_TABLE) {
     548             :                 zend_hash_destroy(compiler_globals->auto_globals);
     549             :                 free(compiler_globals->auto_globals);
     550             :         }
     551             :         if (compiler_globals->static_members_table) {
     552             :                 free(compiler_globals->static_members_table);
     553             :         }
     554             :         if (compiler_globals->script_encoding_list) {
     555             :                 pefree(compiler_globals->script_encoding_list, 1);
     556             :         }
     557             :         compiler_globals->last_static_member = 0;
     558             : }
     559             : /* }}} */
     560             : 
     561             : static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS_DC) /* {{{ */
     562             : {
     563             :         zend_startup_constants(TSRMLS_C);
     564             :         zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
     565             :         zend_init_rsrc_plist(TSRMLS_C);
     566             :         zend_init_exception_op(TSRMLS_C);
     567             :         EG(lambda_count) = 0;
     568             :         EG(user_error_handler) = NULL;
     569             :         EG(user_exception_handler) = NULL;
     570             :         EG(in_execution) = 0;
     571             :         EG(in_autoload) = NULL;
     572             :         EG(current_execute_data) = NULL;
     573             :         EG(current_module) = NULL;
     574             :         EG(exit_status) = 0;
     575             : #if XPFPA_HAVE_CW
     576             :         EG(saved_fpu_cw) = 0;
     577             : #endif
     578             :         EG(saved_fpu_cw_ptr) = NULL;
     579             :         EG(active) = 0;
     580             : }
     581             : /* }}} */
     582             : 
     583             : static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC) /* {{{ */
     584             : {
     585             :         zend_ini_shutdown(TSRMLS_C);
     586             :         if (&executor_globals->persistent_list != global_persistent_list) {
     587             :                 zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC);
     588             :         }
     589             :         if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
     590             :                 zend_hash_destroy(executor_globals->zend_constants);
     591             :                 free(executor_globals->zend_constants);
     592             :         }
     593             : }
     594             : /* }}} */
     595             : 
     596             : static void zend_new_thread_end_handler(THREAD_T thread_id TSRMLS_DC) /* {{{ */
     597             : {
     598             :         if (zend_copy_ini_directives(TSRMLS_C) == SUCCESS) {
     599             :                 zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC);
     600             :         }
     601             : }
     602             : /* }}} */
     603             : #endif
     604             : 
     605             : #if defined(__FreeBSD__) || defined(__DragonFly__)
     606             : /* FreeBSD and DragonFly floating point precision fix */
     607             : #include <floatingpoint.h>
     608             : #endif
     609             : 
     610           0 : static void ini_scanner_globals_ctor(zend_ini_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
     611             : {
     612           0 :         memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
     613           0 : }
     614             : /* }}} */
     615             : 
     616           0 : static void php_scanner_globals_ctor(zend_php_scanner_globals *scanner_globals_p TSRMLS_DC) /* {{{ */
     617             : {
     618           0 :         memset(scanner_globals_p, 0, sizeof(*scanner_globals_p));
     619           0 : }
     620             : /* }}} */
     621             : 
     622             : void zend_init_opcodes_handlers(void);
     623             : 
     624           0 : static zend_bool php_auto_globals_create_globals(const char *name, uint name_len TSRMLS_DC) /* {{{ */
     625             : {
     626             :         zval *globals;
     627             : 
     628           0 :         ALLOC_ZVAL(globals);
     629           0 :         Z_SET_REFCOUNT_P(globals, 1);
     630           0 :         Z_SET_ISREF_P(globals);
     631           0 :         Z_TYPE_P(globals) = IS_ARRAY;
     632           0 :         Z_ARRVAL_P(globals) = &EG(symbol_table);
     633           0 :         zend_hash_update(&EG(symbol_table), name, name_len + 1, &globals, sizeof(zval *), NULL);
     634           0 :         return 0;
     635             : }
     636             : /* }}} */
     637             : 
     638           0 : int zend_startup(zend_utility_functions *utility_functions, char **extensions TSRMLS_DC) /* {{{ */
     639             : {
     640             : #ifdef ZTS
     641             :         zend_compiler_globals *compiler_globals;
     642             :         zend_executor_globals *executor_globals;
     643             :         extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
     644             :         extern ZEND_API ts_rsrc_id language_scanner_globals_id;
     645             : #else
     646             :         extern zend_ini_scanner_globals ini_scanner_globals;
     647             :         extern zend_php_scanner_globals language_scanner_globals;
     648             : #endif
     649             : 
     650           0 :         start_memory_manager(TSRMLS_C);
     651             : 
     652           0 :         virtual_cwd_startup(); /* Could use shutdown to free the main cwd but it would just slow it down for CGI */
     653             : 
     654             : #if defined(__FreeBSD__) || defined(__DragonFly__)
     655             :         /* FreeBSD and DragonFly floating point precision fix */
     656             :         fpsetmask(0);
     657             : #endif
     658             : 
     659           0 :         zend_startup_strtod();
     660           0 :         zend_startup_extensions_mechanism();
     661             : 
     662             :         /* Set up utility functions and values */
     663           0 :         zend_error_cb = utility_functions->error_function;
     664           0 :         zend_printf = utility_functions->printf_function;
     665           0 :         zend_write = (zend_write_func_t) utility_functions->write_function;
     666           0 :         zend_fopen = utility_functions->fopen_function;
     667           0 :         if (!zend_fopen) {
     668           0 :                 zend_fopen = zend_fopen_wrapper;
     669             :         }
     670           0 :         zend_stream_open_function = utility_functions->stream_open_function;
     671           0 :         zend_message_dispatcher_p = utility_functions->message_handler;
     672             : #ifndef ZEND_SIGNALS
     673           0 :         zend_block_interruptions = utility_functions->block_interruptions;
     674           0 :         zend_unblock_interruptions = utility_functions->unblock_interruptions;
     675             : #endif
     676           0 :         zend_get_configuration_directive_p = utility_functions->get_configuration_directive;
     677           0 :         zend_ticks_function = utility_functions->ticks_function;
     678           0 :         zend_on_timeout = utility_functions->on_timeout;
     679           0 :         zend_vspprintf = utility_functions->vspprintf_function;
     680           0 :         zend_getenv = utility_functions->getenv_function;
     681           0 :         zend_resolve_path = utility_functions->resolve_path_function;
     682             : 
     683             : #if HAVE_DTRACE
     684             : /* build with dtrace support */
     685             :         zend_compile_file = dtrace_compile_file;
     686             :         zend_execute_ex = dtrace_execute_ex;
     687             :         zend_execute_internal = dtrace_execute_internal;
     688             : #else
     689           0 :         zend_compile_file = compile_file;
     690           0 :         zend_execute_ex = execute_ex;
     691           0 :         zend_execute_internal = NULL;
     692             : #endif /* HAVE_SYS_SDT_H */
     693           0 :         zend_compile_string = compile_string;
     694           0 :         zend_throw_exception_hook = NULL;
     695             : 
     696           0 :         zend_init_opcodes_handlers();
     697             : 
     698             :         /* set up version */
     699           0 :         zend_version_info = strdup(ZEND_CORE_VERSION_INFO);
     700           0 :         zend_version_info_length = sizeof(ZEND_CORE_VERSION_INFO) - 1;
     701             : 
     702           0 :         GLOBAL_FUNCTION_TABLE = (HashTable *) malloc(sizeof(HashTable));
     703           0 :         GLOBAL_CLASS_TABLE = (HashTable *) malloc(sizeof(HashTable));
     704           0 :         GLOBAL_AUTO_GLOBALS_TABLE = (HashTable *) malloc(sizeof(HashTable));
     705           0 :         GLOBAL_CONSTANTS_TABLE = (HashTable *) malloc(sizeof(HashTable));
     706             : 
     707           0 :         zend_hash_init_ex(GLOBAL_FUNCTION_TABLE, 100, NULL, ZEND_FUNCTION_DTOR, 1, 0);
     708           0 :         zend_hash_init_ex(GLOBAL_CLASS_TABLE, 10, NULL, ZEND_CLASS_DTOR, 1, 0);
     709           0 :         zend_hash_init_ex(GLOBAL_AUTO_GLOBALS_TABLE, 8, NULL, NULL, 1, 0);
     710           0 :         zend_hash_init_ex(GLOBAL_CONSTANTS_TABLE, 20, NULL, ZEND_CONSTANT_DTOR, 1, 0);
     711             : 
     712           0 :         zend_hash_init_ex(&module_registry, 50, NULL, ZEND_MODULE_DTOR, 1, 0);
     713           0 :         zend_init_rsrc_list_dtors();
     714             : 
     715             :         /* This zval can be used to initialize allocate zval's to an uninit'ed value */
     716             :         Z_UNSET_ISREF(zval_used_for_init);
     717             :         Z_SET_REFCOUNT(zval_used_for_init, 1);
     718           0 :         Z_TYPE(zval_used_for_init) = IS_NULL;
     719             : 
     720             : #ifdef ZTS
     721             :         ts_allocate_id(&compiler_globals_id, sizeof(zend_compiler_globals), (ts_allocate_ctor) compiler_globals_ctor, (ts_allocate_dtor) compiler_globals_dtor);
     722             :         ts_allocate_id(&executor_globals_id, sizeof(zend_executor_globals), (ts_allocate_ctor) executor_globals_ctor, (ts_allocate_dtor) executor_globals_dtor);
     723             :         ts_allocate_id(&language_scanner_globals_id, sizeof(zend_php_scanner_globals), (ts_allocate_ctor) php_scanner_globals_ctor, NULL);
     724             :         ts_allocate_id(&ini_scanner_globals_id, sizeof(zend_ini_scanner_globals), (ts_allocate_ctor) ini_scanner_globals_ctor, NULL);
     725             :         compiler_globals = ts_resource(compiler_globals_id);
     726             :         executor_globals = ts_resource(executor_globals_id);
     727             : 
     728             :         compiler_globals_dtor(compiler_globals TSRMLS_CC);
     729             :         compiler_globals->in_compilation = 0;
     730             :         compiler_globals->function_table = (HashTable *) malloc(sizeof(HashTable));
     731             :         compiler_globals->class_table = (HashTable *) malloc(sizeof(HashTable));
     732             : 
     733             :         *compiler_globals->function_table = *GLOBAL_FUNCTION_TABLE;
     734             :         *compiler_globals->class_table = *GLOBAL_CLASS_TABLE;
     735             :         compiler_globals->auto_globals = GLOBAL_AUTO_GLOBALS_TABLE;
     736             : 
     737             :         zend_hash_destroy(executor_globals->zend_constants);
     738             :         *executor_globals->zend_constants = *GLOBAL_CONSTANTS_TABLE;
     739             : #else
     740           0 :         ini_scanner_globals_ctor(&ini_scanner_globals TSRMLS_CC);
     741           0 :         php_scanner_globals_ctor(&language_scanner_globals TSRMLS_CC);
     742           0 :         zend_set_default_compile_time_values(TSRMLS_C);
     743           0 :         EG(user_error_handler) = NULL;
     744           0 :         EG(user_exception_handler) = NULL;
     745             : #endif
     746             : 
     747           0 :         zend_interned_strings_init(TSRMLS_C);
     748           0 :         zend_startup_builtin_functions(TSRMLS_C);
     749           0 :         zend_register_standard_constants(TSRMLS_C);
     750           0 :         zend_register_auto_global("GLOBALS", sizeof("GLOBALS") - 1, 1, php_auto_globals_create_globals TSRMLS_CC);
     751             : 
     752             : #ifndef ZTS
     753           0 :         zend_init_rsrc_plist(TSRMLS_C);
     754           0 :         zend_init_exception_op(TSRMLS_C);
     755             : #endif
     756             : 
     757           0 :         zend_ini_startup(TSRMLS_C);
     758             : 
     759             : #ifdef ZTS
     760             :         tsrm_set_new_thread_end_handler(zend_new_thread_end_handler);
     761             : #endif
     762             : 
     763           0 :         return SUCCESS;
     764             : }
     765             : /* }}} */
     766             : 
     767           0 : void zend_register_standard_ini_entries(TSRMLS_D) /* {{{ */
     768             : {
     769           0 :         int module_number = 0;
     770             : 
     771           0 :         REGISTER_INI_ENTRIES();
     772           0 : }
     773             : /* }}} */
     774             : 
     775             : /* Unlink the global (r/o) copies of the class, function and constant tables,
     776             :  * and use a fresh r/w copy for the startup thread
     777             :  */
     778           0 : void zend_post_startup(TSRMLS_D) /* {{{ */
     779             : {
     780             : #ifdef ZTS
     781             :         zend_encoding **script_encoding_list;
     782             : 
     783             :         zend_compiler_globals *compiler_globals = ts_resource(compiler_globals_id);
     784             :         zend_executor_globals *executor_globals = ts_resource(executor_globals_id);
     785             : 
     786             :         *GLOBAL_FUNCTION_TABLE = *compiler_globals->function_table;
     787             :         *GLOBAL_CLASS_TABLE = *compiler_globals->class_table;
     788             :         *GLOBAL_CONSTANTS_TABLE = *executor_globals->zend_constants;
     789             : 
     790             :         asp_tags_default = CG(asp_tags);
     791             :         short_tags_default = CG(short_tags);
     792             :         compiler_options_default = CG(compiler_options);
     793             : 
     794             :         zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
     795             :         free(compiler_globals->function_table);
     796             :         free(compiler_globals->class_table);
     797             :         if ((script_encoding_list = (zend_encoding **)compiler_globals->script_encoding_list)) {
     798             :                 compiler_globals_ctor(compiler_globals, tsrm_ls);
     799             :                 compiler_globals->script_encoding_list = (const zend_encoding **)script_encoding_list;
     800             :         } else {
     801             :                 compiler_globals_ctor(compiler_globals, tsrm_ls);
     802             :         }
     803             :         free(EG(zend_constants));
     804             : 
     805             :         virtual_cwd_deactivate(TSRMLS_C);
     806             : 
     807             :         executor_globals_ctor(executor_globals, tsrm_ls);
     808             :         global_persistent_list = &EG(persistent_list);
     809             :         zend_copy_ini_directives(TSRMLS_C);
     810             : #else
     811           0 :         virtual_cwd_deactivate(TSRMLS_C);
     812             : #endif
     813           0 : }
     814             : /* }}} */
     815             : 
     816           0 : void zend_shutdown(TSRMLS_D) /* {{{ */
     817             : {
     818             : #ifdef ZEND_SIGNALS
     819             :         zend_signal_shutdown(TSRMLS_C);
     820             : #endif
     821             : #ifdef ZEND_WIN32
     822             :         zend_shutdown_timeout_thread();
     823             : #endif
     824           0 :         zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
     825           0 :         zend_destroy_modules();
     826             : 
     827           0 :         virtual_cwd_deactivate(TSRMLS_C);
     828           0 :         virtual_cwd_shutdown();
     829             : 
     830           0 :         zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
     831           0 :         zend_hash_destroy(GLOBAL_CLASS_TABLE);
     832             : 
     833           0 :         zend_hash_destroy(GLOBAL_AUTO_GLOBALS_TABLE);
     834           0 :         free(GLOBAL_AUTO_GLOBALS_TABLE);
     835             : 
     836           0 :         zend_shutdown_extensions(TSRMLS_C);
     837           0 :         free(zend_version_info);
     838             : 
     839           0 :         free(GLOBAL_FUNCTION_TABLE);
     840           0 :         free(GLOBAL_CLASS_TABLE);
     841             : 
     842           0 :         zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
     843           0 :         free(GLOBAL_CONSTANTS_TABLE);
     844           0 :         zend_shutdown_strtod();
     845             : 
     846             : #ifdef ZTS
     847             :         GLOBAL_FUNCTION_TABLE = NULL;
     848             :         GLOBAL_CLASS_TABLE = NULL;
     849             :         GLOBAL_AUTO_GLOBALS_TABLE = NULL;
     850             :         GLOBAL_CONSTANTS_TABLE = NULL;
     851             : #endif
     852           0 :         zend_destroy_rsrc_list_dtors();
     853             : 
     854           0 :         zend_interned_strings_dtor(TSRMLS_C);
     855           0 : }
     856             : /* }}} */
     857             : 
     858           0 : void zend_set_utility_values(zend_utility_values *utility_values) /* {{{ */
     859             : {
     860           0 :         zend_uv = *utility_values;
     861           0 :         zend_uv.import_use_extension_length = strlen(zend_uv.import_use_extension);
     862           0 : }
     863             : /* }}} */
     864             : 
     865             : /* this should be compatible with the standard zenderror */
     866           0 : void zenderror(const char *error) /* {{{ */
     867             : {
     868           0 :         zend_error(E_PARSE, "%s", error);
     869           0 : }
     870             : /* }}} */
     871             : 
     872             : BEGIN_EXTERN_C()
     873           0 : ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */
     874             : {
     875             :         TSRMLS_FETCH();
     876             : 
     877           0 :         if (!EG(bailout)) {
     878           0 :                 zend_output_debug_string(1, "%s(%d) : Bailed out without a bailout address!", filename, lineno);
     879           0 :                 exit(-1);
     880             :         }
     881           0 :         CG(unclean_shutdown) = 1;
     882           0 :         CG(active_class_entry) = NULL;
     883           0 :         CG(in_compilation) = EG(in_execution) = 0;
     884           0 :         EG(current_execute_data) = NULL;
     885           0 :         LONGJMP(*EG(bailout), FAILURE);
     886             : }
     887             : /* }}} */
     888             : END_EXTERN_C()
     889             : 
     890           0 : void zend_append_version_info(const zend_extension *extension) /* {{{ */
     891             : {
     892             :         char *new_info;
     893             :         uint new_info_length;
     894             : 
     895           0 :         new_info_length = sizeof("    with  v, , by \n")
     896           0 :                                                 + strlen(extension->name)
     897           0 :                                                 + strlen(extension->version)
     898           0 :                                                 + strlen(extension->copyright)
     899           0 :                                                 + strlen(extension->author);
     900             : 
     901           0 :         new_info = (char *) malloc(new_info_length + 1);
     902             : 
     903           0 :         snprintf(new_info, new_info_length, "    with %s v%s, %s, by %s\n", extension->name, extension->version, extension->copyright, extension->author);
     904             : 
     905           0 :         zend_version_info = (char *) realloc(zend_version_info, zend_version_info_length+new_info_length + 1);
     906           0 :         strncat(zend_version_info, new_info, new_info_length);
     907           0 :         zend_version_info_length += new_info_length;
     908           0 :         free(new_info);
     909           0 : }
     910             : /* }}} */
     911             : 
     912           0 : ZEND_API char *get_zend_version(void) /* {{{ */
     913             : {
     914           0 :         return zend_version_info;
     915             : }
     916             : /* }}} */
     917             : 
     918           0 : ZEND_API void zend_activate(TSRMLS_D) /* {{{ */
     919             : {
     920             : #ifdef ZTS
     921             :         virtual_cwd_activate(TSRMLS_C);
     922             : #endif
     923           0 :         gc_reset(TSRMLS_C);
     924           0 :         init_compiler(TSRMLS_C);
     925           0 :         init_executor(TSRMLS_C);
     926           0 :         startup_scanner(TSRMLS_C);
     927           0 : }
     928             : /* }}} */
     929             : 
     930           0 : void zend_call_destructors(TSRMLS_D) /* {{{ */
     931             : {
     932           0 :         zend_try {
     933           0 :                 shutdown_destructors(TSRMLS_C);
     934           0 :         } zend_end_try();
     935           0 : }
     936             : /* }}} */
     937             : 
     938           0 : ZEND_API void zend_deactivate(TSRMLS_D) /* {{{ */
     939             : {
     940             :         /* we're no longer executing anything */
     941           0 :         EG(opline_ptr) = NULL;
     942           0 :         EG(active_symbol_table) = NULL;
     943             : 
     944           0 :         zend_try {
     945           0 :                 shutdown_scanner(TSRMLS_C);
     946           0 :         } zend_end_try();
     947             : 
     948             :         /* shutdown_executor() takes care of its own bailout handling */
     949           0 :         shutdown_executor(TSRMLS_C);
     950             : 
     951           0 :         zend_try {
     952           0 :                 shutdown_compiler(TSRMLS_C);
     953           0 :         } zend_end_try();
     954             : 
     955           0 :         zend_destroy_rsrc_list(&EG(regular_list) TSRMLS_CC);
     956             : 
     957             : #ifdef ZEND_DEBUG
     958           0 :         if (GC_G(gc_enabled) && !CG(unclean_shutdown)) {
     959           0 :                 gc_collect_cycles(TSRMLS_C);
     960             :         }
     961             : #endif
     962             : 
     963             : #if GC_BENCH
     964             :         fprintf(stderr, "GC Statistics\n");
     965             :         fprintf(stderr, "-------------\n");
     966             :         fprintf(stderr, "Runs:               %d\n", GC_G(gc_runs));
     967             :         fprintf(stderr, "Collected:          %d\n", GC_G(collected));
     968             :         fprintf(stderr, "Root buffer length: %d\n", GC_G(root_buf_length));
     969             :         fprintf(stderr, "Root buffer peak:   %d\n\n", GC_G(root_buf_peak));
     970             :         fprintf(stderr, "      Possible            Remove from  Marked\n");
     971             :         fprintf(stderr, "        Root    Buffered     buffer     grey\n");
     972             :         fprintf(stderr, "      --------  --------  -----------  ------\n");
     973             :         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));
     974             :         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));
     975             : #endif
     976             : 
     977           0 :         zend_try {
     978           0 :                 zend_ini_deactivate(TSRMLS_C);
     979           0 :         } zend_end_try();
     980           0 : }
     981             : /* }}} */
     982             : 
     983             : BEGIN_EXTERN_C()
     984           0 : ZEND_API void zend_message_dispatcher(long message, const void *data TSRMLS_DC) /* {{{ */
     985             : {
     986           0 :         if (zend_message_dispatcher_p) {
     987           0 :                 zend_message_dispatcher_p(message, data TSRMLS_CC);
     988             :         }
     989           0 : }
     990             : /* }}} */
     991             : END_EXTERN_C()
     992             : 
     993           0 : ZEND_API int zend_get_configuration_directive(const char *name, uint name_length, zval *contents) /* {{{ */
     994             : {
     995           0 :         if (zend_get_configuration_directive_p) {
     996           0 :                 return zend_get_configuration_directive_p(name, name_length, contents);
     997             :         } else {
     998           0 :                 return FAILURE;
     999             :         }
    1000             : }
    1001             : /* }}} */
    1002             : 
    1003             : #define SAVE_STACK(stack) do { \
    1004             :                 if (CG(stack).top) { \
    1005             :                         memcpy(&stack, &CG(stack), sizeof(zend_stack)); \
    1006             :                         CG(stack).top = CG(stack).max = 0; \
    1007             :                         CG(stack).elements = NULL; \
    1008             :                 } else { \
    1009             :                         stack.top = 0; \
    1010             :                 } \
    1011             :         } while (0)
    1012             : 
    1013             : #define RESTORE_STACK(stack) do { \
    1014             :                 if (stack.top) { \
    1015             :                         zend_stack_destroy(&CG(stack)); \
    1016             :                         memcpy(&CG(stack), &stack, sizeof(zend_stack)); \
    1017             :                 } \
    1018             :         } while (0)
    1019             : 
    1020           0 : ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */
    1021             : {
    1022             :         va_list args;
    1023             :         va_list usr_copy;
    1024             :         zval ***params;
    1025             :         zval *retval;
    1026             :         zval *z_error_type, *z_error_message, *z_error_filename, *z_error_lineno, *z_context;
    1027             :         const char *error_filename;
    1028             :         uint error_lineno;
    1029             :         zval *orig_user_error_handler;
    1030             :         zend_bool in_compilation;
    1031             :         zend_class_entry *saved_class_entry;
    1032             :         zend_stack bp_stack;
    1033             :         zend_stack function_call_stack;
    1034             :         zend_stack switch_cond_stack;
    1035             :         zend_stack foreach_copy_stack;
    1036             :         zend_stack object_stack;
    1037             :         zend_stack declare_stack;
    1038             :         zend_stack list_stack;
    1039             :         zend_stack context_stack;
    1040             :         TSRMLS_FETCH();
    1041             : 
    1042             :         /* Report about uncaught exception in case of fatal errors */
    1043           0 :         if (EG(exception)) {
    1044           0 :                 switch (type) {
    1045             :                         case E_CORE_ERROR:
    1046             :                         case E_ERROR:
    1047             :                         case E_RECOVERABLE_ERROR:
    1048             :                         case E_PARSE:
    1049             :                         case E_COMPILE_ERROR:
    1050             :                         case E_USER_ERROR:
    1051           0 :                                 if (zend_is_executing(TSRMLS_C)) {
    1052           0 :                                         error_lineno = zend_get_executed_lineno(TSRMLS_C);
    1053             :                                 }
    1054           0 :                                 zend_exception_error(EG(exception), E_WARNING TSRMLS_CC);
    1055           0 :                                 EG(exception) = NULL;
    1056           0 :                                 if (zend_is_executing(TSRMLS_C) && EG(opline_ptr)) {
    1057           0 :                                         active_opline->lineno = error_lineno;
    1058             :                                 }
    1059             :                                 break;
    1060             :                         default:
    1061             :                                 break;
    1062             :                 }
    1063             :         }
    1064             : 
    1065             :         /* Obtain relevant filename and lineno */
    1066           0 :         switch (type) {
    1067             :                 case E_CORE_ERROR:
    1068             :                 case E_CORE_WARNING:
    1069           0 :                         error_filename = NULL;
    1070           0 :                         error_lineno = 0;
    1071           0 :                         break;
    1072             :                 case E_PARSE:
    1073             :                 case E_COMPILE_ERROR:
    1074             :                 case E_COMPILE_WARNING:
    1075             :                 case E_ERROR:
    1076             :                 case E_NOTICE:
    1077             :                 case E_STRICT:
    1078             :                 case E_DEPRECATED:
    1079             :                 case E_WARNING:
    1080             :                 case E_USER_ERROR:
    1081             :                 case E_USER_WARNING:
    1082             :                 case E_USER_NOTICE:
    1083             :                 case E_USER_DEPRECATED:
    1084             :                 case E_RECOVERABLE_ERROR:
    1085           0 :                         if (zend_is_compiling(TSRMLS_C)) {
    1086           0 :                                 error_filename = zend_get_compiled_filename(TSRMLS_C);
    1087           0 :                                 error_lineno = zend_get_compiled_lineno(TSRMLS_C);
    1088           0 :                         } else if (zend_is_executing(TSRMLS_C)) {
    1089           0 :                                 error_filename = zend_get_executed_filename(TSRMLS_C);
    1090           0 :                                 error_lineno = zend_get_executed_lineno(TSRMLS_C);
    1091             :                         } else {
    1092           0 :                                 error_filename = NULL;
    1093           0 :                                 error_lineno = 0;
    1094             :                         }
    1095           0 :                         break;
    1096             :                 default:
    1097           0 :                         error_filename = NULL;
    1098           0 :                         error_lineno = 0;
    1099             :                         break;
    1100             :         }
    1101           0 :         if (!error_filename) {
    1102           0 :                 error_filename = "Unknown";
    1103             :         }
    1104             : 
    1105             : #ifdef HAVE_DTRACE
    1106             :         if(DTRACE_ERROR_ENABLED()) {
    1107             :                 char *dtrace_error_buffer;
    1108             :                 va_start(args, format);
    1109             :                 zend_vspprintf(&dtrace_error_buffer, 0, format, args);
    1110             :                 DTRACE_ERROR(dtrace_error_buffer, (char *)error_filename, error_lineno);
    1111             :                 efree(dtrace_error_buffer);
    1112             :                 va_end(args);
    1113             :         }
    1114             : #endif /* HAVE_DTRACE */
    1115             : 
    1116           0 :         va_start(args, format);
    1117             : 
    1118             :         /* if we don't have a user defined error handler */
    1119           0 :         if (!EG(user_error_handler)
    1120           0 :                 || !(EG(user_error_handler_error_reporting) & type)
    1121           0 :                 || EG(error_handling) != EH_NORMAL) {
    1122           0 :                 zend_error_cb(type, error_filename, error_lineno, format, args);
    1123           0 :         } else switch (type) {
    1124             :                 case E_ERROR:
    1125             :                 case E_PARSE:
    1126             :                 case E_CORE_ERROR:
    1127             :                 case E_CORE_WARNING:
    1128             :                 case E_COMPILE_ERROR:
    1129             :                 case E_COMPILE_WARNING:
    1130             :                         /* The error may not be safe to handle in user-space */
    1131           0 :                         zend_error_cb(type, error_filename, error_lineno, format, args);
    1132           0 :                         break;
    1133             :                 default:
    1134             :                         /* Handle the error in user space */
    1135           0 :                         ALLOC_INIT_ZVAL(z_error_message);
    1136           0 :                         ALLOC_INIT_ZVAL(z_error_type);
    1137           0 :                         ALLOC_INIT_ZVAL(z_error_filename);
    1138           0 :                         ALLOC_INIT_ZVAL(z_error_lineno);
    1139           0 :                         ALLOC_INIT_ZVAL(z_context);
    1140             : 
    1141             : /* va_copy() is __va_copy() in old gcc versions.
    1142             :  * According to the autoconf manual, using
    1143             :  * memcpy(&dst, &src, sizeof(va_list))
    1144             :  * gives maximum portability. */
    1145             : #ifndef va_copy
    1146             : # ifdef __va_copy
    1147             : #  define va_copy(dest, src)    __va_copy((dest), (src))
    1148             : # else
    1149             : #  define va_copy(dest, src)    memcpy(&(dest), &(src), sizeof(va_list))
    1150             : # endif
    1151             : #endif
    1152           0 :                         va_copy(usr_copy, args);
    1153           0 :                         Z_STRLEN_P(z_error_message) = zend_vspprintf(&Z_STRVAL_P(z_error_message), 0, format, usr_copy);
    1154             : #ifdef va_copy
    1155           0 :                         va_end(usr_copy);
    1156             : #endif
    1157           0 :                         Z_TYPE_P(z_error_message) = IS_STRING;
    1158             : 
    1159           0 :                         Z_LVAL_P(z_error_type) = type;
    1160           0 :                         Z_TYPE_P(z_error_type) = IS_LONG;
    1161             : 
    1162           0 :                         if (error_filename) {
    1163           0 :                                 ZVAL_STRING(z_error_filename, error_filename, 1);
    1164             :                         }
    1165             : 
    1166           0 :                         Z_LVAL_P(z_error_lineno) = error_lineno;
    1167           0 :                         Z_TYPE_P(z_error_lineno) = IS_LONG;
    1168             : 
    1169           0 :                         if (!EG(active_symbol_table)) {
    1170           0 :                                 zend_rebuild_symbol_table(TSRMLS_C);
    1171             :                         }
    1172             : 
    1173             :                         /* during shutdown the symbol table table can be still null */
    1174           0 :                         if (!EG(active_symbol_table)) {
    1175           0 :                                 Z_TYPE_P(z_context) = IS_NULL;
    1176             :                         } else {
    1177           0 :                                 Z_ARRVAL_P(z_context) = EG(active_symbol_table);
    1178           0 :                                 Z_TYPE_P(z_context) = IS_ARRAY;
    1179           0 :                                 zval_copy_ctor(z_context);
    1180             :                         }
    1181             : 
    1182           0 :                         params = (zval ***) emalloc(sizeof(zval **)*5);
    1183           0 :                         params[0] = &z_error_type;
    1184           0 :                         params[1] = &z_error_message;
    1185           0 :                         params[2] = &z_error_filename;
    1186           0 :                         params[3] = &z_error_lineno;
    1187           0 :                         params[4] = &z_context;
    1188             : 
    1189           0 :                         orig_user_error_handler = EG(user_error_handler);
    1190           0 :                         EG(user_error_handler) = NULL;
    1191             : 
    1192             :                         /* User error handler may include() additinal PHP files.
    1193             :                          * If an error was generated during comilation PHP will compile
    1194             :                          * such scripts recursivly, but some CG() variables may be
    1195             :                          * inconsistent. */
    1196             : 
    1197           0 :                         in_compilation = CG(in_compilation);
    1198           0 :                         if (in_compilation) {
    1199           0 :                                 saved_class_entry = CG(active_class_entry);
    1200           0 :                                 CG(active_class_entry) = NULL;
    1201           0 :                                 SAVE_STACK(bp_stack);
    1202           0 :                                 SAVE_STACK(function_call_stack);
    1203           0 :                                 SAVE_STACK(switch_cond_stack);
    1204           0 :                                 SAVE_STACK(foreach_copy_stack);
    1205           0 :                                 SAVE_STACK(object_stack);
    1206           0 :                                 SAVE_STACK(declare_stack);
    1207           0 :                                 SAVE_STACK(list_stack);
    1208           0 :                                 SAVE_STACK(context_stack);
    1209           0 :                                 CG(in_compilation) = 0;
    1210             :                         }
    1211             : 
    1212           0 :                         if (call_user_function_ex(CG(function_table), NULL, orig_user_error_handler, &retval, 5, params, 1, NULL TSRMLS_CC) == SUCCESS) {
    1213           0 :                                 if (retval) {
    1214           0 :                                         if (Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval) == 0) {
    1215           0 :                                                 zend_error_cb(type, error_filename, error_lineno, format, args);
    1216             :                                         }
    1217           0 :                                         zval_ptr_dtor(&retval);
    1218             :                                 }
    1219           0 :                         } else if (!EG(exception)) {
    1220             :                                 /* The user error handler failed, use built-in error handler */
    1221           0 :                                 zend_error_cb(type, error_filename, error_lineno, format, args);
    1222             :                         }
    1223             : 
    1224           0 :                         if (in_compilation) {
    1225           0 :                                 CG(active_class_entry) = saved_class_entry;
    1226           0 :                                 RESTORE_STACK(bp_stack);
    1227           0 :                                 RESTORE_STACK(function_call_stack);
    1228           0 :                                 RESTORE_STACK(switch_cond_stack);
    1229           0 :                                 RESTORE_STACK(foreach_copy_stack);
    1230           0 :                                 RESTORE_STACK(object_stack);
    1231           0 :                                 RESTORE_STACK(declare_stack);
    1232           0 :                                 RESTORE_STACK(list_stack);
    1233           0 :                                 RESTORE_STACK(context_stack);
    1234           0 :                                 CG(in_compilation) = 1;
    1235             :                         }
    1236             : 
    1237           0 :                         if (!EG(user_error_handler)) {
    1238           0 :                                 EG(user_error_handler) = orig_user_error_handler;
    1239             :                         }
    1240             :                         else {
    1241           0 :                                 zval_ptr_dtor(&orig_user_error_handler);
    1242             :                         }
    1243             : 
    1244           0 :                         efree(params);
    1245           0 :                         zval_ptr_dtor(&z_error_message);
    1246           0 :                         zval_ptr_dtor(&z_error_type);
    1247           0 :                         zval_ptr_dtor(&z_error_filename);
    1248           0 :                         zval_ptr_dtor(&z_error_lineno);
    1249           0 :                         zval_ptr_dtor(&z_context);
    1250             :                         break;
    1251             :         }
    1252             : 
    1253           0 :         va_end(args);
    1254             : 
    1255           0 :         if (type == E_PARSE) {
    1256             :                 /* eval() errors do not affect exit_status */
    1257           0 :                 if (!(EG(current_execute_data) &&
    1258           0 :                         EG(current_execute_data)->opline &&
    1259           0 :                         EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL &&
    1260           0 :                         EG(current_execute_data)->opline->extended_value == ZEND_EVAL)) {
    1261           0 :                         EG(exit_status) = 255;
    1262             :                 }
    1263           0 :                 zend_init_compiler_data_structures(TSRMLS_C);
    1264             :         }
    1265           0 : }
    1266             : /* }}} */
    1267             : 
    1268             : #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)
    1269             : void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn));
    1270             : #endif
    1271             : 
    1272           0 : ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *format, ...) /* {{{ */
    1273             : {
    1274             : #if ZEND_DEBUG
    1275             :         va_list args;
    1276             : 
    1277             :         va_start(args, format);
    1278             : #       ifdef ZEND_WIN32
    1279             :         {
    1280             :                 char output_buf[1024];
    1281             : 
    1282             :                 vsnprintf(output_buf, 1024, format, args);
    1283             :                 OutputDebugString(output_buf);
    1284             :                 OutputDebugString("\n");
    1285             :                 if (trigger_break && IsDebuggerPresent()) {
    1286             :                         DebugBreak();
    1287             :                 }
    1288             :         }
    1289             : #       else
    1290             :         vfprintf(stderr, format, args);
    1291             :         fprintf(stderr, "\n");
    1292             : #       endif
    1293             :         va_end(args);
    1294             : #endif
    1295           0 : }
    1296             : /* }}} */
    1297             : 
    1298           0 : ZEND_API int zend_execute_scripts(int type TSRMLS_DC, zval **retval, int file_count, ...) /* {{{ */
    1299             : {
    1300             :         va_list files;
    1301             :         int i;
    1302             :         zend_file_handle *file_handle;
    1303           0 :         zend_op_array *orig_op_array = EG(active_op_array);
    1304           0 :         zval **orig_retval_ptr_ptr = EG(return_value_ptr_ptr);
    1305           0 :     long orig_interactive = CG(interactive);
    1306             : 
    1307           0 :         va_start(files, file_count);
    1308           0 :         for (i = 0; i < file_count; i++) {
    1309           0 :                 file_handle = va_arg(files, zend_file_handle *);
    1310           0 :                 if (!file_handle) {
    1311           0 :                         continue;
    1312             :                 }
    1313             : 
    1314           0 :         if (orig_interactive) {
    1315           0 :             if (file_handle->filename[0] != '-' || file_handle->filename[1]) {
    1316           0 :                 CG(interactive) = 0;
    1317             :             } else {
    1318           0 :                 CG(interactive) = 1;
    1319             :             }
    1320             :         }
    1321             :        
    1322           0 :                 EG(active_op_array) = zend_compile_file(file_handle, type TSRMLS_CC);
    1323           0 :                 if (file_handle->opened_path) {
    1324           0 :                         int dummy = 1;
    1325           0 :                         zend_hash_add(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path) + 1, (void *)&dummy, sizeof(int), NULL);
    1326             :                 }
    1327           0 :                 zend_destroy_file_handle(file_handle TSRMLS_CC);
    1328           0 :                 if (EG(active_op_array)) {
    1329           0 :                         EG(return_value_ptr_ptr) = retval ? retval : NULL;
    1330           0 :                         zend_execute(EG(active_op_array) TSRMLS_CC);
    1331           0 :                         zend_exception_restore(TSRMLS_C);
    1332           0 :                         if (EG(exception)) {
    1333           0 :                                 if (EG(user_exception_handler)) {
    1334             :                                         zval *orig_user_exception_handler;
    1335             :                                         zval **params[1], *retval2, *old_exception;
    1336           0 :                                         old_exception = EG(exception);
    1337           0 :                                         EG(exception) = NULL;
    1338           0 :                                         params[0] = &old_exception;
    1339           0 :                                         orig_user_exception_handler = EG(user_exception_handler);
    1340           0 :                                         if (call_user_function_ex(CG(function_table), NULL, orig_user_exception_handler, &retval2, 1, params, 1, NULL TSRMLS_CC) == SUCCESS) {
    1341           0 :                                                 if (retval2 != NULL) {
    1342           0 :                                                         zval_ptr_dtor(&retval2);
    1343             :                                                 }
    1344           0 :                                                 if (EG(exception)) {
    1345           0 :                                                         zval_ptr_dtor(&EG(exception));
    1346           0 :                                                         EG(exception) = NULL;
    1347             :                                                 }
    1348           0 :                                                 zval_ptr_dtor(&old_exception);
    1349             :                                         } else {
    1350           0 :                                                 EG(exception) = old_exception;
    1351           0 :                                                 zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
    1352             :                                         }
    1353             :                                 } else {
    1354           0 :                                         zend_exception_error(EG(exception), E_ERROR TSRMLS_CC);
    1355             :                                 }
    1356             :                         }
    1357           0 :                         destroy_op_array(EG(active_op_array) TSRMLS_CC);
    1358           0 :                         efree(EG(active_op_array));
    1359           0 :                 } else if (type==ZEND_REQUIRE) {
    1360           0 :                         va_end(files);
    1361           0 :                         EG(active_op_array) = orig_op_array;
    1362           0 :                         EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
    1363           0 :             CG(interactive) = orig_interactive;
    1364           0 :                         return FAILURE;
    1365             :                 }
    1366             :         }
    1367           0 :         va_end(files);
    1368           0 :         EG(active_op_array) = orig_op_array;
    1369           0 :         EG(return_value_ptr_ptr) = orig_retval_ptr_ptr;
    1370           0 :     CG(interactive) = orig_interactive;
    1371             : 
    1372           0 :         return SUCCESS;
    1373             : }
    1374             : /* }}} */
    1375             : 
    1376             : #define COMPILED_STRING_DESCRIPTION_FORMAT "%s(%d) : %s"
    1377             : 
    1378           0 : ZEND_API char *zend_make_compiled_string_description(const char *name TSRMLS_DC) /* {{{ */
    1379             : {
    1380             :         const char *cur_filename;
    1381             :         int cur_lineno;
    1382             :         char *compiled_string_description;
    1383             : 
    1384           0 :         if (zend_is_compiling(TSRMLS_C)) {
    1385           0 :                 cur_filename = zend_get_compiled_filename(TSRMLS_C);
    1386           0 :                 cur_lineno = zend_get_compiled_lineno(TSRMLS_C);
    1387           0 :         } else if (zend_is_executing(TSRMLS_C)) {
    1388           0 :                 cur_filename = zend_get_executed_filename(TSRMLS_C);
    1389           0 :                 cur_lineno = zend_get_executed_lineno(TSRMLS_C);
    1390             :         } else {
    1391           0 :                 cur_filename = "Unknown";
    1392           0 :                 cur_lineno = 0;
    1393             :         }
    1394             : 
    1395           0 :         zend_spprintf(&compiled_string_description, 0, COMPILED_STRING_DESCRIPTION_FORMAT, cur_filename, cur_lineno, name);
    1396           0 :         return compiled_string_description;
    1397             : }
    1398             : /* }}} */
    1399             : 
    1400           0 : void free_estring(char **str_p) /* {{{ */
    1401             : {
    1402           0 :         efree(*str_p);
    1403           0 : }
    1404             : /* }}} */
    1405             : 
    1406             : /*
    1407             :  * Local variables:
    1408             :  * tab-width: 4
    1409             :  * c-basic-offset: 4
    1410             :  * indent-tabs-mode: t
    1411             :  * End:
    1412             :  */

Generated by: LCOV version 1.10

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

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