Browse Source

revert opt out of included_files handling. still required by require()/include(). make it work for new sandbox handling

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@961 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 9 years ago
parent
commit
90b1153d9e
  1. 15
      utils.c
  2. 5
      xcache.c

15
utils.c

@ -584,10 +584,8 @@ 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;
@ -773,9 +771,7 @@ 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);
@ -794,13 +790,9 @@ 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);
@ -933,10 +925,9 @@ static void xc_sandbox_install(xc_sandbox_t *sandbox TSRMLS_DC) /* {{{ */
CG(zend_lineno) = 0;
#endif
#ifndef ZEND_ENGINE_2_2
i = 1;
/* still needed because in zend_language_scanner.l, require()/include() check file_handle.handle.stream.handle */
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) /* {{{ */
@ -987,14 +978,10 @@ 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) {

5
xcache.c

@ -1847,6 +1847,11 @@ static zend_op_array *xc_compile_restore(xc_entry_php_t *stored_entry, xc_entry_
xc_entry_php_t restored_entry;
xc_entry_data_php_t restored_php;
zend_bool catched;
zend_uint i;
/* still needed because in zend_language_scanner.l, require()/include() check file_handle.handle.stream.handle */
i = 1;
zend_hash_add(&EG(included_files), stored_entry->entry.name.str.val, stored_entry->entry.name.str.len + 1, (void *)&i, sizeof(int), NULL);
CG(in_compilation) = 1;
CG(compiled_filename) = stored_entry->entry.name.str.val;

Loading…
Cancel
Save