Ignore:
Timestamp:
2006-09-24T10:02:43+02:00 (8 years ago)
Author:
moo
Message:

fix #36, wrong inheriting static class variables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/head.m4

    r195 r196  
    247247} 
    248248/* }}} */ 
     249static int xc_hash_static_member_check(xc_processor_t *processor, Bucket *b TSRMLS_DC) /* {{{ */ 
     250{ 
     251    zend_class_entry *src = processor->active_class_entry_src; 
     252    if (src->parent) { 
     253        zval **srczv; 
     254        if (zend_hash_quick_find(CE_STATIC_MEMBERS(src), b->arKey, b->nKeyLength, b->h, (void **) &srczv) == SUCCESS) { 
     255            zval **zv = (zval **) b->pData; 
     256            if (*srczv == *zv) { 
     257                return ZEND_HASH_APPLY_REMOVE; 
     258            } 
     259        } 
     260    } 
     261    return ZEND_HASH_APPLY_KEEP; 
     262} 
     263/* }}} */ 
     264/* fix static members on restore */ 
     265static void inherit_static_prop(zval **p) /* {{{ */ 
     266{ 
     267    (*p)->refcount++; 
     268    (*p)->is_ref = 1; 
     269} 
     270/* }}} */ 
     271static void xc_fix_static_members(xc_processor_t *processor, zend_class_entry *dst TSRMLS_DC) /* {{{ */ 
     272{ 
     273    zend_class_entry *parent_ce = dst->parent; 
     274    if (parent_ce->type != dst->type) { 
     275        /* User class extends internal class */ 
     276        zend_update_class_constants(parent_ce  TSRMLS_CC); 
     277        zend_hash_merge(&dst->default_static_members, CE_STATIC_MEMBERS(parent_ce), (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0); 
     278    } 
     279    else { 
     280        zend_hash_merge(&dst->default_static_members, &parent_ce->default_static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0); 
     281    } 
     282 
     283    /* 
     284    HashPosition pos; 
     285    HashTable *pmembers = CE_STATIC_MEMBERS(dst->parent); 
     286    zval **zv; 
     287    for (zend_hash_internal_pointer_reset_ex(pmembers, &pos); 
     288            zend_hash_get_current_data_ex(pmembers, (void **) &zv, &pos) == SUCCESS; 
     289            zend_hash_move_forward_ex(pmembers, &pos)) { 
     290            if (zend_hash_quick_find(parent->static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
     291            } 
     292    } 
     293    */ 
     294} 
     295/* }}} */ 
    249296#endif 
    250297/* {{{ call op_array ctor handler */ 
Note: See TracChangeset for help on using the changeset viewer.