]> granicus.if.org Git - php/commitdiff
Eliminated compile warning "comparison is always false due to limited range of data...
authorXinchen Hui <laruence@php.net>
Wed, 24 Aug 2011 10:15:47 +0000 (10:15 +0000)
committerXinchen Hui <laruence@php.net>
Wed, 24 Aug 2011 10:15:47 +0000 (10:15 +0000)
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
ext/mysql/tests/mysql_pconn_kill.phpt
ext/mysqlnd/mysqlnd_charset.c

index d492e68349b5aabb1bb143432d50f8edd759d699..3a145fd780dc355cc9a58e96e56353768e688488 100644 (file)
@@ -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!
index 8543e39d6c2f8b5ed0120f7afcbd0a7640461e88..efef4216045ee9e567a0c0f8fc8d47cfed1e46cb 100755 (executable)
@@ -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);
 
index 6792229d10ca2ed6a5c099494791ad60722a809b..a87b2a1f4f52297686b49324ca705f9c7ae1eb30 100644 (file)
@@ -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 */
                }