Changeset 588 in svn for trunk/xcache.c


Ignore:
Timestamp:
2009-04-01T08:06:38Z (6 years ago)
Author:
Xuefer
Message:

handle compile time new constant. fixed #208: null as default value for parameters with array type hint produces a fatal error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/xcache.c

    r572 r588  
    18491849}
    18501850/* }}} */
     1851static void xc_copy_zend_constant(zend_constant *c) /* {{{ */
     1852{
     1853    c->name = zend_strndup(c->name, c->name_len - 1);
     1854    if (!(c->flags & CONST_PERSISTENT)) {
     1855        zval_copy_ctor(&c->value);
     1856    }
     1857}
     1858/* }}} */
    18511859static void xc_request_init(TSRMLS_D) /* {{{ */
    18521860{
     
    18541862
    18551863    if (!XG(internal_table_copied)) {
     1864#ifdef HAVE_XCACHE_CONSTANT
     1865        zend_constant tmp_const;
     1866#endif
    18561867        zend_function tmp_func;
    18571868        xc_cest_t tmp_cest;
    18581869
     1870#ifdef HAVE_XCACHE_CONSTANT
     1871        zend_hash_destroy(&XG(internal_constant_table));
     1872#endif
    18591873        zend_hash_destroy(&XG(internal_function_table));
    18601874        zend_hash_destroy(&XG(internal_class_table));
    18611875
     1876#ifdef HAVE_XCACHE_CONSTANT
     1877        zend_hash_init_ex(&XG(internal_constant_table), 20,  NULL, NULL, 1, 0);
     1878#endif
    18621879        zend_hash_init_ex(&XG(internal_function_table), 100, NULL, NULL, 1, 0);
    18631880        zend_hash_init_ex(&XG(internal_class_table),    10,  NULL, NULL, 1, 0);
    18641881
     1882#ifdef HAVE_XCACHE_CONSTANT
     1883        zend_hash_copy(&XG(internal_constant_table), EG(zend_constants), (copy_ctor_func_t) xc_copy_zend_constant, &tmp_const, sizeof(tmp_const));
     1884#endif
    18651885        zend_hash_copy(&XG(internal_function_table), CG(function_table), NULL, &tmp_func, sizeof(tmp_func));
    18661886        zend_hash_copy(&XG(internal_class_table), CG(class_table), NULL, &tmp_cest, sizeof(tmp_cest));
     
    19211941    memset(xcache_globals, 0, sizeof(zend_xcache_globals));
    19221942
     1943#ifdef HAVE_XCACHE_CONSTANT
     1944    zend_hash_init_ex(&xcache_globals->internal_constant_table, 1, NULL, NULL, 1, 0);
     1945#endif
    19231946    zend_hash_init_ex(&xcache_globals->internal_function_table, 1, NULL, NULL, 1, 0);
    19241947    zend_hash_init_ex(&xcache_globals->internal_class_table,    1, NULL, NULL, 1, 0);
     
    19521975
    19531976    if (xcache_globals->internal_table_copied) {
     1977#ifdef HAVE_XCACHE_CONSTANT
     1978        zend_hash_destroy(&xcache_globals->internal_constant_table);
     1979#endif
    19541980        zend_hash_destroy(&xcache_globals->internal_function_table);
    19551981        zend_hash_destroy(&xcache_globals->internal_class_table);
Note: See TracChangeset for help on using the changeset viewer.