Browse Source

merged [1238] from trunk: fixes #296: Multiple instances of the same software causes PHP "cannot redeclare class" errors when readonly_protection is not in use

git-svn-id: svn://svn.lighttpd.net/xcache/branches/3.0@1239 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
6026bbdbaa
  1. 1
      ChangeLog
  2. 1
      NEWS
  3. 3
      mod_cacher/xc_cache.h
  4. 5
      mod_cacher/xc_cacher.c
  5. 19
      processor/processor.m4

1
ChangeLog

@ -3,6 +3,7 @@ ChangeLog
========
* fixes #303: tablesort.js not found in Diagnosis and Coverager
* fixes #297: segv on startup under sparc, ini setting overflow
* fixes #296: Multiple instances of the same software causes PHP "cannot redeclare class" errors when readonly_protection is not in use
3.0.1 2013-01-11
ChangeLog

1
NEWS

@ -1,6 +1,7 @@
3.0.2 2013-??-??
========
* bug fixes
* "cannot redeclare class" errors is now gone. Can also be avoid by using readonly_protection (unavailable with /dev/zero).
3.0.1 2013-01-11
========

3
mod_cacher/xc_cache.h

@ -192,6 +192,9 @@ typedef struct {
#ifdef ZEND_ENGINE_2
zend_uint num_args;
zend_arg_info *arg_info;
#endif
#ifdef ZEND_ENGINE_2_4
zend_literal *literals;
#endif
zend_op *opcodes;
} xc_gc_op_array_t;

5
mod_cacher/xc_cacher.c

@ -2282,6 +2282,11 @@ static void xc_gc_op_array(void *pDest) /* {{{ */
if (op_array->opcodes) {
efree(op_array->opcodes);
}
#ifdef ZEND_ENGINE_2_4
if (op_array->literals) {
efree(op_array->literals);
}
#endif
}
/* }}} */

19
processor/processor.m4

@ -716,6 +716,9 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
if (shallow_copy) {
zend_bool gc_arg_info = 0;
zend_bool gc_opcodes = 0;
#ifdef ZEND_ENGINE_2_4
zend_bool gc_literals = 0;
#endif
/* really fast shallow copy */
memcpy(dst, src, sizeof(src[0]));
dst->refcount[0] = 1000;
@ -732,13 +735,22 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
#endif
dst->filename = processor->entry_php_src->filepath;
#ifdef ZEND_ENGINE_2_4
if (src->literals /* || op_array_info->literalsinfo_cnt */) {
if (src->literals) {
gc_opcodes = 1;
if (op_array_info->literalinfo_cnt) {
gc_literals = 1;
}
}
#else
if (op_array_info->oplineinfo_cnt) {
gc_opcodes = 1;
}
#endif
#ifdef ZEND_ENGINE_2_4
if (gc_literals) {
dnl used when copying opcodes
COPY_N_EX(last_literal, zend_literal, literals)
}
#endif
if (gc_opcodes) {
zend_op *opline, *end;
@ -786,13 +798,16 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
}
}
}
if (gc_arg_info || gc_opcodes) {
if (gc_arg_info || gc_opcodes || gc_literals) {
xc_gc_op_array_t gc_op_array;
#ifdef ZEND_ENGINE_2
gc_op_array.num_args = gc_arg_info ? dst->num_args : 0;
gc_op_array.arg_info = gc_arg_info ? dst->arg_info : NULL;
#endif
gc_op_array.opcodes = gc_opcodes ? dst->opcodes : NULL;
#ifdef ZEND_ENGINE_2_4
gc_op_array.literals = gc_literals ? dst->literals : NULL;
#endif
xc_gc_add_op_array(&gc_op_array TSRMLS_CC);
}
IFAUTOCHECK(`xc_autocheck_skip = 1;')

Loading…
Cancel
Save