1
0
Fork 0

restore open_files handling, it is required. disable included_files which is real EG since PHP 5_2

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@954 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 11 years ago
parent 285096e893
commit 831bc07e2d

@ -584,8 +584,10 @@ ZESW(xc_cest_t *, void) xc_install_class(ZEND_24(NOTHING, const) char *filename,
typedef struct { /* sandbox {{{ */
ZEND_24(NOTHING, const) char *filename;
#ifndef ZEND_ENGINE_2_2
HashTable orig_included_files;
HashTable *tmp_included_files;
#endif
#ifdef HAVE_XCACHE_CONSTANT
HashTable *orig_zend_constants;
@ -771,7 +773,9 @@ static xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(NOTHING, con
assert(sandbox);
memset(sandbox, 0, sizeof(sandbox[0]));
#ifndef ZEND_ENGINE_2_2
memcpy(&OG(included_files), &EG(included_files), sizeof(EG(included_files)));
#endif
#ifdef HAVE_XCACHE_CONSTANT
OG(zend_constants) = EG(zend_constants);
@ -790,9 +794,13 @@ static xc_sandbox_t *xc_sandbox_init(xc_sandbox_t *sandbox, ZEND_24(NOTHING, con
CG(auto_globals) = &TG(auto_globals);
#endif
#ifndef ZEND_ENGINE_2_2
TG(included_files) = &EG(included_files);
#endif
#ifndef ZEND_ENGINE_2_2
zend_hash_init_ex(TG(included_files), 5, NULL, NULL, 0, 1);
#endif
#ifdef HAVE_XCACHE_CONSTANT
h = OG(zend_constants);
zend_hash_init_ex(&TG(zend_constants), 20, NULL, (dtor_func_t) xc_free_zend_constant, h->persistent, h->bApplyProtection);
@ -925,8 +933,10 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
CG(zend_lineno) = 0;
#endif
#ifndef ZEND_ENGINE_2_2
i = 1;
zend_hash_add(&OG(included_files), sandbox->filename, strlen(sandbox->filename) + 1, (void *)&i, sizeof(int), NULL);
#endif
}
/* }}} */
static void xc_sandbox_free(xc_sandbox_t *sandbox, zend_op_array *op_array TSRMLS_DC) /* {{{ */
@ -977,10 +987,14 @@ static void xc_sandbox_free(xc_sandbox_t *sandbox, zend_op_array *op_array TSRML
#ifdef ZEND_ENGINE_2_1
zend_hash_destroy(&TG(auto_globals));
#endif
#ifndef ZEND_ENGINE_2_2
zend_hash_destroy(TG(included_files));
#endif
#ifndef ZEND_ENGINE_2_2
/* restore orig here, as EG/CG holded tmp before */
memcpy(&EG(included_files), &OG(included_files), sizeof(EG(included_files)));
#endif
#ifdef XCACHE_ERROR_CACHING
if (sandbox->compilererrors) {

@ -745,7 +745,7 @@ static void xc_filllist_unlocked(xc_entry_type_t type, xc_cache_t *cache, zval *
}
/* }}} */
static zend_op_array *xc_entry_install(xc_entry_php_t *entry_php TSRMLS_DC) /* {{{ */
static zend_op_array *xc_entry_install(xc_entry_php_t *entry_php, zend_file_handle *h TSRMLS_DC) /* {{{ */
{
zend_uint i;
xc_entry_data_php_t *p = entry_php->php;
@ -814,7 +814,12 @@ static zend_op_array *xc_entry_install(xc_entry_php_t *entry_php TSRMLS_DC) /* {
#endif
i = 1;
#ifndef ZEND_ENGINE_2_2
zend_hash_add(&EG(included_files), entry_php->entry.name.str.val, entry_php->entry.name.str.len+1, (void *)&i, sizeof(int), NULL);
#endif
if (h) {
zend_llist_add_element(&CG(open_files), h);
}
#ifndef ZEND_ENGINE_2
my_free_alloca(new_cest_ptrs, use_heap);
@ -1839,7 +1844,7 @@ err_op_array:
}
}
/* }}} */
static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_entry, xc_entry_data_php_t *stored_php TSRMLS_DC) /* {{{ */
static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_entry, xc_entry_data_php_t *stored_php, zend_file_handle *h TSRMLS_DC) /* {{{ */
{
zend_op_array *op_array;
xc_entry_php_t restored_entry;
@ -1859,7 +1864,7 @@ static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_entry, xc_entry_
catched = 0;
zend_try {
op_array = xc_entry_install(&restored_entry TSRMLS_CC);
op_array = xc_entry_install(&restored_entry, h TSRMLS_CC);
} zend_catch {
catched = 1;
} zend_end_try();
@ -2117,7 +2122,7 @@ static zend_op_array *xc_compile_file_cached(xc_compiler_t *compiler, zend_file_
/* found entry */
if (stored_entry && stored_php) {
return xc_compile_restore(stored_entry, stored_php TSRMLS_CC);
return xc_compile_restore(stored_entry, stored_php, NULL /* h */ TSRMLS_CC);
}
/* gaveup */
@ -2133,7 +2138,7 @@ static zend_op_array *xc_compile_file_cached(xc_compiler_t *compiler, zend_file_
sandboxed_compiler.stored_entry = NULL;
op_array = xc_sandbox(xc_compile_file_sandboxed, (void *) &sandboxed_compiler, h->opened_path ? h->opened_path : h->filename TSRMLS_CC);
if (sandboxed_compiler.stored_entry) {
return xc_compile_restore(sandboxed_compiler.stored_entry, sandboxed_compiler.stored_php TSRMLS_CC);
return xc_compile_restore(sandboxed_compiler.stored_entry, sandboxed_compiler.stored_php, sandboxed_compiler.h TSRMLS_CC);
}
else {
return op_array;

Loading…
Cancel
Save