call op_array_ctor handler on restore to be more compatible with other zend_extension
git-svn-id: svn://svn.lighttpd.net/xcache/trunk@189 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
This commit is contained in:
parent
485de9e7b5
commit
ec94318ff0
|
@ -4,6 +4,7 @@ divert(0)
|
|||
#include <stdio.h>
|
||||
|
||||
#include "php.h"
|
||||
#include "zend_extensions.h"
|
||||
#include "zend_compile.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_ini.h"
|
||||
|
@ -18,6 +19,13 @@ divert(0)
|
|||
#if defined(HARDENING_PATCH_HASH_PROTECT) && HARDENING_PATCH_HASH_PROTECT
|
||||
extern unsigned int zend_hash_canary;
|
||||
#endif
|
||||
extern zend_bool xc_have_op_array_ctor;
|
||||
static void xc_zend_extension_op_array_ctor_handler(zend_extension *extension, zend_op_array *op_array TSRMLS_DC)
|
||||
{
|
||||
if (extension->op_array_ctor) {
|
||||
extension->op_array_ctor(op_array);
|
||||
}
|
||||
}
|
||||
|
||||
define(`SIZEOF_zend_uint', `sizeof(zend_uint)')
|
||||
define(`COUNTOF_zend_uint', `1')
|
||||
|
|
|
@ -473,16 +473,6 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
|
|||
/* deep */
|
||||
STRUCT_P(HashTable, static_variables, HashTable_zval_ptr)
|
||||
define(`SKIPASSERT_ONCE')
|
||||
|
||||
IFRESTORE(`
|
||||
#ifdef ZEND_ENGINE_2
|
||||
if (dst->scope) {
|
||||
dst->scope = xc_get_class(processor, (zend_ulong) dst->scope);
|
||||
xc_fix_method(processor, dst);
|
||||
}
|
||||
#endif
|
||||
')
|
||||
|
||||
}
|
||||
else
|
||||
')
|
||||
|
@ -495,15 +485,6 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
|
|||
DISPATCH(zend_uchar, type)
|
||||
PROC_ZSTRING(, function_name)
|
||||
#ifdef ZEND_ENGINE_2
|
||||
IFRESTORE(`
|
||||
if (dst->scope) {
|
||||
dst->scope = xc_get_class(processor, (zend_ulong) dst->scope);
|
||||
xc_fix_method(processor, dst);
|
||||
}
|
||||
DONE(scope)
|
||||
', `
|
||||
PROC_CLASS_ENTRY_P(scope)
|
||||
')
|
||||
DISPATCH(zend_uint, fn_flags)
|
||||
dnl mark it as -1 on store, and lookup parent on restore
|
||||
IFSTORE(`dst->prototype = (processor->active_class_entry_src && src->prototype) ? (zend_function *) -1 : NULL; DONE(prototype)', `
|
||||
|
@ -636,6 +617,26 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
|
|||
DISPATCH(zend_bool, created_by_eval)
|
||||
#endif
|
||||
} while (0);
|
||||
|
||||
IFRESTORE(`
|
||||
#ifdef ZEND_ENGINE_2
|
||||
if (dst->scope) {
|
||||
dst->scope = xc_get_class(processor, (zend_ulong) dst->scope);
|
||||
xc_fix_method(processor, dst);
|
||||
}
|
||||
DONE(scope)
|
||||
#endif
|
||||
', `
|
||||
#ifdef ZEND_ENGINE_2
|
||||
PROC_CLASS_ENTRY_P(scope)
|
||||
#endif
|
||||
')
|
||||
|
||||
IFRESTORE(`
|
||||
if (xc_have_op_array_ctor) {
|
||||
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) xc_zend_extension_op_array_ctor_handler, dst TSRMLS_CC);
|
||||
}
|
||||
')
|
||||
')
|
||||
dnl }}}
|
||||
|
||||
|
|
15
xcache.c
15
xcache.c
|
@ -96,6 +96,8 @@ static zend_compile_file_t *origin_compile_file;
|
|||
static zend_bool xc_test = 0;
|
||||
static zend_bool xc_readonly_protection = 0;
|
||||
|
||||
zend_bool xc_have_op_array_ctor = 0;
|
||||
|
||||
static zend_bool xc_module_gotup = 0;
|
||||
static zend_bool xc_zend_extension_gotup = 0;
|
||||
#if !COMPILE_DL_XCACHE
|
||||
|
@ -2280,6 +2282,8 @@ static int xc_config_long(zend_ulong *p, char *name, char *default_value) /* {{{
|
|||
static PHP_MINIT_FUNCTION(xcache)
|
||||
{
|
||||
char *env;
|
||||
zend_extension *ext;
|
||||
zend_llist_position lpos;
|
||||
|
||||
xc_module_gotup = 1;
|
||||
if (!xc_zend_extension_gotup) {
|
||||
|
@ -2289,6 +2293,17 @@ static PHP_MINIT_FUNCTION(xcache)
|
|||
}
|
||||
}
|
||||
|
||||
/* cache if there's an op_array_ctor */
|
||||
for (ext = zend_llist_get_first_ex(&zend_extensions, &lpos);
|
||||
ext;
|
||||
ext = zend_llist_get_next_ex(&zend_extensions, &lpos)) {
|
||||
if (ext->op_array_ctor) {
|
||||
xc_have_op_array_ctor = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef PHP_GINIT
|
||||
ZEND_INIT_MODULE_GLOBALS(xcache, xc_init_globals, xc_shutdown_globals);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue