Skip to content

Commit

Permalink
- Make unicode handling portable (noted by andrei)
Browse files Browse the repository at this point in the history
# Actually we should provide much more such unicode strings that we often
# use like 'parent', 'self' and so on.
  • Loading branch information
helly25 committed Mar 3, 2006
1 parent 742c598 commit 03be54d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Zend/zend_API.c
Expand Up @@ -2524,7 +2524,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
*fptr_ptr = NULL;

if (Z_TYPE_P(callable) == IS_UNICODE) {
if ((colon.u = u_strstr(Z_USTRVAL_P(callable), (UChar*)":\0:\0\0")) != NULL) {
if ((colon.u = u_strstr(Z_USTRVAL_P(callable), u_doublecolon)) != NULL) {
mlen = u_strlen(colon.u+2);
clen = Z_USTRLEN_P(callable) - mlen - 2;
mname.u = colon.u + 2;
Expand Down
5 changes: 5 additions & 0 deletions Zend/zend_execute.h
Expand Up @@ -46,6 +46,11 @@ typedef union _temp_variable {


BEGIN_EXTERN_C()
ZEND_API extern UChar u_main[sizeof("main")];
ZEND_API extern UChar u_return[sizeof("return ")];
ZEND_API extern UChar u_semicolon[sizeof(" ;")];
ZEND_API extern UChar u_doublecolon[sizeof(" ;")];

ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);

Expand Down
8 changes: 5 additions & 3 deletions Zend/zend_execute_API.c
Expand Up @@ -51,14 +51,16 @@ static DWORD timeout_thread_id;
static int timeout_thread_initialized=0;
#endif

static UChar u_main[sizeof("main")];
static UChar u_return[sizeof("return ")];
static UChar u_semicolon[sizeof(" ;")];
UChar u_main[sizeof("main")];
UChar u_return[sizeof("return ")];
UChar u_semicolon[sizeof(" ;")];
UChar u_doublecolon[sizeof(" ;")];

void init_unicode_strings() {
u_charsToUChars("main", u_main, sizeof("main"));
u_charsToUChars("return ", u_return, sizeof("return "));
u_charsToUChars(" ;", u_semicolon, sizeof(" ;"));
u_charsToUChars("::", u_doublecolon, sizeof("::"));
}

#if ZEND_DEBUG
Expand Down

0 comments on commit 03be54d

Please sign in to comment.