Skip to content

Commit 03be54d

Browse files
committed
- Make unicode handling portable (noted by andrei)
# Actually we should provide much more such unicode strings that we often # use like 'parent', 'self' and so on.
1 parent 742c598 commit 03be54d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2524,7 +2524,7 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
25242524
*fptr_ptr = NULL;
25252525

25262526
if (Z_TYPE_P(callable) == IS_UNICODE) {
2527-
if ((colon.u = u_strstr(Z_USTRVAL_P(callable), (UChar*)":\0:\0\0")) != NULL) {
2527+
if ((colon.u = u_strstr(Z_USTRVAL_P(callable), u_doublecolon)) != NULL) {
25282528
mlen = u_strlen(colon.u+2);
25292529
clen = Z_USTRLEN_P(callable) - mlen - 2;
25302530
mname.u = colon.u + 2;

Zend/zend_execute.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ typedef union _temp_variable {
4646

4747

4848
BEGIN_EXTERN_C()
49+
ZEND_API extern UChar u_main[sizeof("main")];
50+
ZEND_API extern UChar u_return[sizeof("return ")];
51+
ZEND_API extern UChar u_semicolon[sizeof(" ;")];
52+
ZEND_API extern UChar u_doublecolon[sizeof(" ;")];
53+
4954
ZEND_API extern void (*zend_execute)(zend_op_array *op_array TSRMLS_DC);
5055
ZEND_API extern void (*zend_execute_internal)(zend_execute_data *execute_data_ptr, int return_value_used TSRMLS_DC);
5156

Zend/zend_execute_API.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ static DWORD timeout_thread_id;
5151
static int timeout_thread_initialized=0;
5252
#endif
5353

54-
static UChar u_main[sizeof("main")];
55-
static UChar u_return[sizeof("return ")];
56-
static UChar u_semicolon[sizeof(" ;")];
54+
UChar u_main[sizeof("main")];
55+
UChar u_return[sizeof("return ")];
56+
UChar u_semicolon[sizeof(" ;")];
57+
UChar u_doublecolon[sizeof(" ;")];
5758

5859
void init_unicode_strings() {
5960
u_charsToUChars("main", u_main, sizeof("main"));
6061
u_charsToUChars("return ", u_return, sizeof("return "));
6162
u_charsToUChars(" ;", u_semicolon, sizeof(" ;"));
63+
u_charsToUChars("::", u_doublecolon, sizeof("::"));
6264
}
6365

6466
#if ZEND_DEBUG

0 commit comments

Comments
 (0)