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

Generated by: LCOV version 1.10

Generated at Fri, 19 Sep 2014 17:11:04 +0000 (26 hours ago)

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