Changeset 498 in svn for trunk


Ignore:
Timestamp:
2008-01-04T15:05:12+01:00 (8 years ago)
Author:
Xuefer
Message:

PHP_5_3: deep copy arg_info which is modified by executor

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/processor/processor.m4

    r496 r498  
    504504    dnl readonly_protection=on
    505505    dnl main op_array && have early binding
     506    zend_uint ii;
    506507    if (!processor->readonly_protection && !(src == processor->php_src->op_array && processor->php_src->have_early_binding)) {
    507508        /* really fast shallow copy */
     
    510511        /* deep */
    511512        STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
     513        STRUCT_ARRAY_I(num_args, zend_arg_info, arg_info)
     514        xc_gc_add_op_array(dst TSRMLS_CC);
    512515        define(`SKIPASSERT_ONCE')
    513516    }
  • trunk/xcache.c

    r496 r498  
    14771477/* }}} */
    14781478
     1479/* {{{ xc_gc_op_array_t */
     1480typedef struct {
     1481    zend_uint num_args;
     1482    zend_arg_info *arg_info;
     1483} xc_gc_op_array_t;
     1484/* }}} */
     1485void xc_gc_add_op_array(zend_op_array *op_array TSRMLS_DC) /* {{{ */
     1486{
     1487    xc_gc_op_array_t gc_op_array;
     1488    gc_op_array.num_args = op_array->num_args;
     1489    gc_op_array.arg_info = op_array->arg_info;
     1490    zend_hash_next_index_insert(&XG(gc_op_arrays), (void *) &gc_op_array, sizeof(gc_op_array), NULL);
     1491}
     1492/* }}} */
     1493static void xc_gc_op_array(void *pDest) /* {{{ */
     1494{
     1495    xc_gc_op_array_t *op_array = (xc_gc_op_array_t *) pDest;
     1496    zend_uint i;
     1497    if (op_array->arg_info) {
     1498        for (i = 0; i < op_array->num_args; i++) {
     1499            efree((char*)op_array->arg_info[i].name);
     1500            if (op_array->arg_info[i].class_name) {
     1501                efree((char*)op_array->arg_info[i].class_name);
     1502            }
     1503        }
     1504        efree(op_array->arg_info);
     1505    }
     1506}
     1507/* }}} */
     1508
    14791509/* module helper function */
    14801510static int xc_init_constant(int module_number TSRMLS_DC) /* {{{ */
     
    17111741    }
    17121742
     1743    zend_hash_init(&XG(gc_op_arrays), 32, NULL, xc_gc_op_array, 0);
     1744
    17131745#if PHP_API_VERSION <= 20041225
    17141746    XG(request_time) = time(NULL);
     
    17251757{
    17261758    xc_entry_unholds(TSRMLS_C);
     1759    zend_hash_destroy(&XG(gc_op_arrays));
    17271760    xc_gc_expires_php(TSRMLS_C);
    17281761    xc_gc_expires_var(TSRMLS_C);
  • trunk/xcache.h

    r496 r498  
    361361int xc_is_ro(const void *p);
    362362int xc_is_shm(const void *p);
     363void xc_gc_add_op_array(zend_op_array *op_array TSRMLS_DC);
    363364
    364365#endif /* __XCACHE_H */
  • trunk/xcache_globals.h

    r496 r498  
    1818    long   var_ttl;
    1919
     20    HashTable gc_op_arrays;
     21
    2022    HashTable internal_function_table;
    2123    HashTable internal_class_table;
Note: See TracChangeset for help on using the changeset viewer.