mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fix for bug 54674..typo in the check of SJIS
This commit is contained in:
parent
410a781063
commit
d4ae5bd995
2 changed files with 33 additions and 4 deletions
31
ext/mysqli/tests/bug54674.phpt
Normal file
31
ext/mysqli/tests/bug54674.phpt
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #54674 mysqlnd valid_sjis_(head|tail) is using invalid operator and range.
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
require_once('skipif.inc');
|
||||||
|
require_once('skipifconnectfailure.inc');
|
||||||
|
?>
|
||||||
|
--INI--
|
||||||
|
mysqli.max_links = 1
|
||||||
|
mysqli.allow_persistent = Off
|
||||||
|
mysqli.max_persistent = 0
|
||||||
|
mysqli.reconnect = Off
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
include ("connect.inc");
|
||||||
|
|
||||||
|
$link = mysqli_init();
|
||||||
|
if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
|
||||||
|
printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
|
||||||
|
}
|
||||||
|
|
||||||
|
$japanese_so = pack('H4', '835c');
|
||||||
|
$link->set_charset('sjis');
|
||||||
|
var_dump($link->real_escape_string($japanese_so) === $japanese_so);
|
||||||
|
mysqli_close($link);
|
||||||
|
|
||||||
|
print "done!";
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
bool(true)
|
||||||
|
done!
|
|
@ -327,10 +327,8 @@ static unsigned int mysqlnd_mbcharlen_gbk(unsigned int gbk)
|
||||||
|
|
||||||
|
|
||||||
/* {{{ sjis functions */
|
/* {{{ sjis functions */
|
||||||
#define valid_sjis_head(c) ((0x81 <= (c) && (c) <= 0x9F) && \
|
#define valid_sjis_head(c) ((0x81 <= (c) && (c) <= 0x9F) || (0xE0 <= (c) && (c) <= 0xFC))
|
||||||
(0xE0 <= (c) && (c) <= 0xFC))
|
#define valid_sjis_tail(c) ((0x40 <= (c) && (c) <= 0x7E) || (0x80 <= (c) && (c) <= 0x7C))
|
||||||
#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)
|
static unsigned int check_mb_sjis(const char *start, const char *end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue