Changeset 627


Ignore:
Timestamp:
2009-07-05T11:24:38+02:00 (5 years ago)
Author:
moo
Message:

merged r585:592 from trunk

Location:
branches/1.3
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/Makefile.frag

    r620 r627  
    1515 
    1616$(XCACHE_PROC_OUT): $(XCACHE_PROC_SRC) $(XCACHE_STRUCTINFO_OUT) $(XCACHE_PROC_SOURCES) 
    17     $(M4) -D srcdir="$(srcdir)" -D builddir="$(builddir)" $(XCACHE_ENABLE_TEST) $(XCACHE_PROC_SRC) > $(XCACHE_PROC_OUT).tmp 
     17    $(M4) -D srcdir='`'"$(srcdir)'" -D builddir='`'"$(builddir)'" $(XCACHE_ENABLE_TEST) $(XCACHE_PROC_SRC) > $(XCACHE_PROC_OUT).tmp 
    1818    mv -f $(XCACHE_PROC_OUT).tmp $(XCACHE_PROC_OUT) 
    1919 
     
    3939 
    4040xcachetest: 
     41    $(SED) "s#\\./modules/#$(top_builddir)/modules/#" < $(srcdir)/xcache-test.ini > $(top_builddir)/tmp-php.ini 
    4142    TEST_PHP_SRCDIR=$(top_srcdir) \ 
    4243    CC="$(CC)" \ 
    43         $(srcdir)/run-xcachetest -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php $(TESTS) $(TEST_ARGS) -c $(srcdir)/xcache-test.ini 
     44        $(srcdir)/run-xcachetest -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php $(TESTS) $(TEST_ARGS) -c $(top_builddir)/tmp-php.ini 
  • branches/1.3/admin/config.php.example

    r623 r627  
    1616// do not define both with 
    1717// $free_graph_width = 120; 
     18 
     19// only enable if you have password protection for admin page 
     20// enabling this option will cause user to eval() whatever code they want 
     21$enable_eval = false; 
    1822 
    1923// this function is detected by xcache.tpl.php, and enabled if function_exists 
  • branches/1.3/admin/edit.php

    r607 r627  
    1212 
    1313if ($_SERVER['REQUEST_METHOD'] == 'POST') { 
    14     eval('$value = ' . $_POST['value']); 
     14    if ($enable_eval) { 
     15        eval('$value = ' . $_POST['value']); 
     16    } 
     17    else { 
     18        $value = $_POST['value']; 
     19    } 
    1520    xcache_set($name, $value); 
    1621    header("Location: xcache.php?type=" . XC_TYPE_VAR); 
    1722    exit; 
    1823} 
    19 $value = var_export(xcache_get($name), true); 
     24$value = xcache_get($name); 
     25if ($enable_eval) { 
     26    $value = var_export($value, true); 
     27    $editable = true; 
     28} 
     29else { 
     30    if (is_string($value)) { 
     31        $editable = true; 
     32    } 
     33    else { 
     34        $editable = false; 
     35        $value = var_export($value, true); 
     36    } 
     37} 
    2038 
    2139$xcache_version = XCACHE_VERSION; 
  • branches/1.3/admin/edit.tpl.php

    r604 r627  
    77    <fieldset> 
    88        <legend><?php echo sprintf(_T("Editing Variable %s"), $h_name); ?></legend> 
    9         <textarea name="value" style="width: 100%; height: 200px; overflow-y: auto"><?php echo $h_value; ?></textarea><br> 
     9        <textarea name="value" style="width: 100%; height: 200px; overflow-y: auto" <?php echo $editable ? "" : "disabled=disabled"; ?>><?php echo $h_value; ?></textarea><br> 
    1010        <input type="submit"> 
    1111    </fieldset> 
  • branches/1.3/run-xcachetest

    r623 r627  
    11#!/bin/sh 
     2 
     3getAbsolutePath() { 
     4    which readlink >/dev/null 2>&1 && readlink -f "$@" || echo "$@" 
     5} 
    26 
    37# use symlink first 
    48if test -x ./php-cli ; then 
    5     php_cli=./php-cli 
     9    php_cli=`getAbsolutePath ./php-cli` 
    610elif test ! -z "$TEST_PHP_EXECUTABLE" && test -x "$TEST_PHP_EXECUTABLE"; then 
    711    php_cli="$TEST_PHP_EXECUTABLE" 
     
    1115 
    1216if test -x ./php-cgi ; then 
    13     php_cgi=./php-cgi 
     17    php_cgi=`getAbsolutePath ./php-cgi` 
    1418else 
    1519    php_cgi="`which php-cgi`" 
    1620fi 
    1721 
    18 test -z "$PHP_SRC" && PHP_SRC=./php-src 
    19 if test -z "$TEST_PHP_USER" ; then 
    20     TEST_PHP_USER="$PHP_SRC/tests" 
    21     for i in Zend ZendEngine2 ext/standard/tests ext/reflection/tests ext/spl/tests; do 
    22         if test -d "$PHP_SRC/$i" ; then 
    23             TEST_PHP_USER="$TEST_PHP_USER,$PHP_SRC/$i" 
    24         fi 
    25     done 
    26 fi 
     22test -z "$PHP_SRC" && PHP_SRC=`getAbsolutePath ./php-src` 
    2723 
    2824TEST_PHP_EXECUTABLE="$php_cli" 
    2925TEST_PHP_CGI_EXECUTABLE="$php_cgi" 
     26TEST_PHP_SRCDIR="$PHP_SRC" 
    3027 
     28export TEST_PHP_EXECUTABLE 
    3129export TEST_PHP_CGI_EXECUTABLE 
    32 export TEST_PHP_EXECUTABLE 
    33 export TEST_PHP_USER 
     30export TEST_PHP_SRCDIR 
    3431 
    3532echo "XCache test running with:" 
    3633echo "TEST_PHP_CGI_EXECUTABLE: $TEST_PHP_CGI_EXECUTABLE" 
    3734echo "TEST_PHP_EXECUTABLE:     $TEST_PHP_EXECUTABLE" 
    38 echo "TEST_PHP_USER:           $TEST_PHP_USER" 
    3935 
    4036exec "$php_cli" "$@" 
  • branches/1.3/utils.c

    r625 r627  
    598598#endif 
    599599 
     600static void xc_copy_zend_constant(zend_constant *c) /* {{{ */ 
     601{ 
     602    c->name = zend_strndup(c->name, c->name_len - 1); 
     603    if (!(c->flags & CONST_PERSISTENT)) { 
     604        zval_copy_ctor(&c->value); 
     605    } 
     606} 
     607/* }}} */ 
    600608xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, char *filename TSRMLS_DC) /* {{{ */ 
    601609{ 
     
    635643    h = OG(zend_constants); 
    636644    zend_hash_init_ex(&TG(zend_constants),  20, NULL, h->pDestructor, h->persistent, h->bApplyProtection); 
     645    { 
     646        zend_constant tmp_const; 
     647        zend_hash_copy(&TG(zend_constants), &XG(internal_constant_table), (copy_ctor_func_t) xc_copy_zend_constant, (void *) &tmp_const, sizeof(tmp_const)); 
     648    } 
    637649#endif 
    638650    h = OG(function_table); 
     
    677689    /* Using ZEND_COMPILE_IGNORE_INTERNAL_CLASSES for ZEND_FETCH_CLASS_RT_NS_CHECK 
    678690     */ 
    679     CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_DELAYED_BINDING; 
     691    CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION | ZEND_COMPILE_DELAYED_BINDING; 
    680692#endif 
    681693 
     
    696708 
    697709#ifdef HAVE_XCACHE_CONSTANT 
    698     b = TG(zend_constants).pListHead; 
     710    b = /*TG(internal_constant_tail) ? TG(internal_constant_tail)->pListNext :*/ TG(zend_constants).pListHead; 
    699711    /* install constants */ 
    700712    while (b != NULL) { 
  • branches/1.3/utils.h

    r625 r627  
    9595    HashTable tmp_class_table; 
    9696    HashTable tmp_auto_globals; 
     97#ifdef HAVE_XCACHE_CONSTANT 
     98    Bucket    *tmp_internal_constant_tail; 
     99#endif 
    97100    Bucket    *tmp_internal_function_tail; 
    98101    Bucket    *tmp_internal_class_tail; 
  • branches/1.3/xcache-test.ini

    r623 r627  
    88xcache.cacher = On 
    99xcache.test=1 
    10 xcache.size = 1M 
     10xcache.size = 16M 
    1111xcache.count = 1 
    1212xcache.var_size = 1M 
  • branches/1.3/xcache.c

    r626 r627  
    15941594} 
    15951595/* }}} */ 
     1596static void xc_copy_zend_constant(zend_constant *c) /* {{{ */ 
     1597{ 
     1598    c->name = zend_strndup(c->name, c->name_len - 1); 
     1599    if (!(c->flags & CONST_PERSISTENT)) { 
     1600        zval_copy_ctor(&c->value); 
     1601    } 
     1602} 
     1603/* }}} */ 
    15961604static void xc_request_init(TSRMLS_D) /* {{{ */ 
    15971605{ 
     
    15991607 
    16001608    if (!XG(internal_table_copied)) { 
     1609#ifdef HAVE_XCACHE_CONSTANT 
     1610        zend_constant tmp_const; 
     1611#endif 
    16011612        zend_function tmp_func; 
    16021613        xc_cest_t tmp_cest; 
    16031614 
     1615#ifdef HAVE_XCACHE_CONSTANT 
     1616        zend_hash_destroy(&XG(internal_constant_table)); 
     1617#endif 
    16041618        zend_hash_destroy(&XG(internal_function_table)); 
    16051619        zend_hash_destroy(&XG(internal_class_table)); 
    16061620 
     1621#ifdef HAVE_XCACHE_CONSTANT 
     1622        zend_hash_init_ex(&XG(internal_constant_table), 20,  NULL, NULL, 1, 0); 
     1623#endif 
    16071624        zend_hash_init_ex(&XG(internal_function_table), 100, NULL, NULL, 1, 0); 
    16081625        zend_hash_init_ex(&XG(internal_class_table),    10,  NULL, NULL, 1, 0); 
    16091626 
     1627#ifdef HAVE_XCACHE_CONSTANT 
     1628        zend_hash_copy(&XG(internal_constant_table), EG(zend_constants), (copy_ctor_func_t) xc_copy_zend_constant, &tmp_const, sizeof(tmp_const)); 
     1629#endif 
    16101630        zend_hash_copy(&XG(internal_function_table), CG(function_table), NULL, &tmp_func, sizeof(tmp_func)); 
    16111631        zend_hash_copy(&XG(internal_class_table), CG(class_table), NULL, &tmp_cest, sizeof(tmp_cest)); 
     
    16661686    memset(xcache_globals, 0, sizeof(zend_xcache_globals)); 
    16671687 
     1688#ifdef HAVE_XCACHE_CONSTANT 
     1689    zend_hash_init_ex(&xcache_globals->internal_constant_table, 1, NULL, NULL, 1, 0); 
     1690#endif 
    16681691    zend_hash_init_ex(&xcache_globals->internal_function_table, 1, NULL, NULL, 1, 0); 
    16691692    zend_hash_init_ex(&xcache_globals->internal_class_table,    1, NULL, NULL, 1, 0); 
     
    16971720 
    16981721    if (xcache_globals->internal_table_copied) { 
     1722#ifdef HAVE_XCACHE_CONSTANT 
     1723        zend_hash_destroy(&xcache_globals->internal_constant_table); 
     1724#endif 
    16991725        zend_hash_destroy(&xcache_globals->internal_function_table); 
    17001726        zend_hash_destroy(&xcache_globals->internal_class_table); 
  • branches/1.3/xcache_globals.h

    r622 r627  
    2222#endif 
    2323 
     24#ifdef HAVE_XCACHE_CONSTANT 
     25    HashTable internal_constant_table; 
     26#endif 
    2427    HashTable internal_function_table; 
    2528    HashTable internal_class_table; 
Note: See TracChangeset for help on using the changeset viewer.