Changeset 1252


Ignore:
Timestamp:
2013-05-27T17:01:50+02:00 (18 months ago)
Author:
moo
Message:

fixes #307: compatible with Zend Debugger which requires to be installed after Zend Extension Manager

Location:
branches/3.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0

    • Property svn:mergeinfo changed
      /trunkmerged: 1251
  • branches/3.0/ChangeLog

    r1246 r1252  
    66 * fixes #296: Multiple instances of the same software causes PHP "cannot redeclare class" errors when readonly_protection is not in use 
    77 * fixes #301: refix locking impl 
     8 * fixes #307: compatible with Zend Debugger which requires to be installed after Zend Extension Manager 
    89 
    9103.0.1 2013-01-11 
  • branches/3.0/NEWS

    r1239 r1252  
    33 * bug fixes 
    44 * "cannot redeclare class" errors is now gone. Can also be avoid by using readonly_protection (unavailable with /dev/zero). 
     5 * fixes SEGV with Zend Debugger 
    56 
    673.0.1 2013-01-11 
  • branches/3.0/xcache.c

    r1231 r1252  
    5656} 
    5757/* }}} */ 
     58 
     59/* devel helper function */ 
     60#if 0 
     61static void xc_list_extensions() /* {{{ */ 
     62{ 
     63    zend_llist_element *element; 
     64    zend_extension *ext; 
     65    fprintf(stderr, "extensions:\n"); 
     66    for (element = zend_extensions.head; element; element = element->next) { 
     67        ext = (zend_extension *) element->data; 
     68        fprintf(stderr, " - %s\n", ext->name); 
     69    } 
     70} 
     71/* }}} */ 
     72#endif 
    5873 
    5974/* module helper function */ 
     
    567582} xc_incompatible_zend_extension_info_t; 
    568583static xc_incompatible_zend_extension_info_t xc_incompatible_zend_extensions[] = { 
     584    { "Zend Extension Manager", NULL }, 
    569585    { "Zend Optimizer", NULL }, 
    570586    { "the ionCube PHP Loader", NULL } 
    571587}; 
    572 zend_llist_element **xc_zend_extension_elements; 
    573588 
    574589static xc_incompatible_zend_extension_info_t *xc_get_incompatible_zend_extension_info(const char *name) 
     
    603618    int status; 
    604619    zend_bool catched = 0; 
    605     zend_llist old_zend_extensions; 
     620    zend_llist saved_zend_extensions_container; /* without elements */ 
     621    zend_llist_element **saved_zend_extensions_elments; 
     622    size_t new_zend_extensions_elments_count; 
     623    zend_llist_element **new_zend_extensions_elments; 
    606624    zend_extension *ext; 
    607625    size_t i; 
     
    609627    TSRMLS_FETCH(); 
    610628 
    611     /* restore */ 
     629    /* restore startup hack */ 
    612630    extension->startup = incompatible_zend_extension_info->old_startup; 
    613631    incompatible_zend_extension_info->old_startup = NULL; 
    614632    assert(extension->startup); 
    615633 
    616     /* save */ 
    617     assert(!xc_zend_extension_elements); 
    618     old_zend_extensions = zend_extensions; 
    619     xc_zend_extension_elements = malloc(sizeof(zend_llist_element *) * old_zend_extensions.count); 
    620     for (i = 0, element = old_zend_extensions.head; element; ++i, element = element->next) { 
    621         xc_zend_extension_elements[i] = element; 
     634    /* save extensions list */ 
     635    saved_zend_extensions_container = zend_extensions; 
     636    saved_zend_extensions_elments = malloc(sizeof(zend_llist_element *) * saved_zend_extensions_container.count); 
     637    for (i = 0, element = saved_zend_extensions_container.head; element; ++i, element = element->next) { 
     638        saved_zend_extensions_elments[i] = element; 
    622639    } 
    623640 
     
    627644    zend_extensions.count = 0; 
    628645 
    629     for (i = 0; i < old_zend_extensions.count; ++i) { 
    630         element = xc_zend_extension_elements[i]; 
     646    for (i = 0; i < saved_zend_extensions_container.count; ++i) { 
     647        element = saved_zend_extensions_elments[i]; 
    631648        element->next = element->prev = NULL; 
    632649 
     
    646663    } zend_end_try(); 
    647664 
    648     /* restore */ 
    649     zend_extensions = old_zend_extensions; 
     665    /* save newly added extensions added by this extension*/ 
     666    new_zend_extensions_elments_count = zend_extensions.count - 1; 
     667    new_zend_extensions_elments = NULL; 
     668    if (new_zend_extensions_elments_count) { 
     669        new_zend_extensions_elments = malloc(sizeof(zend_llist_element *) * new_zend_extensions_elments_count); 
     670        element = zend_extensions.head; 
     671        for (i = 0, element = element->next; element; ++i, element = element->next) { 
     672            new_zend_extensions_elments[i] = element; 
     673        } 
     674    } 
     675 
     676    /* restore original extension list*/ 
     677    zend_extensions = saved_zend_extensions_container; 
    650678    zend_extensions.head = NULL; 
    651679    zend_extensions.tail = NULL; 
    652680    zend_extensions.count = 0; 
    653     for (i = 0; i < old_zend_extensions.count; ++i) { 
    654         element = xc_zend_extension_elements[i]; 
     681    for (i = 0; i < saved_zend_extensions_container.count; ++i) { 
     682        element = saved_zend_extensions_elments[i]; 
    655683        element->next = element->prev = NULL; 
    656684 
    657685        xc_zend_llist_add_element(&zend_extensions, element); 
    658686        ++zend_extensions.count; 
    659     } 
    660  
    661     free(xc_zend_extension_elements); 
    662     xc_zend_extension_elements = NULL; 
     687 
     688        ext = (zend_extension *) element->data; 
     689        if (ext == extension && new_zend_extensions_elments_count) { 
     690            /* add new created extension */ 
     691            size_t j; 
     692            for (j = 0; j < new_zend_extensions_elments_count; ++j) { 
     693                element = new_zend_extensions_elments[j]; 
     694                element->next = element->prev = NULL; 
     695 
     696                xc_zend_llist_add_element(&zend_extensions, element); 
     697                ++zend_extensions.count; 
     698            } 
     699        } 
     700    } 
     701    free(saved_zend_extensions_elments); 
     702    if (new_zend_extensions_elments) { 
     703        free(new_zend_extensions_elments); 
     704    } 
    663705 
    664706    if (catched) { 
Note: See TracChangeset for help on using the changeset viewer.