Changeset 66

Show
Ignore:
Timestamp:
04/26/05 22:57:20 (4 years ago)
Author:
zoeloelip
Message:

This patches wasn't included in the last commit:
* Patch 1166707 loader patch for OOP functions in PHP5 (only rapidly tested but also seemed ok to segv)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • eaccelerator/trunk/loader.c

    r61 r66  
    33   | eAccelerator project                                                 | 
    44   +----------------------------------------------------------------------+ 
    5    | Copyright (c) 2004 eAccelerator                                      | 
    6    | http://eaccelerator.sourceforge.net                                  | 
     5   | Copyright (c) 2004 - 2005 eAccelerator                               | 
     6   | http://eaccelerator.net                                                     | 
    77   +----------------------------------------------------------------------+ 
    88   | This program is free software; you can redistribute it and/or        | 
     
    641641          case RES_CLASS: 
    642642            opline->result.u.var = decode_var(to->T, p, l); 
     643            opline->result.op_type = IS_CONST; 
    643644            break; 
    644645          case RES_VAR: 
     
    835836  s = decode_lstr(&len, p, l); 
    836837  if (s != NULL) { 
    837     if (zend_hash_find(CG(class_table), s, len+1, (void **)&to->parent) != SUCCESS) { 
     838        char* r; 
     839        r = zend_str_tolower_dup(s, len); 
     840    if (zend_hash_find(CG(class_table), r, len+1, (void **)&to->parent) != SUCCESS) { 
    838841/*??? 
    839842      debug_printf("[%d] EACCELERATOR can't restore parent class " 
     
    860863#endif 
    861864    } 
     865        efree(r); 
    862866    efree(s); 
    863867  } 
     
    934938  decode_hash(&to->function_table, sizeof(zend_op_array), (decode_bucket_t)decode_op_array, p, l TSRMLS_CC); 
    935939  to->constants_updated = 0; 
     940 
     941#ifdef ZEND_ENGINE_2 /* patch from "Juan M. de la Torre" <juan.torre@iron-gate.net> */ 
     942  { 
     943    zend_function *f; 
     944    Bucket *p; 
     945    int fname_len, cname_len; 
     946    char *fname_lc, *cname_lc; 
     947 
     948    cname_len = to->name_length; 
     949    cname_lc  = zend_str_tolower_dup(to->name, cname_len); 
     950 
     951    to->constructor = to->destructor = to->clone = to->__get = to->__set = to->__call = NULL; 
     952 
     953    p = to->function_table.pListHead; 
     954    while (p != NULL) { 
     955      f         = p->pData; 
     956      fname_len = strlen(f->common.function_name); 
     957      fname_lc  = zend_str_tolower_dup(f->common.function_name, fname_len); 
     958 
     959      if (fname_len == cname_len && !memcmp(fname_lc, cname_lc, fname_len)) 
     960        to->constructor = (zend_function*)f; 
     961      else if (fname_lc[0] == '_' && fname_lc[1] == '_') 
     962      { 
     963        if (fname_len == sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)-1 && memcmp(fname_lc, ZEND_CONSTRUCTOR_FUNC_NAME, sizeof(ZEND_CONSTRUCTOR_FUNC_NAME)) == 0)  
     964          to->constructor = (zend_function*)f; 
     965        else if (fname_len == sizeof(ZEND_DESTRUCTOR_FUNC_NAME)-1 && memcmp(fname_lc, ZEND_DESTRUCTOR_FUNC_NAME, sizeof(ZEND_DESTRUCTOR_FUNC_NAME)) == 0) 
     966          to->destructor = (zend_function*)f; 
     967        else if (fname_len == sizeof(ZEND_CLONE_FUNC_NAME)-1 && memcmp(fname_lc, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)) == 0) 
     968          to->clone = (zend_function*)f; 
     969        else if (fname_len == sizeof(ZEND_GET_FUNC_NAME)-1 && memcmp(fname_lc, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)) == 0) 
     970          to->__get = (zend_function*)f; 
     971        else if (fname_len == sizeof(ZEND_SET_FUNC_NAME)-1 && memcmp(fname_lc, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)) == 0) 
     972          to->__set = (zend_function*)f; 
     973        else if (fname_len == sizeof(ZEND_CALL_FUNC_NAME)-1 && memcmp(fname_lc, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)) == 0) 
     974          to->__call = (zend_function*)f; 
     975      } 
     976      efree(fname_lc); 
     977      p = p->pListNext; 
     978    } 
     979  } 
     980#endif 
    936981 
    937982  MMCG(class_entry) = old;