From: Andrey Hristov Date: Mon, 9 May 2011 16:20:35 +0000 (+0000) Subject: Fix for bug 54674..typo in the check of SJIS X-Git-Tag: php-5.3.7RC1~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6242101f2badcb14f4d00c27c4eceaf773dd9243;p=php Fix for bug 54674..typo in the check of SJIS --- diff --git a/ext/mysqli/tests/bug54674.phpt b/ext/mysqli/tests/bug54674.phpt new file mode 100644 index 0000000000..efc67308b6 --- /dev/null +++ b/ext/mysqli/tests/bug54674.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #54674 mysqlnd valid_sjis_(head|tail) is using invalid operator and range. +--SKIPIF-- + +--INI-- +mysqli.max_links = 1 +mysqli.allow_persistent = Off +mysqli.max_persistent = 0 +mysqli.reconnect = Off +--FILE-- +set_charset('sjis'); + var_dump($link->real_escape_string($japanese_so) === $japanese_so); + mysqli_close($link); + + print "done!"; +?> +--EXPECTF-- +bool(true) +done! diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index 0e1b387a5f..a75861ccae 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -325,11 +325,9 @@ static unsigned int mysqlnd_mbcharlen_gbk(unsigned int gbk) /* }}} */ -/* {{{ sjis functions */ -#define valid_sjis_head(c) ((0x81 <= (c) && (c) <= 0x9F) && \ - (0xE0 <= (c) && (c) <= 0xFC)) -#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) && \ - (0x80 <= (c) && (c) <= 0x7C)) +/* {{{ functions */ +#define valid_sjis_head(c) ((0x81 <= (c) && (c) <= 0x9F) || (0xE0 <= (c) && (c) <= 0xFC)) +#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) && (c) <= 0x7C)) static unsigned int check_mb_sjis(const char *start, const char *end)