Re: cvs: php-src /ext/standard type.c

From: Date: Sun, 08 Oct 2006 20:05:22 +0000
Subject: Re: cvs: php-src /ext/standard type.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-41010@lists.php.net to get a copy of this message
According to U_STRING_DECL documentation the second arg can only be a string literal, so I guess coding for undocumented behavior is not should be avoided on all platforms. Edin Sara Golemon wrote:
pollita Sun Oct 8 18:00:44 2006 UTC
  Modified files:                  /php-src/ext/standard	type.c   Log:
Fix win32 (again), just temporarily convert the classname to ascii on this platform... http://cvs.php.net/viewvc.cgi/php-src/ext/standard/type.c?r1=1.46&r2=1.47&diff_format=u Index: php-src/ext/standard/type.c diff -u php-src/ext/standard/type.c:1.46 php-src/ext/standard/type.c:1.47 --- php-src/ext/standard/type.c:1.46 Sat Oct 7 04:45:42 2006 +++ php-src/ext/standard/type.c Sun Oct 8 18:00:44 2006 @@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: type.c,v 1.46 2006/10/07 04:45:42 pollita Exp $ */ +/* $Id: type.c,v 1.47 2006/10/08 18:00:44 pollita Exp $ */ #include "php.h" #include "php_incomplete_class.h" @@ -238,12 +238,25 @@ /* 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;


« previous php.cvs (#41010) next »