Browse Source

PHP_6: unicode support for __get __set etc handlers

git-svn-id: svn://svn.lighttpd.net/xcache/trunk@507 c26eb9a1-5813-0410-bd6c-c2e55f420ca7
3.0
Xuefer 14 years ago
parent
commit
a1bbff4ffd
  1. 43
      processor/head.m4
  2. 13
      processor/processor.m4

43
processor/head.m4

@ -215,10 +215,11 @@ static zend_class_entry *xc_get_class(xc_processor_t *processor, zend_ulong clas
/* }}} */
#ifdef ZEND_ENGINE_2
/* fix method on store */
static void xc_fix_method(xc_processor_t *processor, zend_op_array *dst) /* {{{ */
static void xc_fix_method(xc_processor_t *processor, zend_op_array *dst TSRMLS_DC) /* {{{ */
{
zend_function *zf = (zend_function *) dst;
zend_class_entry *ce = processor->active_class_entry_dst;
const zend_class_entry *srcce = processor->active_class_entry_src;
/* Fixing up the default functions for objects here since
* we need to compare with the newly allocated functions
@ -239,16 +240,7 @@ static void xc_fix_method(xc_processor_t *processor, zend_op_array *dst) /* {{{
ce->clone = zf;
}
else {
dnl FIXME: handle common.function_name here
#define SET_IF_SAME_NAME(member) \
do { \
if (!strcasecmp(ZSTR_S(zf->common.function_name), #member)) { \
ce->member = zf; \
} \
} \
while(0)
/* if(ce->member && !strcmp(zf->common.function_name, ce->member->common.function_name)) { \ */
pushdef(`SET_IF_SAME_NAMEs', `
SET_IF_SAME_NAME(__get);
SET_IF_SAME_NAME(__set);
#ifdef ZEND_ENGINE_2_1
@ -262,8 +254,37 @@ dnl FIXME: handle common.function_name here
#if defined(ZEND_ENGINE_2_2) || PHP_MAJOR_VERSION >= 6
SET_IF_SAME_NAME(__tostring);
#endif
')
#ifdef IS_UNICODE
if (UG(unicode)) {
#define SET_IF_SAME_NAME(member) \
do { \
if (srcce->member && u_strcmp(ZSTR_S(zf->common.function_name), ZSTR_S(srcce->member->common.function_name)) == 0) { \
ce->member = zf; \
} \
} \
while(0)
SET_IF_SAME_NAMEs()
#undef SET_IF_SAME_NAME
}
else
#endif
do {
#define SET_IF_SAME_NAME(member) \
do { \
if (srcce->member && strcmp(ZSTR_S(zf->common.function_name), ZSTR_S(srcce->member->common.function_name)) == 0) { \
ce->member = zf; \
} \
} \
while(0)
SET_IF_SAME_NAMEs()
#undef SET_IF_SAME_NAME
} while (0);
popdef(`SET_IF_SAME_NAMEs')
}
}
/* }}} */

13
processor/processor.m4

@ -667,19 +667,14 @@ DEF_STRUCT_P_FUNC(`zend_op_array', , `dnl {{{
')
#endif
IFRESTORE(`
#ifdef ZEND_ENGINE_2
PROC_CLASS_ENTRY_P(scope)
IFCOPY(`
if (src->scope) {
dst->scope = xc_get_class(processor, (zend_ulong) src->scope);
xc_fix_method(processor, dst);
xc_fix_method(processor, dst TSRMLS_CC);
}
DONE(scope)
#endif
', `
#ifdef ZEND_ENGINE_2
PROC_CLASS_ENTRY_P(scope)
#endif
')
#endif
IFRESTORE(`
if (xc_have_op_array_ctor) {

Loading…
Cancel
Save