Changeset 195

Show
Ignore:
Timestamp:
04/06/06 18:49:25 (3 years ago)
Author:
hans
Message:

Fixed handling of interfaces. This fixes sf.net bug #1440575

Files:

Legend:

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

    r194 r195  
     12006-04-06  Hans Rakers <hans at parse dot nl> 
     2 
     3        * Fixed handling of interfaces. This fixes sf.net bug #1440575. 
     4          This fix also introduces some changes in the cached object structure 
     5          so remember to empty your disk caches if you have them. This is 
     6          always a good thing to do after upgrading btw :) 
     7 
    182006-04-06  Hans Rakers <hans at parse dot nl> 
    29 
  • eaccelerator/trunk/ea_restore.c

    r180 r195  
    827827        to->ce_flags = from->ce_flags; 
    828828        to->num_interfaces = from->num_interfaces; 
     829        to->interfaces = NULL; 
     830 
    829831        if (to->num_interfaces > 0) { 
    830832                /* hrak: Allocate the slots which will later be populated by ZEND_ADD_INTERFACE */ 
    831833                to->interfaces = (zend_class_entry **) emalloc(sizeof(zend_class_entry *) * to->num_interfaces); 
    832834                memset(to->interfaces, 0, sizeof(zend_class_entry *) * to->num_interfaces); 
    833         } else { 
    834                 to->interfaces = NULL; 
    835         } 
    836  
    837         to->iterator_funcs = from->iterator_funcs; 
    838         to->create_object = from->create_object; 
    839         to->get_iterator = from->get_iterator; 
    840         to->interface_gets_implemented = from->interface_gets_implemented; 
     835        } 
    841836#endif 
    842837 
  • eaccelerator/trunk/ea_store.c

    r187 r195  
    837837{ 
    838838        eaccelerator_class_entry *to; 
     839        unsigned int i; 
     840 
    839841        EACCELERATOR_ALIGN(EAG(mem)); 
    840842        to = (eaccelerator_class_entry *) EAG(mem); 
     
    847849        to->ce_flags = from->ce_flags; 
    848850        to->static_members = NULL; 
    849         to->num_interfaces = from->num_interfaces; 
    850         /* hrak: no need to really store the interfaces since these get populated 
    851          * at/after restore by zend_do_inheritance and ZEND_ADD_INTERFACE */ 
    852         to->interfaces = NULL; 
     851 
     852        /* 
     853         * Scan the interfaces looking for the first one which isn't 0 
     854         * This is the first inherited interface and should not be counted in the stored object 
     855         */ 
     856        for (i = 0 ; i < from->num_interfaces ; i++) { 
     857                if (from->interfaces[i] != 0) { 
     858                        break; 
     859                } 
     860        } 
     861        to->num_interfaces = i; 
     862        DBG(ea_debug_printf, (EA_DEBUG, "from->num_interfaces=%d, to->num_interfaces=%d\n", from->num_interfaces, to->num_interfaces)); 
     863 
     864        /* 
     865         * hrak: no need to really store the interfaces since these get populated 
     866         * at/after restore by zend_do_inheritance and ZEND_ADD_INTERFACE 
     867         */ 
    853868#endif 
    854869 
     
    870885        to->line_end = from->line_end; 
    871886        to->doc_comment_len = from->doc_comment_len; 
    872         to->iterator_funcs = from->iterator_funcs; 
    873         to->create_object = from->create_object; 
    874         to->get_iterator = from->get_iterator; 
    875         to->interface_gets_implemented = from->interface_gets_implemented; 
    876887 
    877888        if (from->filename != NULL) 
  • eaccelerator/trunk/eaccelerator.h

    r191 r195  
    240240        zend_uint num_interfaces; 
    241241 
    242         char **interfaces; 
    243         zend_class_iterator_funcs iterator_funcs; 
    244  
    245         /* handlers */ 
    246         zend_object_value (*create_object) (zend_class_entry *class_type TSRMLS_DC); 
    247         zend_object_iterator *(*get_iterator) (zend_class_entry *ce, zval *object TSRMLS_DC); 
    248         int (*interface_gets_implemented) (zend_class_entry *iface, zend_class_entry *class_type TSRMLS_DC);    /* a class implements this interface */ 
    249  
    250         /* hra: serializer callbacks may need to be added here in the future for php 5.1 */ 
    251  
    252242        char *filename; 
    253243        zend_uint line_start;