Changeset 344

Show
Ignore:
Timestamp:
06/19/08 18:01:31 (7 months ago)
Author:
bart
Message:

Remove support for all php versions older than php 5.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/ChangeLog

    r342 r344  
     12008-05-18  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
     2 
     3        * Remove support for all php versions older than php 5.1 
     4 
    152008-05-18  Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 
    26         
  • eaccelerator/trunk/NEWS

    r278 r344  
     1May 18, 2008 - Bart Vanbrabant 
     2------------------------------ 
     3 * Released 0.9.5.3 
     4    An other 0.9.5 maintenance release 
     5    Changes in this version (from 0.9.5.2) 
     6        - Remove an unlock statement that shouldn't be there. This should 
     7          fix the problems reported in #232 and a lot of related bugs.  
     8          Thanks to Terry Duncan for the fix! 
     9 
     10September 03, 2007 - Bart Vanbrabant 
     11------------------------------------ 
     12 * Released 0.9.5.2 
     13    Changes in this version (from 0.9.5.1) 
     14        - This release fixes the optimizer bugs with php 5.2 that caused  
     15          exception handlers to be optimized out.  
     16 
     17May 06, 2007 - Bart Vanbrabant 
     18---------------------------------- 
     19 
     20 * Released 0.9.5.1 
     21    Changes in this version (from 0.9.5) 
     22        - Fix bug that causes problems with protected attributes and php 5.2 
     23        - Fix ttl bug in list_keys 
     24        Known issues: 
     25            Exceptions aren't catched by try catch due to optimizer bug, see 
     26            bugreport #242. 
     27 
    128Oct 11, 2006 - Bart Vanbrabant 
    229---------------------------------- 
  • eaccelerator/trunk/content.c

    r286 r344  
    588588    if (zend_eval_string(code, return_value, eval_name TSRMLS_CC) == SUCCESS && 
    589589        eaccelerator_content_cache_place != ea_none) { 
    590  
    591 #ifndef ZEND_ENGINE_2_1 
    592 /* Doesn't work with php >= 5.1.0 */ 
    593       /* clean garbage */ 
    594       while (EG(garbage_ptr)) { 
    595         zval_ptr_dtor(&EG(garbage)[--EG(garbage_ptr)]); 
    596       } 
    597 #endif 
    598  
    599590      eaccelerator_put(key, key_len, return_value, ttl, eaccelerator_content_cache_place TSRMLS_CC); 
    600591    } 
  • eaccelerator/trunk/debug.c

    r297 r344  
    269269    fprintf(F_fp, "\tfunction_table: %u entries\n", ce->function_table.nNumOfElements); 
    270270    fprintf(F_fp, "\tdefault_properties: %u entries\n", ce->default_properties.nNumOfElements); 
    271 #ifdef ZEND_ENGINE_2 
    272271    fprintf(F_fp, "\tproperties_info: %u entries\n", ce->properties_info.nNumOfElements); 
    273 #  ifdef ZEND_ENGINE_2_1 
    274272    fprintf(F_fp, "\tdefault_static_members: %u entries\n", ce->default_static_members.nNumOfElements); 
    275 #  endif 
    276273    fprintf(F_fp, "\tstatic_members: %u entries\n", ce->static_members->nNumOfElements); 
    277274    fprintf(F_fp, "\tconstants_Table: %u entries\n", ce->constants_table.nNumOfElements); 
     
    285282    fprintf(F_fp, "\tdoc_comment_len: %u\n", ce->doc_comment_len); 
    286283#  endif 
    287 #endif 
    288284    fflush(F_fp); 
    289285} 
     
    299295    fprintf(F_fp, "\tfunction_table: %u entries\n", ce->function_table.nNumOfElements); 
    300296    fprintf(F_fp, "\tdefault_properties: %u entries\n", ce->default_properties.nNumOfElements); 
    301 #ifdef ZEND_ENGINE_2 
    302297    fprintf(F_fp, "\tproperties_info: %u entries\n", ce->properties_info.nNumOfElements); 
    303 #  ifdef ZEND_ENGINE_2_1 
    304298    fprintf(F_fp, "\tdefault_static_members: %u entries\n", ce->default_static_members.nNumOfElements); 
    305 #  endif 
    306299    fprintf(F_fp, "\tstatic_members: %u entries\n", ce->static_members->nNumOfElements); 
    307300    fprintf(F_fp, "\tconstants_Table: %u entries\n", ce->constants_table.nNumOfElements); 
     
    315308    fprintf(F_fp, "\tdoc_comment_len: %u\n", ce->doc_comment_len); 
    316309#  endif 
    317 #endif 
    318310    fflush(F_fp); 
    319311} 
  • eaccelerator/trunk/ea_dasm.c

    r286 r344  
    9999        "FETCH_GLOBAL",                         /* 0 */ 
    100100        "FETCH_LOCAL",                          /* 1 */ 
    101         "FETCH_STATIC"                          /* 2 */ 
    102 #ifdef ZEND_ENGINE_2 
    103         , 
    104         "FETCH_STATIC_MEMBER"           /* 3 */ 
    105 #ifdef ZEND_ENGINE_2_1 
    106     , 
     101        "FETCH_STATIC",                         /* 2 */ 
     102        "FETCH_STATIC_MEMBER",          /* 3 */ 
    107103    "UNKNOWN 1"                 /* 4 */ 
    108 #endif 
    109 #endif 
    110104}; 
    111105/* }}} */ 
     
    272266                                        buf[0] = '\0'; 
    273267                } 
    274 #ifdef ZEND_ENGINE_2 
    275268            } else if ((op->ops & EXT_MASK) == EXT_ASSIGN) { 
    276269                if (opline->extended_value == ZEND_ASSIGN_OBJ) { 
     
    281274                                        buf[0] = '\0'; 
    282275                } 
    283 #ifndef ZEND_ENGINE_2_1 
    284             } else if (opline->opcode == ZEND_UNSET_DIM_OBJ) { 
    285                 if (opline->extended_value == ZEND_UNSET_DIM) { 
    286                     snprintf(buf, sizeof(buf), "ZEND_UNSET_DIM"); 
    287                 } else if (opline->extended_value == ZEND_UNSET_OBJ) { 
    288                     snprintf(buf, sizeof(buf), "ZEND_UNSET_OBJ"); 
    289                 } else { 
    290                                         buf[0] = '\0'; 
    291                 } 
    292 #endif 
    293 #endif 
    294276            } else if (opline->extended_value != 0) { 
    295277                snprintf(buf, sizeof(buf), "%ld", opline->extended_value); 
     
    301283            /* op1 */ 
    302284            zval_used = 0; 
    303 #ifdef ZEND_ENGINE_2_1 
    304285            if (opline->op1.op_type == IS_CV) { 
    305286                snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->op1.u.var, op_array->vars[opline->op1.u.var].name); 
    306             } else 
    307 #endif 
    308             if ((op->ops & OP1_MASK) == OP1_OPLINE) { 
     287            } else if ((op->ops & OP1_MASK) == OP1_OPLINE) { 
    309288                snprintf(buf, sizeof(buf), "opline(%d)", opline->op1.u.opline_num); 
    310 #ifdef ZEND_ENGINE_2 
    311289            } else if ((op->ops & OP1_MASK) == OP1_JMPADDR) { 
    312290                snprintf(buf, sizeof(buf), "opline(%u)", (unsigned int)(opline->op1.u.jmp_addr - op_array->opcodes)); 
     
    319297                    snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op1.u.var)); 
    320298                } 
    321 #endif 
    322299            } else if ((op->ops & OP1_MASK) == OP1_BRK) { 
    323300                if (opline->op1.u.opline_num != -1 && opline->op2.op_type == IS_CONST && opline->op2.u.constant.type == IS_LONG) { 
     
    380357            /* op2 */ 
    381358            zval_used = 0; 
    382 #ifdef ZEND_ENGINE_2_1 
    383359            if (opline->op2.op_type == IS_CV) { 
    384360                snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->op2.u.var, op_array->vars[opline->op2.u.var].name); 
    385             } else  
    386 #endif 
    387                         if ((op->ops & OP2_MASK) == OP2_OPLINE) { 
     361            } else if ((op->ops & OP2_MASK) == OP2_OPLINE) { 
    388362                                snprintf(buf, sizeof(buf), "opline(%d)", opline->op2.u.opline_num); 
    389 #ifdef ZEND_ENGINE_2 
    390363                        } else if ((op->ops & OP2_MASK) == OP2_JMPADDR) { 
    391364                                snprintf(buf, sizeof(buf), "opline(%u)", (unsigned int) (opline->op2.u.jmp_addr - op_array->opcodes)); 
    392365                        } else if ((op->ops & OP2_MASK) == OP2_CLASS) { 
    393366                                snprintf(buf, sizeof(buf), "$class%u", VAR_NUM(opline->op2.u.var)); 
    394 #endif 
    395367                        } else if ((op->ops & OP2_MASK) == OP2_VAR) { 
    396368                                snprintf(buf, sizeof(buf), "$var%u", VAR_NUM(opline->op2.u.var)); 
    397369                        } else if ((op->ops & OP2_MASK) == OP2_FETCH) { 
    398 #ifdef ZEND_ENGINE_2 
    399370                                if (opline->op2.u.EA.type == ZEND_FETCH_STATIC_MEMBER) { 
    400371                                        snprintf(buf, sizeof(buf), "%s $class%u", fetchtypename[opline->op2.u.EA.type], VAR_NUM(opline->op2.u.var)); 
     
    402373                                        snprintf(buf, sizeof(buf), "%s", fetchtypename[opline->op2.u.EA.type]); 
    403374                                } 
    404 #else 
    405                                 strncpy(buf, fetchtypename[opline->op2.u.fetch_type], sizeof(buf)); 
    406 #endif 
    407375                        } else if ((op->ops & OP2_MASK) == OP2_INCLUDE) { 
    408376                                if (opline->op2.u.constant.value.lval == ZEND_EVAL) { 
     
    449417            /* result */ 
    450418            zval_used = 0; 
    451 #ifdef ZEND_ENGINE_2_1 
    452419            if (opline->result.op_type == IS_CV) { 
    453420                snprintf(buf, sizeof(buf), "$cv%u(%s)", opline->result.u.var, op_array->vars[opline->result.u.var].name); 
    454421            } else  
    455 #endif  
    456422                        switch (op->ops & RES_MASK) { 
    457423                            case RES_STD: 
  • eaccelerator/trunk/ea_restore.c

    r331 r344  
    3636#include "zend_API.h" 
    3737#include "zend_extensions.h" 
    38 #ifdef ZEND_ENGINE_2_1 
    3938#include "zend_vm.h" 
    40 #endif 
    4139 
    4240#ifndef INCOMPLETE_CLASS 
     
    5250#endif 
    5351 
    54 #ifdef ZEND_ENGINE_2 
    5552/* pointer to the properties_info hashtable destructor */ 
    5653dtor_func_t properties_info_dtor = NULL; 
     
    7269    zend_hash_destroy(&dummy_class_entry.constants_table); 
    7370    zend_hash_destroy(&dummy_class_entry.properties_info); 
    74 #  ifdef ZEND_ENGINE_2_1 
    7571    zend_hash_destroy(&dummy_class_entry.default_static_members); 
    76 #  endif 
    77 #  if defined(ZEND_ENGINE_2) && !defined(ZEND_ENGINE_2_1) 
    78     zend_hash_destroy(dummy_class_entry.static_members); 
    79         FREE_HASHTABLE(dummy_class_entry.static_members); 
    80 #  endif 
    8172    return property_dtor; 
    8273} 
    83 #endif 
    8474 
    8575/******************************************************************************/ 
     
    9282    fixup_hash(base, from, (fixup_bucket_t)fixup_zval TSRMLS_CC) 
    9383 
    94 #ifdef ZEND_ENGINE_2 
    9584static void fixup_property_info(char *base, zend_property_info * from TSRMLS_DC) 
    9685{ 
    9786    FIXUP(base, from->name); 
    98 #ifdef ZEND_ENGINE_2_1 
    9987    FIXUP(base, from->doc_comment); 
    100 #endif 
    101 
    102 #endif 
     88
    10389 
    10490static void fixup_hash(char *base, HashTable * source, 
     
    165151    zend_op *end; 
    166152 
    167 #ifdef ZEND_ENGINE_2 
    168153    if (from->num_args > 0) { 
    169154        zend_uint i; 
     
    174159        } 
    175160    } 
    176 #else 
    177     FIXUP(base, from->arg_types); 
    178 #endif 
    179161    FIXUP(base, from->function_name); 
    180 #ifdef ZEND_ENGINE_2 
    181162    FIXUP(base, from->scope_name); 
    182 #endif 
    183163    if (from->type == ZEND_INTERNAL_FUNCTION) { 
    184164        return; 
     
    200180            if (opline->op2.op_type == IS_CONST) 
    201181                fixup_zval(base, &opline->op2.u.constant TSRMLS_CC); 
    202 #ifdef ZEND_ENGINE_2 
    203182            switch (opline->opcode) { 
    204183            case ZEND_JMP: 
     
    212191                break; 
    213192            } 
    214 #  ifdef ZEND_ENGINE_2_1 
    215193            ZEND_VM_SET_OPCODE_HANDLER(opline); 
    216 #  elif defined(ZEND_ENGINE_2) 
    217             opline->handler = zend_opcode_handlers[opline->opcode]; 
    218 #  else 
    219             opline->handler = get_opcode_handler(opline->opcode TSRMLS_CC); 
    220 #  endif 
    221  
    222 #endif 
    223194        } 
    224195        EAG(compress) = 1; 
    225196    } 
    226197    FIXUP(base, from->brk_cont_array); 
    227 #ifdef ZEND_ENGINE_2 
    228198    FIXUP(base, from->try_catch_array); 
    229 #endif 
    230199    if (from->static_variables != NULL) { 
    231200        FIXUP(base, from->static_variables); 
    232201        fixup_zval_hash(base, from->static_variables); 
    233202    } 
    234 #ifdef ZEND_ENGINE_2_1 
    235203    if (from->vars != NULL) { 
    236204        int i; 
     
    240208        } 
    241209    } 
    242 #endif 
    243210    FIXUP(base, from->filename); 
    244211#ifdef INCLUDE_DOC_COMMENTS 
    245 #ifdef ZEND_ENGINE_2 
    246212    FIXUP(base, from->doc_comment); 
    247 #endif 
    248213#endif 
    249214} 
     
    253218    FIXUP(base, from->name); 
    254219    FIXUP(base, from->parent); 
    255 #ifdef ZEND_ENGINE_2 
    256220    FIXUP(base, from->filename); 
    257221    fixup_zval_hash(base, &from->constants_table); 
     
    259223    fixup_hash(base, &from->properties_info, 
    260224               (fixup_bucket_t) fixup_property_info TSRMLS_CC); 
    261 #  ifdef ZEND_ENGINE_2_1 
    262225    fixup_zval_hash(base, &from->default_static_members); 
    263226    if (from->static_members != NULL) { 
     
    267230        } 
    268231    } 
    269 #  else 
    270     if (from->static_members != NULL) { 
    271         FIXUP(base, from->static_members); 
    272         fixup_zval_hash(base, from->static_members); 
    273     } 
    274 #  endif 
    275 #else 
    276     fixup_zval_hash(base, &from->default_properties); 
    277 #endif 
    278232    fixup_hash(base, &from->function_table,(fixup_bucket_t) fixup_op_array TSRMLS_CC); 
    279233} 
     
    433387        void *ptr; 
    434388    } function; 
    435 #ifdef ZEND_ENGINE_2 
    436389    int fname_len = 0; 
    437390    char *fname_lc = NULL; 
    438 #endif 
    439391 
    440392    DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     
    458410    } 
    459411    to->type = from->type; 
    460 #ifdef ZEND_ENGINE_2 
    461412    to->num_args = from->num_args; 
    462413    to->required_num_args = from->required_num_args; 
    463414    to->arg_info = from->arg_info; 
    464415    to->pass_rest_by_reference = from->pass_rest_by_reference; 
    465 #else 
    466     to->arg_types = from->arg_types; 
    467 #endif 
    468416    to->function_name = from->function_name; 
    469417 
    470 #ifdef ZEND_ENGINE_2 
    471418    if (to->function_name) { 
    472419        fname_len = strlen(to->function_name); 
     
    538485    DBG(ea_debug_printf, (EA_DEBUG, "[%d]                   %s's scope is '%s'\n", getpid(),  
    539486            from->function_name ? from->function_name : "(top)", to->scope ? to->scope->name : "NULL")); 
    540 #endif 
    541487    if (from->type == ZEND_INTERNAL_FUNCTION) { 
    542488        zend_class_entry *class_entry = EAG(class_entry); 
     
    551497        if (class_entry != NULL && class_entry->parent != NULL &&  
    552498                zend_hash_find(&class_entry->parent->function_table, 
    553 #ifdef ZEND_ENGINE_2 
    554499                fname_lc, fname_len + 1, 
    555 #else 
    556                 to->function_name, strlen(to->function_name) + 1, 
    557 #endif 
    558500                &function.ptr) == SUCCESS && function.v->type == ZEND_INTERNAL_FUNCTION) { 
    559501            DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
     
    567509            DBG(ea_debug_printf, (EA_DEBUG, "[%d]                                       can't find\n", getpid())); 
    568510        }        
    569 #ifdef ZEND_ENGINE_2 
    570511        /* hrak: slight memleak here. dont forget to free the lowercase function name! */ 
    571512        if (fname_lc != NULL) { 
     
    576517        /* this gets set by zend_do_inheritance */ 
    577518        to->prototype = NULL; 
    578 #endif 
    579519        return to; 
    580520    } 
    581 #ifdef ZEND_ENGINE_2 
    582521    /* hrak: slight memleak here. dont forget to free the lowercase function name! */ 
    583522    if (fname_lc != NULL) { 
    584523        efree(fname_lc); 
    585524    } 
    586 #endif 
    587525    to->opcodes = from->opcodes; 
    588526    to->last = to->size = from->last; 
     
    599537    to->filename = from->filename; 
    600538 
    601 #ifdef ZEND_ENGINE_2 
    602539    to->try_catch_array = from->try_catch_array; 
    603540    to->last_try_catch = from->last_try_catch; 
     
    613550    to->doc_comment = NULL; 
    614551#endif 
    615 #else 
    616     to->uses_globals = from->uses_globals; 
    617 #endif 
    618552    if (from->static_variables) { 
    619553        to->static_variables = restore_zval_hash(NULL, from->static_variables); 
    620554        to->static_variables->pDestructor = ZVAL_PTR_DTOR; 
    621 #ifndef ZEND_ENGINE_2 
    622555        if (EAG(class_entry) != NULL) { 
    623556            Bucket *p = to->static_variables->pListHead; 
     
    627560            } 
    628561        } 
    629 #endif 
    630     } 
    631  
    632 #ifdef ZEND_ENGINE_2_1 
     562    } 
     563 
    633564    to->vars             = from->vars; 
    634565    to->last_var         = from->last_var; 
    635566    to->size_var         = 0; 
    636 #endif 
    637567 
    638568    /* disable deletion in destroy_op_array */ 
     
    648578} 
    649579 
    650 #ifdef ZEND_ENGINE_2 
    651580static zend_property_info *restore_property_info(zend_property_info * 
    652581                                                 from TSRMLS_DC) 
     
    656585    to->name = emalloc(from->name_length + 1); 
    657586    memcpy(to->name, from->name, from->name_length + 1); 
    658 #  ifdef ZEND_ENGINE_2_1 
    659 #    ifdef INCLUDE_DOC_COMMENTS 
     587#ifdef INCLUDE_DOC_COMMENTS 
    660588    if (from->doc_comment != NULL) { 
    661589        to->doc_comment = emalloc(from->doc_comment_len + 1); 
    662590        memcpy(to->doc_comment, from->doc_comment, from->doc_comment_len + 1); 
    663591    } 
    664 #    else 
    665     to->doc_comment_len = 0; 
    666     to->doc_comment = NULL; 
    667 #    endif 
    668 #    ifdef ZEND_ENGINE_2_2 
     592# ifdef ZEND_ENGINE_2_2 
    669593    to->ce = EAG(class_entry); 
    670 #    endif 
    671 #  endif 
     594# endif 
     595#endif 
    672596    return to; 
    673597} 
    674 #endif 
    675598 
    676599/* restore the parent class with the given name for the given class */ 
    677600static void restore_class_parent(char *parent, int len, zend_class_entry * to TSRMLS_DC) 
    678601{ 
    679 #ifdef ZEND_ENGINE_2 
    680602    zend_class_entry** parent_ptr = NULL; 
    681603    if (zend_lookup_class(parent, len, &parent_ptr TSRMLS_CC) != SUCCESS) 
    682 #else 
    683     char *name_lc = estrndup(parent, len); 
    684     zend_str_tolower(name_lc, len); 
    685     if (zend_hash_find(CG(class_table), (void *) name_lc, len + 1, (void **) &to->parent) != SUCCESS) 
    686 #endif 
    687604    { 
    688605        ea_debug_error("[%d] EACCELERATOR can't restore parent class \"%s\" of class \"%s\"\n", getpid(), (char *) parent, to->name); 
     
    690607    } else { 
    691608        /* parent found */ 
    692 #ifdef ZEND_ENGINE_2 
    693609        to->parent = *parent_ptr; 
    694 #endif 
    695610        DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name)); 
    696611        DBG(ea_debug_printf, (EA_DEBUG, "restore_class_parent: parent type=%d child type=%d\n", to->parent->type, to->type)); 
    697612    } 
    698 #ifndef ZEND_ENGINE_2 
    699     efree(name_lc); 
    700 #endif 
    701 
    702  
    703 #ifdef ZEND_ENGINE_2 
     613
     614 
    704615static void restore_class_methods(zend_class_entry * to TSRMLS_DC) 
    705616{ 
     
    738649                     memcmp(fname_lc, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) == 0) 
    739650                to->__set = f; 
    740 #  ifdef ZEND_ENGINE_2_1 
    741651            else if (fname_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && 
    742652                    memcmp(fname_lc, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)) == 0) 
     
    745655                    memcmp(fname_lc, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)) == 0) 
    746656                to->__isset = f; 
    747 #  endif 
    748657            else if (fname_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && 
    749658                     memcmp(fname_lc, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) == 0) 
     
    766675    efree(cname_lc); 
    767676} 
    768 #endif 
    769677 
    770678static zend_class_entry *restore_class_entry(zend_class_entry * to, ea_class_entry * from TSRMLS_DC) 
     
    792700    EAG(class_entry) = to; 
    793701 
    794 #ifdef ZEND_ENGINE_2 
    795702    to->ce_flags = from->ce_flags; 
    796703    to->num_interfaces = from->num_interfaces; 
     
    828735    to->properties_info.pDestructor = properties_info_dtor; 
    829736 
    830 #  ifdef ZEND_ENGINE_2_1 
    831737    /* restore default_static_members */ 
    832738    restore_zval_hash(&to->default_static_members, &from->default_static_members); 
     
    840746        to->static_members = &(to->default_static_members); 
    841747    } 
    842 #  else 
    843     if (from->static_members != NULL) { 
    844         ALLOC_HASHTABLE(to->static_members); 
    845         restore_zval_hash(to->static_members, from->static_members); 
    846         to->static_members->pDestructor = ZVAL_PTR_DTOR; 
    847     } 
    848 #  endif 
    849 #else 
    850     to->refcount = emalloc(sizeof(*to->refcount)); 
    851     *to->refcount = 1; 
    852  
    853     restore_zval_hash(&to->default_properties, &from->default_properties); 
    854     to->default_properties.pDestructor = ZVAL_PTR_DTOR; 
    855     /* Clearing references */ 
    856     { 
    857         Bucket *p = to->default_properties.pListHead; 
    858         while (p != NULL) { 
    859             ((zval *) (p->pDataPtr))->refcount = 1; 
    860             p = p->pListNext; 
    861         } 
    862     } 
    863 #endif 
    864748 
    865749    if (from->parent != NULL) { 
     
    874758    to->function_table.pDestructor = ZEND_FUNCTION_DTOR; 
    875759 
    876 #ifdef ZEND_ENGINE_2 
    877760    restore_class_methods(to TSRMLS_CC); 
    878 #endif 
    879761 
    880762    if (to->parent) { 
    881 #ifdef ZEND_ENGINE_2 
    882763        zend_do_inheritance(to, to->parent TSRMLS_CC); 
    883 #else 
    884         zend_do_inheritance(to, to->parent); 
    885 #endif 
    886764    } 
    887765    EAG(class_entry) = old; 
     
    904782            CG(in_compilation) = 1; 
    905783            CG(compiled_filename) = EAG(mem); 
    906 #ifdef ZEND_ENGINE_2 
    907784            CG(zend_lineno) = op_array.line_start; 
    908 #else 
    909             CG(zend_lineno) = op_array.opcodes[0].lineno; 
    910 #endif 
    911785            zend_error(E_ERROR, "Cannot redeclare %s()", p->htabkey); 
    912786        } 
     
    919793void restore_class(ea_fc_entry * p TSRMLS_DC) 
    920794{ 
    921 #ifdef ZEND_ENGINE_2 
    922795    zend_class_entry *ce; 
    923 #else 
    924     zend_class_entry ce; 
    925 #endif 
    926796 
    927797    if ((p->htabkey[0] == '\000') && zend_hash_exists(CG(class_table), p->htabkey, p->htablen)) { 
    928798        return; 
    929799    } 
    930 #ifdef ZEND_ENGINE_2 
    931800    ce = restore_class_entry(NULL, (ea_class_entry *) p->fc TSRMLS_CC); 
    932801    if (ce != NULL) 
    933 #else 
    934     if (restore_class_entry(&ce, (ea_class_entry *) p->fc TSRMLS_CC) != NULL) 
    935 #endif 
    936802    { 
    937 #ifdef ZEND_ENGINE_2 
    938803        if (zend_hash_add(CG(class_table), p->htabkey, p->htablen, &ce, sizeof(zend_class_entry *), NULL) == FAILURE) 
    939 #else 
    940         if (zend_hash_add(CG(class_table), p->htabkey, p->htablen, &ce, sizeof(zend_class_entry), NULL) == FAILURE) 
    941 #endif 
    942804        { 
    943805            CG(in_compilation) = 1; 
    944806            CG(compiled_filename) = EAG(mem); 
    945 #ifdef ZEND_ENGINE_2 
    946807            CG(zend_lineno) = ce->line_start; 
    947 #else 
    948             CG(zend_lineno) = 0; 
    949 #endif 
    950808            zend_error(E_ERROR, "Cannot redeclare class %s", p->htabkey); 
    951809        } 
  • eaccelerator/trunk/ea_store.c

    r336 r344  
    8181} 
    8282 
    83 #ifdef ZEND_ENGINE_2 
    8483static size_t calc_property_info(zend_property_info * from TSRMLS_DC) 
    8584{ 
     
    9089    size += calc_string(from->name, from->name_length + 1 TSRMLS_CC); 
    9190#ifdef INCLUDE_DOC_COMMENTS 
    92 #ifdef ZEND_ENGINE_2_1 
    9391     if (from->doc_comment != NULL) { 
    9492        size += calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    9593     } 
    9694#endif 
    97 #endif 
    9895     return size; 
    9996} 
    100 #endif 
    10197 
    10298/* Calculate the size of an HashTable */ 
     
    165161        zend_bailout(); 
    166162    } 
    167 #ifdef ZEND_ENGINE_2 
    168163    if (from->num_args > 0) { 
    169164        zend_uint i; 
     
    178173        } 
    179174    } 
    180 #else 
    181     if (from->arg_types != NULL) { 
    182         size += calc_string((char *) from->arg_types, (from->arg_types[0] + 1) * sizeof(zend_uchar) TSRMLS_CC); 
    183     } 
    184 #endif 
    185175    if (from->function_name != NULL) { 
    186176        size += calc_string(from->function_name, strlen(from->function_name) + 1 TSRMLS_CC); 
    187177    } 
    188 #ifdef ZEND_ENGINE_2 
    189178    if (from->scope != NULL) { 
    190179        // HOESH: the same problem? 
     
    198187        } 
    199188    } 
    200 #endif 
    201189    if (from->type == ZEND_INTERNAL_FUNCTION) { 
    202190        return size; 
     
    222210        ADDSIZE(size, sizeof(zend_brk_cont_element) * from->last_brk_cont); 
    223211    } 
    224 #ifdef ZEND_ENGINE_2 
    225212    if (from->try_catch_array != NULL) { 
    226213        ADDSIZE(size, sizeof(zend_try_catch_element) * from->last_try_catch); 
    227214    } 
    228 #endif 
    229215    if (from->static_variables != NULL) { 
    230216        ADDSIZE(size, sizeof(HashTable)); 
    231217        size += calc_zval_hash(from->static_variables); 
    232218    } 
    233 #ifdef ZEND_ENGINE_2_1 
    234219    if (from->vars != NULL) { 
    235220        int i; 
     
    239224        } 
    240225    } 
    241 #endif 
    242226    if (from->filename != NULL) { 
    243227        size += calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 
    244228    } 
    245229#ifdef INCLUDE_DOC_COMMENTS 
    246 #ifdef ZEND_ENGINE_2 
    247230    if (from->doc_comment != NULL) { 
    248231        size += calc_string(from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    249232    } 
    250 #endif 
    251233#endif 
    252234 
     
    270252        size += calc_string(from->parent->name, from->parent->name_length + 1 TSRMLS_CC); 
    271253    } 
    272 #ifdef ZEND_ENGINE_2 
    273254    if (from->filename != NULL) { 
    274255        size += calc_string(from->filename, strlen(from->filename) + 1 TSRMLS_CC); 
     
    284265    size += calc_hash(&from->properties_info, (calc_bucket_t) calc_property_info); 
    285266 
    286 #  ifdef ZEND_ENGINE_2_1 
    287267    size += calc_zval_hash(&from->default_static_members); 
    288268    if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 
    289 #  else 
    290     if (from->static_members != NULL) { 
    291 #  endif 
    292269        ADDSIZE(size, sizeof(HashTable)); 
    293270        size += calc_zval_hash(from->static_members); 
    294271    } 
    295 #else 
    296     size += calc_zval_hash(&from->default_properties); 
    297 #endif 
    298272    size += calc_hash(&from->function_table, (calc_bucket_t) calc_op_array); 
    299273 
     
    331305    } 
    332306    while (c != NULL) { 
    333 #ifdef ZEND_ENGINE_2 
    334307        size += calc_class_entry(*(zend_class_entry **) c->pData TSRMLS_CC); 
    335 #else 
    336         size += calc_class_entry((zend_class_entry *) c->pData TSRMLS_CC); 
    337 #endif 
    338308        c = c->pListNext; 
    339309    } 
     
    504474 
    505475    DBG(ea_debug_pad, (EA_DEBUG TSRMLS_CC)); 
    506 #ifdef ZEND_ENGINE_2 
    507476    DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",  
    508477            getpid(), from->function_name ? from->function_name : "(top)", 
     
    510479            , from->type 
    511480        )); 
    512 #else 
    513     DBG(ea_debug_printf, (EA_DEBUG, "[%d] store_op_array: %s [scope=%s type=%x]\n",  
    514             getpid(), from->function_name ? from->function_name : "(top)", 
    515             "NULL" 
    516             , from->type 
    517         )); 
    518 #endif       
    519481 
    520482    if (from->type == ZEND_INTERNAL_FUNCTION) { 
     
    527489 
    528490    to->type = from->type; 
    529 #ifdef ZEND_ENGINE_2 
    530491    to->num_args = from->num_args; 
    531492    to->required_num_args = from->required_num_args; 
     
    543504                to->arg_info[i].class_name_len = from->arg_info[i].class_name_len; 
    544505            } 
    545 #  ifdef ZEND_ENGINE_2_1 
    546506            /* php 5.1 introduces this in zend_arg_info for array type hinting */ 
    547507            to->arg_info[i].array_type_hint = from->arg_info[i].array_type_hint; 
    548 #  endif 
    549508            to->arg_info[i].allow_null = from->arg_info[i].allow_null; 
    550509            to->arg_info[i].pass_by_reference = from->arg_info[i].pass_by_reference; 
     
    553512    } 
    554513    to->pass_rest_by_reference = from->pass_rest_by_reference; 
    555 #else 
    556     if (from->arg_types != NULL) 
    557         to->arg_types = (unsigned char *)store_string(at, (char *)from->arg_types, (from->arg_types[0] + 1) * sizeof(zend_uchar) TSRMLS_CC); 
    558 #endif 
    559514    if (from->function_name != NULL) 
    560515        to->function_name = store_string(at, from->function_name, strlen(from->function_name) + 1 TSRMLS_CC); 
    561 #ifdef ZEND_ENGINE_2 
    562516    to->fn_flags = from->fn_flags; 
    563517    to->scope_name = NULL; 
     
    585539        } 
    586540    } 
    587 #endif 
    588541 
    589542    if (from->type == ZEND_INTERNAL_FUNCTION) { 
    590 #ifdef ZEND_ENGINE_2 
    591543        /* zend_internal_function also contains return_reference in ZE2 */ 
    592544        to->return_reference = from->return_reference; 
    593 #endif       
    594             return to; 
     545        return to; 
    595546    } 
    596547     
     
    600551    to->brk_cont_array = from->brk_cont_array; 
    601552    to->last_brk_cont = from->last_brk_cont; 
    602 #ifdef ZEND_ENGINE_2 
    603553    to->try_catch_array = from->try_catch_array; 
    604554    to->last_try_catch = from->last_try_catch; 
     
    610560        to->last_try_catch = 0; 
    611561    } 
    612 #else 
    613     to->uses_globals = from->uses_globals; 
    614 #endif 
    615562 
    616563    to->static_variables = from->static_variables; 
     
    632579                store_zval(at, &opline->op2.u.constant TSRMLS_CC); 
    633580            } 
    634 #ifdef ZEND_ENGINE_2 
    635581            switch (opline->opcode) { 
    636582            case ZEND_JMP: 
     
    644590                break; 
    645591            } 
    646 #endif 
    647592        } 
    648593        EAG(compress) = 1; 
     
    659604        store_zval_hash(at, to->static_variables, from->static_variables); 
    660605    } 
    661 #ifdef ZEND_ENGINE_2_1 
    662606    if (from->vars != NULL) { 
    663607            int i; 
     
    674618    to->line_start = from->line_start; 
    675619    to->line_end = from->line_end; 
    676 #  ifdef INCLUDE_DOC_COMMENTS 
     620#ifdef INCLUDE_DOC_COMMENTS 
    677621    to->doc_comment_len = from->doc_comment_len; 
    678622    if (from->doc_comment != NULL) { 
    679623        to->doc_comment = store_string(at, from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    680624    } 
    681 #  endif 
    682625#endif 
    683626 
     
    688631} 
    689632 
    690 #ifdef ZEND_ENGINE_2 
    691633static zend_property_info *store_property_info(char **at, zend_property_info * from TSRMLS_DC) 
    692634{ 
     
    697639    memcpy(to, from, sizeof(zend_property_info)); 
    698640    to->name = store_string(at, from->name, from->name_length + 1 TSRMLS_CC); 
    699 #ifdef ZEND_ENGINE_2_1 
    700 #  ifdef INCLUDE_DOC_COMMENTS 
     641#ifdef INCLUDE_DOC_COMMENTS 
    701642    to->doc_comment_len = from->doc_comment_len;  
    702643    if (from->doc_comment != NULL) {  
    703644       to->doc_comment = store_string(at, from->doc_comment, from->doc_comment_len + 1 TSRMLS_CC); 
    704645    } 
    705 #  else 
     646#else 
    706647    to->doc_comment_len = 0; 
    707648    to->doc_comment = NULL; 
    708 #endif 
    709649#endif 
    710650    return to; 
     
    770710            } 
    771711            /* If the static member points to the same value in parent and child, remove for proper inheritance during restore */ 
    772 #  ifdef ZEND_ENGINE_2_1 
    773712            if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
    774 #  else 
    775             if(zend_hash_quick_find(parent->static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
    776 #  endif 
    777713                if(*pprop.v == *cprop.v) { 
    778714                    return ZEND_HASH_APPLY_REMOVE; 
     
    802738    return ZEND_HASH_APPLY_REMOVE; 
    803739} 
    804 #endif 
    805740 
    806741static ea_class_entry *store_class_entry(char **at, zend_class_entry * from TSRMLS_DC) 
     
    831766    } 
    832767 
    833 #ifdef ZEND_ENGINE_2 /* php >= 5.0 */ 
    834768    to->ce_flags = from->ce_flags; 
    835769    to->static_members = NULL; 
     
    868802    store_hash(at, &to->properties_info, &from->properties_info, (store_bucket_t) store_property_info, (check_bucket_t) store_property_access_check, from); 
    869803     
    870 #  ifdef ZEND_ENGINE_2_1 /* php >= 5.1 */ 
    871804    if ((from->static_members != NULL) && (from->static_members != &from->default_static_members)) { 
    872805        store_zval_hash(at, &to->default_static_members, &from->default_static_members); 
     
    879812        to->static_members = &to->default_static_members; 
    880813    } 
    881 #  else /* php == 5.0 */ 
    882     if (from->static_members != NULL) { 
    883         to->static_members = (HashTable *)ALLOCATE(at, sizeof(HashTable)); 
    884  
    885         store_hash(at, to->static_members, from->static_members, (store_bucket_t) store_zval_ptr, (check_bucket_t) store_static_member_access_check, from); 
    886     }    
    887 #  endif 
    888814    store_hash(at, &to->function_table, &from->function_table, (store_bucket_t) store_op_array, (check_bucket_t) store_function_inheritance_check, from); 
    889815     
    890 #else /* PHP 4 */ 
    891     store_zval_hash(at, &to->default_properties, &from->default_properties); 
    892     store_hash(at, &to->function_table, &from->function_table, (store_bucket_t) store_op_array, NULL, NULL); 
    893 #endif 
    894  
    895816#ifdef DEBUG 
    896817    EAG(xpad)--; 
     
    940861        fc->htablen = c->nKeyLength; 
    941862        fc->next = NULL; 
    942 #ifdef ZEND_ENGINE_2 
    943863        fc->fc = *(zend_class_entry **) c->pData; 
    944 #else 
    945         fc->fc = c->pData; 
    946 #endif 
    947864        c = c->pListNext; 
    948865        x = fc->htabkey; 
  • eaccelerator/trunk/eaccelerator.c

    r342 r344  
    102102int binary_zend_version[2]; 
    103103 
    104 #ifdef ZEND_ENGINE_2 
    105104/* pointer to the properties_info hashtable destructor */ 
    106105extern dtor_func_t properties_info_dtor; 
    107 #endif 
    108106 
    109107/* saved original functions */ 
     
    11661164// segv74: really cheap work around to auto_global problem. 
    11671165//         it makes just in time to every time. 
    1168 #ifdef ZEND_ENGINE_2 
    11691166  zend_is_auto_global("_GET", sizeof("_GET")-1 TSRMLS_CC); 
    11701167  zend_is_auto_global("_POST", sizeof("_POST")-1 TSRMLS_CC); 
     
    11741171  zend_is_auto_global("_REQUEST", sizeof("_REQUEST")-1 TSRMLS_CC); 
    11751172  zend_is_auto_global("_FILES", sizeof("_FILES")-1 TSRMLS_CC); 
    1176 #endif 
    11771173 
    11781174  if (t != NULL) { // restore from cache 
     
    11841180 
    11851181    zend_llist_add_element(&CG(open_files), file_handle); 
    1186 #ifdef ZEND_ENGINE_2 
    11871182    if (file_handle->opened_path == NULL &&a