From d7e0ccbc5a3b8ad67e49d4183d27a311ca2a9537 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 24 Aug 2011 10:15:47 +0000 Subject: [PATCH] Eliminated compile warning "comparison is always false due to limited range of data type" Fixed test failed due to mysql_pconnect throw warning Fixed test failed when host mysql server doesn't listen on 3306 --- ext/mysql/tests/bug55473.phpt | 7 ++++++- ext/mysql/tests/mysql_pconn_kill.phpt | 2 +- ext/mysqlnd/mysqlnd_charset.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ext/mysql/tests/bug55473.phpt b/ext/mysql/tests/bug55473.phpt index d492e68349..3a145fd780 100644 --- a/ext/mysql/tests/bug55473.phpt +++ b/ext/mysql/tests/bug55473.phpt @@ -18,6 +18,11 @@ mysql.allow_persistent=1 $tmp = NULL; $link = NULL; + if ($socket) + $host = sprintf("%s:%s", $host, $socket); + else if ($port) + $host = sprintf("%s:%s", $host, $port); + function connect($host, $user, $passwd) { $conn = mysql_pconnect($host, $user, $passwd); if (!$conn) @@ -68,4 +73,4 @@ OK Warning: mysql_ping(): MySQL server has gone away in %s on line %d reconnect OK -done! \ No newline at end of file +done! diff --git a/ext/mysql/tests/mysql_pconn_kill.phpt b/ext/mysql/tests/mysql_pconn_kill.phpt index 8543e39d6c..efef421604 100755 --- a/ext/mysql/tests/mysql_pconn_kill.phpt +++ b/ext/mysql/tests/mysql_pconn_kill.phpt @@ -64,7 +64,7 @@ mysql.max_persistent=2 mysql_close($plink); - if (!($plink = mysql_pconnect($myhost, $user, $passwd))) + if (!($plink = @mysql_pconnect($myhost, $user, $passwd))) printf("[009] Cannot create new persistent connection, [%d] %s\n", mysql_errno(), mysql_error()); mysql_select_db($db, $plink); diff --git a/ext/mysqlnd/mysqlnd_charset.c b/ext/mysqlnd/mysqlnd_charset.c index 6792229d10..a87b2a1f4f 100644 --- a/ext/mysqlnd/mysqlnd_charset.c +++ b/ext/mysqlnd/mysqlnd_charset.c @@ -126,8 +126,8 @@ static unsigned int check_mb_utf8_sequence(const char *start, const char *end) if (!((start[1] ^ 0x80) < 0x40 && (start[2] ^ 0x80) < 0x40 && (start[3] ^ 0x80) < 0x40 && - (c >= 0xf1 || start[1] >= 0x90) && - (c <= 0xf3 || start[1] <= 0x8F))) + (c >= 0xf1 || start[1] >= (char)0x90) && + (c <= 0xf3 || start[1] <= (char)0x8F))) { return 0; /* invalid utf8 character */ } -- 2.40.0