Changeset 625 in svn for branches/1.3


Ignore:
Timestamp:
2009-07-05T11:01:49+02:00 (6 years ago)
Author:
Xuefer
Message:

merged r541:559 from trunk

Location:
branches/1.3
Files:
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/1.3

  • branches/1.3/ChangeLog

    r624 r625  
    111.3.0 2009-??-??
    22== ChangeLog ==
     3 * PHP 5.3 Supported
    34 * fixed #138: no segv if cache is not initialized correctly
    45 * default to 64M for xcache.size in xcache.ini
     
    67 * wrong http auth realm
    78 * coverager: font-size and newline fix for firefox
    8  * PHP 5.3 Supported
     9 * admin page is now magic quote gpc aware
    910
    10111.2.2 2007-12-29
  • branches/1.3/NEWS

    r624 r625  
    44 * many cacher/coverager bug fixes
    55 * improved admin pages
     6 * admin page is now magic quote gpc aware
    67 
    781.2.2 2007-12-29
  • branches/1.3/admin/common.php

    r623 r625  
    9292define('REQUEST_TIME', time());
    9393
    94 if (get_magic_quotes_gpc()) {
     94if (function_exists('get_magic_quotes_gpc') && @get_magic_quotes_gpc()) {
    9595    $mqs = (bool) ini_get('magic_quotes_sybase');
    9696    $_GET = stripaddslashes_array($_GET, $mqs);
  • branches/1.3/admin/xcache.php

    r623 r625  
    130130        else {
    131131            switch ($k) {
    132             case 'his_by_hour':
    133             case 'his_by_second':
     132            case 'hits_by_hour':
     133            case 'hits_by_second':
    134134                foreach ($data[$k] as $kk => $vv) {
    135135                    $total[$k][$kk] += $vv;
  • branches/1.3/coverager.c

    r623 r625  
     1#if 0
     2#define XCACHE_DEBUG
     3#endif
     4
    15#include <stdio.h>
    26#include "xcache.h"
     
    1822static char *xc_coveragedump_dir = NULL;
    1923static zend_compile_file_t *old_compile_file = NULL;
    20 
    21 #if 0
    22 #define DEBUG
    23 #endif
    2424
    2525/* dumper */
     
    246246    if (XG(coverager)) {
    247247        xc_coverager_enable(TSRMLS_C);
     248#ifdef ZEND_COMPILE_EXTENDED_INFO
     249        CG(compiler_options) |= ZEND_COMPILE_EXTENDED_INFO;
     250#else
    248251        CG(extended_info) = 1;
     252#endif
    249253    }
    250254    else {
     
    470474
    471475    if (cfg_get_string("xcache.coveragedump_directory", &xc_coveragedump_dir) == SUCCESS && xc_coveragedump_dir) {
     476        int len;
    472477        xc_coveragedump_dir = pestrdup(xc_coveragedump_dir, 1);
    473         int len = strlen(xc_coveragedump_dir);
     478        len = strlen(xc_coveragedump_dir);
    474479        if (len) {
    475480            if (xc_coveragedump_dir[len - 1] == '/') {
  • branches/1.3/mem.c

    r593 r625  
    22#include <limits.h>
    33#include <stdio.h>
     4#   define XCACHE_DEBUG
    45#else
    56#include <php.h>
    67#endif
     8
     9#ifdef XCACHE_DEBUG
     10#   define ALLOC_DEBUG_BLOCK_CHECK
     11#endif
     12
    713
    814#include <assert.h>
     
    1420#include "align.h"
    1521#include "utils.h"
    16 
    17 #ifdef TEST
    18 #   define DEBUG
    19 #endif
    20 #ifdef DEBUG
    21 #   define ALLOC_DEBUG_BLOCK_CHECK
    22 #endif
    2322
    2423#if 0
  • branches/1.3/mmap.c

    r593 r625  
    199199    if (shm->ptr == XCACHE_MAP_FAILED) {
    200200        perror(shm->name);
    201         errstr = "Failed creating file mappping";
     201        errstr = "Failed creating file mapping";
    202202        shm->ptr = NULL;
    203203        goto err;
  • branches/1.3/processor/processor.m4

    r623 r625  
    506506    dnl main op_array && have early binding
    507507    zend_uint ii;
    508     if (!processor->readonly_protection && !(src == processor->xce_src->data.php->op_array && processor->xce_src->data.php->have_early_binding)) {
     508#ifdef ZEND_COMPILE_DELAYED_BINDING
     509    zend_bool need_early_binding = 0;
     510#else
     511    zend_bool need_early_binding = processor->xce_src->data.php->have_early_binding;
     512#endif
     513    if (!processor->readonly_protection && !(src == processor->xce_src->data.php->op_array && need_early_binding)) {
    509514        /* really fast shallow copy */
    510515        memcpy(dst, src, sizeof(src[0]));
     
    633638    PROC_ZSTRING_L(, doc_comment, doc_comment_len)
    634639#endif
     640#ifdef ZEND_COMPILE_DELAYED_BINDING
     641    DISPATCH(zend_uint, early_binding);
     642#endif
    635643
    636644    /* reserved */
     
    730738    STRUCT(zend_class_entry, cest)
    731739#endif
     740#ifndef ZEND_COMPILE_DELAYED_BINDING
    732741    DISPATCH(int, oplineno)
     742#endif
    733743')
    734744dnl }}}
     
    783793    ')
    784794#endif
     795#ifndef ZEND_COMPILE_DELAYED_BINDING
    785796    DISPATCH(zend_bool, have_early_binding)
     797#endif
     798    DISPATCH(zend_bool, have_references)
    786799')
    787800dnl }}}
  • branches/1.3/utils.c

    r623 r625  
    500500                    ZESW(&stored_ce_ptr, NULL)
    501501                    );
     502#ifndef ZEND_COMPILE_DELAYED_BINDING
    502503        if (oplineno != -1) {
    503504            xc_do_early_binding(CG(active_op_array), CG(class_table), oplineno TSRMLS_CC);
    504505        }
     506#endif
    505507    }
    506508    else if (zend_u_hash_quick_add(CG(class_table), type, key, len, h,
     
    526528#define OG(x) (sandbox->orig_##x)
    527529/* }}} */
     530<<<<<<< .working
     531=======
     532#ifdef E_STRICT
     533static void xc_sandbox_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args) /* {{{ */
     534{
     535    xc_compilererror_t *compilererror;
     536    xc_sandbox_t *sandbox;
     537    TSRMLS_FETCH();
     538
     539    sandbox = (xc_sandbox_t *) XG(sandbox);
     540    assert(sandbox != NULL);
     541    if (type != E_STRICT) {
     542        /* give up, and user handler is not supported in this case */
     543        zend_uint i;
     544        zend_uint orig_lineno = CG(zend_lineno);
     545        zend_error_cb = sandbox->orig_zend_error_cb;
     546
     547        for (i = 0; i < sandbox->compilererror_cnt; i ++) {
     548            compilererror = &sandbox->compilererrors[i];
     549            CG(zend_lineno) = compilererror->lineno;
     550            zend_error(E_STRICT, "%s", compilererror->error);
     551        }
     552        CG(zend_lineno) = orig_lineno;
     553        sandbox->compilererror_cnt = 0;
     554
     555        sandbox->orig_zend_error_cb(type, error_filename, error_lineno, format, args);
     556        return;
     557    }
     558
     559    if (sandbox->compilererror_cnt <= sandbox->compilererror_size) {
     560        if (sandbox->compilererror_size) {
     561            sandbox->compilererror_size += 16;
     562            sandbox->compilererrors = erealloc(sandbox->compilererrors, sandbox->compilererror_size * sizeof(sandbox->compilererrors));
     563        }
     564        else {
     565            sandbox->compilererror_size = 16;
     566            sandbox->compilererrors = emalloc(sandbox->compilererror_size * sizeof(sandbox->compilererrors));
     567        }
     568    }
     569    compilererror = &sandbox->compilererrors[sandbox->compilererror_cnt++];
     570    compilererror->lineno = error_lineno;
     571    compilererror->error_len = vspprintf(&compilererror->error, 0, format, args);
     572}
     573/* }}} */
     574#endif
     575>>>>>>> .merge-right.r559
    528576#ifdef ZEND_ENGINE_2_1
    529577static zend_bool xc_auto_global_callback(char *name, uint name_len TSRMLS_DC) /* {{{ */
     
    625673#endif
    626674
     675#ifdef ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
     676    sandbox->orig_compiler_options = CG(compiler_options);
     677    /* Using ZEND_COMPILE_IGNORE_INTERNAL_CLASSES for ZEND_FETCH_CLASS_RT_NS_CHECK
     678     */
     679    CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES | ZEND_COMPILE_DELAYED_BINDING;
     680#endif
     681
     682    XG(sandbox) = (void *) sandbox;
    627683    return sandbox;
    628684}
     
    636692static void xc_sandbox_install(xc_sandbox_t *sandbox, xc_install_action_t install TSRMLS_DC) /* {{{ */
    637693{
    638     int i;
     694    zend_uint i;
    639695    Bucket *b;
    640696
     
    679735
    680736    if (install != XC_InstallNoBinding) {
     737#ifdef ZEND_COMPILE_DELAYED_BINDING
     738        zend_do_delayed_early_binding(CG(active_op_array) TSRMLS_CC);
     739#else
    681740        xc_undo_pass_two(CG(active_op_array) TSRMLS_CC);
    682741        xc_foreach_early_binding_class(CG(active_op_array), xc_early_binding_cb, (void *) sandbox TSRMLS_CC);
    683742        xc_redo_pass_two(CG(active_op_array) TSRMLS_CC);
     743#endif
    684744    }
    685745
     
    735795#endif
    736796
     797#ifdef ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
     798    CG(compiler_options) = sandbox->orig_compiler_options;
     799#endif
     800
    737801    if (sandbox->alloc) {
    738802        efree(sandbox);
  • branches/1.3/utils.h

    r623 r625  
    22#include "xcache.h"
    33
    4 #ifdef DEBUG
     4#ifdef XCACHE_DEBUG
    55#   define IFDEBUG(x) (x)
    66int xc_vtrace(const char *fmt, va_list args);
     
    2525#   undef inline
    2626#   define inline
    27 #else /* DEBUG */
     27#else /* XCACHE_DEBUG */
    2828
    2929#   ifdef ZEND_WIN32
     
    4141#       define NDEBUG
    4242#   endif
    43 #endif /* DEBUG */
     43#endif /* XCACHE_DEBUG */
    4444#include <assert.h>
    4545
     
    101101    int orig_user_error_handler_error_reporting;
    102102#endif
     103
     104#ifdef ZEND_COMPILE_IGNORE_INTERNAL_CLASSES
     105    zend_uint orig_compiler_options;
     106#endif
    103107} xc_sandbox_t;
    104108
  • branches/1.3/xcache.c

    r623 r625  
    11
    22#if 0
    3 #define DEBUG
     3#define XCACHE_DEBUG
    44#endif
    55
     
    2323
    2424#include "xcache.h"
     25#ifdef ZEND_ENGINE_2_1
     26#include "ext/date/php_date.h"
     27#endif
    2528#include "optimizer.h"
    2629#include "coverager.h"
     
    652655        new_cest_ptrs[i] =
    653656#endif
     657#ifdef ZEND_COMPILE_DELAYED_BINDING
     658        xc_install_class(xce->name.str.val, &ci->cest, -1,
     659                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
     660#else
    654661        xc_install_class(xce->name.str.val, &ci->cest, ci->oplineno,
    655662                UNISW(0, ci->type), ci->key, ci->key_size, ci->h TSRMLS_CC);
     663#endif
    656664    }
    657665
     
    750758
    751759#define HASH(i) (i)
    752 #define HASH_USTR_L(t, s, l) HASH(zend_u_inline_hash_func(t, s, (l + 1) * sizeof(UChar)))
     760#define HASH_ZSTR_L(t, s, l) HASH(zend_u_inline_hash_func(t, s, (l + 1) * sizeof(UChar)))
    753761#define HASH_STR_L(s, l) HASH(zend_inline_hash_func(s, l + 1))
    754762#define HASH_STR(s) HASH_STR_L(s, strlen(s) + 1)
     
    766774static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *xce TSRMLS_DC) /* {{{ */
    767775{
    768     return UNISW(NOTHING, UG(unicode) ? HASH_USTR_L(xce->name_type, xce->name.uni.val, xce->name.uni.len) :)
     776    return UNISW(NOTHING, UG(unicode) ? HASH_ZSTR_L(xce->name_type, xce->name.uni.val, xce->name.uni.len) :)
    769777        HASH_STR_L(xce->name.str.val, xce->name.str.len);
    770778}
     
    893901}
    894902/* }}} */
     903#ifndef ZEND_COMPILE_DELAYED_BINDING
    895904static void xc_cache_early_binding_class_cb(zend_op *opline, int oplineno, void *data TSRMLS_DC) /* {{{ */
    896905{
     
    920929}
    921930/* }}} */
     931#endif
    922932static zend_op_array *xc_check_initial_compile_file(zend_file_handle *h, int type TSRMLS_DC) /* {{{ */
    923933{
     
    938948    char opened_path_buffer[MAXPATHLEN];
    939949    int old_constinfo_cnt, old_funcinfo_cnt, old_classinfo_cnt;
    940     int i;
    941950
    942951    if (!xc_initized) {
     
    11801189    }
    11811190    /* }}} */
     1191#ifndef ZEND_COMPILE_DELAYED_BINDING
    11821192    /* {{{ find inherited classes that should be early-binding */
    11831193    php.have_early_binding = 0;
    1184     for (i = 0; i < php.classinfo_cnt; i ++) {
    1185         php.classinfos[i].oplineno = -1;
     1194    {
     1195        int i;
     1196        for (i = 0; i < php.classinfo_cnt; i ++) {
     1197            php.classinfos[i].oplineno = -1;
     1198        }
    11861199    }
    11871200
     
    11901203    xc_redo_pass_two(php.op_array TSRMLS_CC);
    11911204    /* }}} */
     1205#endif
     1206
    11921207#ifdef SHOW_DPRINT
    11931208    xc_dprint(&xce, 0 TSRMLS_CC);
     
    17111726
    17121727    if (admin_user == NULL || admin_pass == NULL) {
    1713         php_error_docref(NULL TSRMLS_CC, E_ERROR, "xcache.admin.user and xcache.admin.pass is required");
     1728        php_error_docref(XCACHE_WIKI_URL "/InstallAdministration" TSRMLS_CC, E_ERROR,
     1729                "xcache.admin.user and/or xcache.admin.pass settings is not configured."
     1730                " Make sure you've modified the correct php ini file for your php used in webserver.");
    17141731        zend_bailout();
    17151732    }
    17161733    if (strlen(admin_pass) != 32) {
    1717         php_error_docref(NULL TSRMLS_CC, E_ERROR, "unexpect %lu bytes of xcache.admin.pass, expected 32 bytes, the password after md5()", (unsigned long) strlen(admin_pass));
     1734        php_error_docref(NULL TSRMLS_CC, E_ERROR, "xcache.admin.pass is %lu chars unexpectedly, it is supposed to be the password after md5() which should be 32 chars", (unsigned long) strlen(admin_pass));
    17181735        zend_bailout();
    17191736    }
     
    17641781    sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC);
    17651782#undef STR
    1766     ZEND_PUTS("XCache Auth Failed. User and Password is case sense\n");
     1783#define STR "Content-type: text/html; charset=UTF-8"
     1784    sapi_add_header_ex(STR, sizeof(STR) - 1, 1, 1 TSRMLS_CC);
     1785#undef STR
     1786    ZEND_PUTS("<html>\n");
     1787    ZEND_PUTS("<head><title>XCache Authentication Failed</title></head>\n");
     1788    ZEND_PUTS("<body>\n");
     1789    ZEND_PUTS("<h1>XCache Authentication Failed</h1>\n");
     1790    ZEND_PUTS("<p>You're not authorized to access this page due to wrong username and/or password you typed.<br />The following check points is suggested:</p>\n");
     1791    ZEND_PUTS("<ul>\n");
     1792    ZEND_PUTS("<li>Be aware that `Username' and `Password' is case sense. Check capslock status led on your keyboard, and punch left/right Shift keys once for each</li>\n");
     1793    ZEND_PUTS("<li>Make sure the md5 password is generated correctly. You may use <a href=\"mkpassword.php\">mkpassword.php</a></li>\n");
     1794    ZEND_PUTS("<li>Reload browser cache by pressing F5 and/or Ctrl+F5, or simply clear browser cache after you've updated username/password in php ini.</li>\n");
     1795    ZEND_PUTS("</ul>\n");
     1796    ZEND_PUTS("Check <a href=\"" XCACHE_WIKI_URL "/InstallAdministration\">XCache wiki page</a> for more information.\n");
     1797    ZEND_PUTS("</body>\n");
     1798    ZEND_PUTS("</html>\n");
    17671799
    17681800    zend_bailout();
     
    25602592    php_info_print_table_row(2, "Modules Built", XCACHE_MODULES);
    25612593    php_info_print_table_row(2, "Readonly Protection", xc_readonly_protection ? "enabled" : "N/A");
     2594#ifdef ZEND_ENGINE_2_1
    25622595    ptr = php_format_date("Y-m-d H:i:s", sizeof("Y-m-d H:i:s") - 1, xc_init_time, 1 TSRMLS_CC);
    25632596    php_info_print_table_row(2, "Cache Init Time", ptr);
    25642597    efree(ptr);
     2598#else
     2599    snprintf(buf, sizeof(buf), "%lu", (long unsigned) xc_init_time);
     2600    php_info_print_table_row(2, "Cache Init Time", buf);
     2601#endif
    25652602
    25662603#ifdef ZTS
     
    28052842        xc_initized = 1;
    28062843        xc_init_time = time(NULL);
     2844#ifdef PHP_WIN32
     2845        xc_init_instance_id = GetCurrentProcessId();
     2846#else
    28072847        xc_init_instance_id = getpid();
     2848#endif
    28082849#ifdef ZTS
    28092850        xc_init_instance_subid = tsrm_thread_id();
     
    29793020
    29803021        ext = (zend_extension *) zend_llist_get_last_ex(&zend_extensions, &lpos);
    2981         assert(ext && ext != xc_llist_zend_extension);
     3022        assert(ext && ext != (zend_extension *) xc_llist_zend_extension->data);
    29823023        xc_last_ext_startup = ext->startup;
    29833024        ext->startup = xc_zend_startup_last;
  • branches/1.3/xcache.h

    r623 r625  
    66#define XCACHE_COPYRIGHT  "Copyright (c) 2005-2009"
    77#define XCACHE_URL        "http://xcache.lighttpd.net"
     8#define XCACHE_WIKI_URL   XCACHE_URL "/wiki"
    89
    910#include <php.h>
     
    3940#endif
    4041
    41 #ifdef ALLOCA_FLAG
     42#ifdef do_alloca_with_limit
     43#   define my_do_alloca(size, use_heap) do_alloca_with_limit(size, use_heap)
     44#   define my_free_alloca(size, use_heap) free_alloca_with_limit(size, use_heap)
     45#elif defined(ALLOCA_FLAG)
    4246#   define my_do_alloca(size, use_heap) do_alloca(size, use_heap)
    4347#   define my_free_alloca(size, use_heap) free_alloca(size, use_heap)
     
    238242    ulong     h;
    239243    xc_cest_t cest;
     244#ifndef ZEND_COMPILE_DELAYED_BINDING
    240245    int       oplineno;
     246#endif
    241247} xc_classinfo_t;
    242248/* }}} */
     
    299305    zend_uint classinfo_cnt;
    300306    xc_classinfo_t *classinfos;
     307#ifndef ZEND_COMPILE_DELAYED_BINDING
    301308    zend_bool have_early_binding;
     309#endif
    302310
    303311#ifdef ZEND_ENGINE_2_1
Note: See TracChangeset for help on using the changeset viewer.