Changeset 167

Show
Ignore:
Timestamp:
02/20/06 14:50:37 (3 years ago)
Author:
hrak
Message:

Fixed ZE1 (<=PHP4) problem regarding parent class lookup during restore. Parent classname wasn't lowercased before lookup in class_table. This also fixes bug #1432758 (can't restore parent class "stdClass" of class xyz)

Files:

Legend:

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

    r166 r167  
    33        * Fixed static_members handling for php-5.0. Broke this while 
    44          working on PHP-5.1 support. Lost in ifdef statements ;) 
     5        * Fixed ZE1 (<=PHP4) problem regarding parent class lookup during restore. 
     6          Parent classname wasn't lowercased before lookup in class_table. This 
     7          also fixes bug #1432758 (can't restore parent class "stdClass" of class xyz) 
    58 
    692006-02-19  Hans Rakers <hans at parse dot nl> 
  • eaccelerator/trunk/ea_restore.c

    r165 r167  
    721721        ea_debug_printf(EA_DEBUG, "restore_class_parent: restoring parent class %s of class %s\n", (char *) parent, to->name); 
    722722#ifdef ZEND_ENGINE_2 
    723 /*      char *name_lc = zend_str_tolower_dup(parent, len); 
    724         if (zend_hash_find(CG(class_table), (void *) name_lc, len + 1, (void **) &to->parent) != SUCCESS)*/ 
    725723        zend_class_entry** parent_ptr = NULL; 
    726724        if (zend_lookup_class(parent, len, &parent_ptr TSRMLS_CC) != SUCCESS) 
    727725#else 
    728         if (zend_hash_find(CG(class_table), (void *) parent, len + 1, (void **) &to->parent) != SUCCESS) 
     726        ea_debug_hash_display(CG(class_table)); 
     727        char *name_lc = estrndup(parent, len); 
     728        zend_str_tolower(name_lc, len); 
     729        if (zend_hash_find(CG(class_table), (void *) name_lc, len + 1, (void **) &to->parent) != SUCCESS) 
    729730#endif 
    730731        { 
     
    733734                to->parent = NULL; 
    734735        } else { 
    735 #ifdef ZEND_ENGINE_2 
    736                 /* inherit parent methods */ 
     736                /* parent found */ 
     737#ifdef ZEND_ENGINE_2 
    737738                to->parent = *parent_ptr; 
     739                to->constructor = to->parent->constructor; 
     740                to->destructor = to->parent->destructor; 
     741                to->clone = to->parent->clone; 
     742#endif 
    738743                to->parent->refcount++; 
    739744                ea_debug_printf(EA_DEBUG, "restore_class_parent: found parent %s..\n", to->parent->name); 
    740745                ea_debug_printf(EA_DEBUG, "restore_class_parent: parent type=%d child type=%d\n", to->parent->type, to->type); 
    741                 to->constructor = to->parent->constructor; 
    742                 to->destructor = to->parent->destructor; 
    743                 to->clone = to->parent->clone; 
    744 /*              to->__get = to->parent->__get; 
    745                 to->__set = to->parent->__set; 
    746 #  ifdef ZEND_ENGINE_2_1 
    747                 to->__unset = to->parent->__unset; 
    748                 to->__isset = to->parent->__isset; 
    749                 to->serialize_func = to->parent->serialize_func; 
    750                 to->unserialize_func = to->parent->unserialize_func; 
    751 #  endif 
    752                 to->__call = to->parent->__call; 
    753                 to->create_object = to->parent->create_object; 
    754 #else 
    755                 to->handle_property_get = to->parent->handle_property_get; 
    756                 to->handle_property_set = to->parent->handle_property_set; 
    757                 to->handle_function_call = to->parent->handle_function_call;*/ 
    758 #endif 
    759         } 
    760 #ifdef ZEND_ENGINE_2 
    761         /*efree(name_lc);*/ 
     746        } 
     747#ifndef ZEND_ENGINE_2 
     748        efree(name_lc); 
    762749#endif 
    763750}