Ticket #296: 0001-ticket-296-3.0.1.patch

File 0001-ticket-296-3.0.1.patch, 2.8 KB (added by dschnepper, 12 months ago)

Patch for 3.0.1

  • mod_cacher/xc_cacher.c

    From 0f3354180a48fe2e2d6c11b7e68b432a8c80ed4f Mon Sep 17 00:00:00 2001
    From: David Schnepper <dschnepper@box.com>
    Date: Thu, 9 May 2013 11:44:11 -0700
    Subject: [PATCH] ticket-296-3.0.1
    
    ---
     mod_cacher/xc_cacher.c |    6 ++++++
     xcache.c               |    1 +
     xcache.ini             |    3 +++
     xcache_globals.h       |    1 +
     4 files changed, 11 insertions(+), 0 deletions(-)
    
    diff --git a/mod_cacher/xc_cacher.c b/mod_cacher/xc_cacher.c
    index 76c5db1..d76e120 100644
    a b static int xc_entry_data_php_init_md5(xc_cache_t *cache, xc_compiler_t *compiler 
    12561256    while ((n = php_stream_read(stream, (char *) buf, (int) sizeof(buf))) > 0) { 
    12571257        PHP_MD5Update(&context, buf, n); 
    12581258    } 
     1259    if (XG(dedup_on_filename_only)) { 
     1260        /* Include the full file pathname in the hash calculation. 
     1261         * Files with identical source can have different opcode results if they include __FILE__ or __DIR__ 
     1262         */ 
     1263        PHP_MD5Update(&context, compiler->filename, strlen(compiler->filename)); 
     1264    } 
    12591265    PHP_MD5Final((unsigned char *) compiler->new_php.md5.digest, &context); 
    12601266 
    12611267    php_stream_close(stream); 
  • xcache.c

    diff --git a/xcache.c b/xcache.c
    index 2556d85..040e10a 100644
    a b PHP_INI_BEGIN() 
    724724    PHP_INI_ENTRY1_EX  ("xcache.disable_on_crash",       "0", PHP_INI_SYSTEM, xcache_OnUpdateBool,     &xc_disable_on_crash, zend_ini_boolean_displayer_cb) 
    725725    PHP_INI_ENTRY1_EX  ("xcache.test",                   "0", PHP_INI_SYSTEM, xcache_OnUpdateBool,     &xc_test,             zend_ini_boolean_displayer_cb) 
    726726    STD_PHP_INI_BOOLEAN("xcache.experimental",           "0", PHP_INI_ALL,    OnUpdateBool,        experimental,      zend_xcache_globals, xcache_globals) 
     727    STD_PHP_INI_BOOLEAN("xcache.dedup_on_filename_only", "0", PHP_INI_SYSTEM, OnUpdateBool,        dedup_on_filename_only, zend_xcache_globals, xcache_globals)  
    727728PHP_INI_END() 
    728729/* }}} */ 
    729730static PHP_MINFO_FUNCTION(xcache) /* {{{ */ 
  • xcache.ini

    diff --git a/xcache.ini b/xcache.ini
    index 1338a39..cf33838 100644
    a b xcache.disable_on_crash = Off 
    6565; enable experimental documented features for each release if available 
    6666xcache.experimental =        Off 
    6767 
     68; Include filename in md5 of contents for detecting identical files 
     69xcache.dedup_on_filename_only = Off 
     70 
    6871; per request settings. can ini_set, .htaccess etc 
    6972xcache.cacher =               On 
    7073xcache.stat   =               On 
  • xcache_globals.h

    diff --git a/xcache_globals.h b/xcache_globals.h
    index 29c2098..20a0363 100644
    a b ZEND_BEGIN_MODULE_GLOBALS(xcache) 
    55    zend_bool cacher;      /* true if enabled */ 
    66    zend_bool stat; 
    77    zend_bool experimental; 
     8    zend_bool dedup_on_filename_only; 
    89#ifdef HAVE_XCACHE_OPTIMIZER 
    910    zend_bool optimizer;   /* true if enabled */ 
    1011#endif