Show
Ignore:
Timestamp:
02/25/10 11:54:31 (5 months ago)
Author:
hans
Message:
  • Fixed class static variable restore where parent was protected
    static and child was public static. This would lead to error
    'Access to undeclared static property' upon restore from cache
  • Added proper handling of class properties during storing in
    cache. Public/private/protected is properly handled now. Somehow
    this was a long overdue TODO spotted by running the testsuite.
    This fixes ticket #408
  • Small fix that solves some issues with lambda (closure)
    functions. This solves ticket #405
Files:

Legend:

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

    r409 r411  
     12010-02-25      Hans Rakers <hans at react.nl> 
     2 
     3                * Fixed class static variable restore where parent was protected 
     4                  static and child was public static. This would lead to error 
     5                  'Access to undeclared static property' upon restore from cache 
     6                * Added proper handling of class properties during storing in 
     7                  cache. Public/private/protected is properly handled now. Somehow 
     8                  this was a long overdue TODO spotted by running the testsuite. 
     9                  This fixes ticket #408 
     10                * Small fix that solves some issues with lambda (closure) 
     11                  functions. This solves ticket #405 
     12 
    1132010-02-24      Hans Rakers <hans at react.nl> 
    214 
  • eaccelerator/trunk/ea_store.c

    r375 r411  
    672672 * 
    673673 * Most of the logic behind all this can be found in zend_compile.c, functions zend_do_inheritance and 
    674  * zend_do_inherit_property_access_check 
     674 * do_inherit_property_access_check 
    675675*/ 
    676676static int store_property_access_check(Bucket * p, zend_class_entry * from_ce) 
     
    678678    zend_class_entry *from = from_ce; 
    679679    zend_class_entry *parent = from->parent; 
    680      
    681     if (parent) { 
    682         // hra: TODO - do some usefull stuff :) 
    683         // check for ACC_PRIVATE etc. 
    684         // for now, just return keep 
     680    zend_property_info* child_info = (zend_property_info*)p->pData; 
     681    zend_property_info* parent_info = NULL;  
     682 
     683    return (child_info->ce != from); 
     684 
     685    if (parent && zend_hash_quick_find(&parent->properties_info, p->arKey, p->nKeyLength, p->h, (void **) &parent_info)==SUCCESS) { 
     686      if(parent_info->flags & ZEND_ACC_PRIVATE) { 
     687        return ZEND_HASH_APPLY_KEEP; 
     688      } 
     689      /* if public/private/protected mask differs: copy, else let zend_do_inheritance handle this */ 
     690      if((parent_info->flags & ZEND_ACC_PPP_MASK) != (child_info->flags & ZEND_ACC_PPP_MASK)) { 
     691        return ZEND_HASH_APPLY_KEEP; 
     692      } 
     693      return ZEND_HASH_APPLY_REMOVE; 
    685694    } 
    686695    return ZEND_HASH_APPLY_KEEP; 
     
    714723        if((zend_hash_find(&parent->properties_info, mname, strlen(mname)+1, &pinfo.ptr) == SUCCESS) && 
    715724            (zend_hash_find(&from->properties_info, mname, strlen(mname)+1, &cinfo.ptr) == SUCCESS)) { 
    716             /* don't copy this static property if protected in parent and static public in child. 
    717                inheritance will handle this properly on restore */ 
    718             if(cinfo.v->flags & ZEND_ACC_STATIC && (pinfo.v->flags & ZEND_ACC_PROTECTED && cinfo.v->flags & ZEND_ACC_PUBLIC)) { 
    719                 return ZEND_HASH_APPLY_REMOVE; 
    720             } 
    721725            /* If the static member points to the same value in parent and child, remove for proper inheritance during restore */ 
    722726            if(zend_hash_quick_find(&parent->default_static_members, p->arKey, p->nKeyLength, p->h, &pprop.ptr) == SUCCESS) { 
  • eaccelerator/trunk/opcodes.c

    r377 r411  
    220220  OPDEF("UNDEF-151",                EXT_UNUSED | OP1_UNUSED | OP2_UNUSED | RES_UNUSED), /* 151 */ 
    221221  OPDEF("JMP_SET",                  EXT_UNUSED | OP1_STD    | OP2_JMPADDR| RES_TMP),    /* 152 */ 
    222   OPDEF("DECLARE_LAMBDA_FUNCTION",  EXT_UNUSED | OP1_STD    | OP2_STD    | RES_UNUSED)  /* 153 */ 
     222  OPDEF("DECLARE_LAMBDA_FUNCTION",  EXT_UNUSED | OP1_STD    | OP2_STD    | RES_TMP)     /* 153 */ 
    223223# endif 
    224224};