For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > August 2006 > cvs: ZendEngine2 / zend_API.c









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: ZendEngine2 / zend_API.c
Andrei Zmievski

2006-08-08, 6:56 pm

andrei Tue Aug 8 17:36:55 2006 UTC

Modified files:
/ZendEngine2 zend_API.c
Log:
Adjust zend_get_unified_string_type() to give correct types.


http://cvs.php.net/viewvc.cgi/ZendE...5&diff_format=u
Index: ZendEngine2/zend_API.c
diff -u ZendEngine2/zend_API.c:1.394 ZendEngine2/zend_API.c:1.395
--- ZendEngine2/zend_API.c:1.394 Fri Aug 4 21:05:59 2006
+++ ZendEngine2/zend_API.c Tue Aug 8 17:36:55 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: zend_API.c,v 1.394 2006/08/04 21:05:59 andrei Exp $ */
+/* $Id: zend_API.c,v 1.395 2006/08/08 17:36:55 andrei Exp $ */

#include "zend.h"
#include "zend_execute.h"
@@ -3816,15 +3816,11 @@
* Return the string type that all the passed in types should be converted to.
* If none of the types are string types, IS_UNICODE or IS_STRING is returned,
* depending on the Unicode semantics switch.
- * Binary and Unicode types cannot be mixed, so we return -1 (or 255 since it's
- * uchar)
*/
ZEND_API zend_uchar zend_get_unified_string_type(int num_args TSRMLS_DC, ...)
{
va_list ap;
int best_type = UG(unicode) ? IS_UNICODE : IS_STRING;
- zend_bool seen_unicode = 0;
- zend_bool seen_string = 0;
int type;

if (num_args <= 0) return (zend_uchar)-1;
@@ -3835,22 +3831,16 @@
va_start(ap, num_args);
#endif
while (num_args--) {
- type = va_arg(ap, int);
+ type = va_arg(ap, int);
if (type == IS_UNICODE) {
- seen_unicode = 1;
best_type = IS_UNICODE;
+ break;
} else if (type == IS_STRING) {
- seen_string = 1;
best_type = IS_STRING;
}
}
va_end(ap);

- /* We do not allow mixing binary and Unicode types */
- if (seen_string && seen_unicode) {
- return (zend_uchar)-1;
- }
-
return best_type;
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com