From 3a40f32c6e0aa3218a9d7f415762e4573e0107aa Mon Sep 17 00:00:00 2001 From: Sara Golemon Date: Sun, 8 Oct 2006 18:00:44 +0000 Subject: [PATCH] Fix win32 (again), just temporarily convert the classname to ascii on this platform... --- ext/standard/type.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ext/standard/type.c b/ext/standard/type.c index bf66c667a6..35e0737e70 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -238,12 +238,25 @@ static void php_is_type(INTERNAL_FUNCTION_PARAMETERS, int type) /* We can get away with this because INCOMPLETE_CLASS is ascii and has a 1:1 relationship with unicode */ RETURN_TRUE; } else if (UG(unicode)) { +#ifndef PHP_WIN32 U_STRING_DECL(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); U_STRING_INIT(uIncompleteClass, (INCOMPLETE_CLASS), sizeof(INCOMPLETE_CLASS) - 1); if (!memcmp(ce->name.u, uIncompleteClass, UBYTES(sizeof(INCOMPLETE_CLASS)))) { RETURN_FALSE; } +#else /* WIN32 -- U_STRING_DECL breaks under Win32 with string macros */ + char *ascii_name = zend_unicode_to_ascii(ce->name.u, ce->name_length TSRSMLS_CC); + + if (ascii_name) { + if (memcmp(INCOMPLETE_CLASS, ascii_name, sizeof(INCOMPLETE_CLASS) - 1) == 0) { + efree(ascii_name); + RETURN_FALSE; + } + efree(ascii_name); + } + /* Non-ascii class name means it can't be INCOMPLETE_CLASS and is therefore okay */ +#endif } else { if (!memcmp(ce->name.s, INCOMPLETE_CLASS, sizeof(INCOMPLETE_CLASS))) { RETURN_FALSE; -- 2.50.1