@@ -15,6 +15,12 @@ require_once 'skipifconnectfailure.inc';
1515 exit (1 );
1616 }
1717
18+ // On some servers the default collation is not what we expect,
19+ // so we need to set it explicitly to make sure that the test is deterministic.
20+ mysqli_set_charset ($ link , 'utf8mb4 ' );
21+ if (!$ res = mysqli_query ($ link , "SET NAMES utf8mb4 COLLATE 'utf8mb4_general_ci' " ))
22+ printf ("[011] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
23+
1824 if (!$ res = mysqli_query ($ link , 'SELECT @@character_set_connection AS charset, @@collation_connection AS collation ' ))
1925 printf ("[007] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
2026 $ tmp = mysqli_fetch_assoc ($ res );
@@ -27,13 +33,6 @@ require_once 'skipifconnectfailure.inc';
2733 if (!mysqli_fetch_assoc ($ res ))
2834 printf ("[010] Cannot fetch Maxlen and/or Comment, test will fail: $ sql \n" );
2935
30- if (!$ res = mysqli_query ($ link , sprintf ("SHOW COLLATION LIKE '%s' " , $ collation_connection )))
31- printf ("[011] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
32- $ tmp = mysqli_fetch_assoc ($ res );
33- mysqli_free_result ($ res );
34- if (!($ id = $ tmp ['Id ' ]))
35- printf ("[012] Cannot fetch Id/Number, test will fail \n" );
36-
3736 if (!$ res = mysqli_query ($ link , sprintf ("SHOW VARIABLES LIKE 'character_sets_dir' " )))
3837 printf ("[013] [%d] %s \n" , mysqli_errno ($ link ), mysqli_error ($ link ));
3938 $ tmp = mysqli_fetch_assoc ($ res );
@@ -66,8 +65,8 @@ require_once 'skipifconnectfailure.inc';
6665
6766 if (!isset ($ charset ->number ) ||
6867 !is_int ($ charset ->number ) ||
69- ($ charset ->number !== ( int ) $ id ))
70- printf ("[021] Expecting int/%d, got %s/%s \n" , $ id , gettype ($ charset ->number ), $ charset ->number );
68+ ($ charset ->number !== 0 ))
69+ printf ("[021] Expecting int/%d, got %s/%s \n" , 0 , gettype ($ charset ->number ), $ charset ->number );
7170
7271 if (!isset ($ charset ->state ) ||
7372 !is_int ($ charset ->state ))
0 commit comments