1
0
Fork 0

fixes #296: Multiple instances of the same software causes PHP "cannot redeclare class" errors when xcache enabled

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@1238 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
Xuefer 2013-05-10 17:52:02 +00:00
parent 8fc2642685
commit d6a26094d9
5 changed files with 27 additions and 2 deletions

View File

@ -9,6 +9,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
View File

@ -6,6 +6,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
========

View File

@ -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;

View File

@ -2291,6 +2291,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
}
/* }}} */

View File

@ -727,6 +727,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;
@ -743,13 +746,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;
@ -800,13 +812,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;')