Skip to content

Commit 7e130df

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Don't use PASSWORD() function in test Specify explicit row order in PDO MySQL test Skip bug77956.phpt if local_infile disabled on server Don't check TIMESTAMP NOT NULL in fetch_field_flags test Don't test the RENAME DATABASE query Make GeomFromText tests compatible with MySQL 8
2 parents 3fafa19 + b0efd18 commit 7e130df

8 files changed

+40
-58
lines changed

ext/mysqli/tests/bug77956.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ ensure an error is returned when mysqli.allow_local_infile is off
44
<?php
55
require_once('skipif.inc');
66
require_once('skipifconnectfailure.inc');
7+
8+
$link = mysqli_init();
9+
if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
10+
die(sprintf("skip Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
11+
}
12+
13+
require_once('local_infile_tools.inc');
14+
if ($msg = check_local_infile_support($link, $engine))
15+
die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
16+
717
?>
818
--INI--
919
mysqli.allow_local_infile=0

ext/mysqli/tests/mysqli_expire_password.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
9292
printf("[007] Cannot connect [%d] %s\n",
9393
mysqli_connect_errno(), mysqli_connect_error());
9494
} else {
95-
$link->query("SET PASSWORD=PASSWORD('expiretest')");
95+
$link->query("SET PASSWORD='expiretest'");
9696
printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error);
9797
if ($res = $link->query("SELECT id FROM test WHERE id = 1"))
9898
var_dump($res->fetch_assoc());

ext/mysqli/tests/mysqli_fetch_field_flags.phpt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ mysqli_close($link);
6060
'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY',
6161
'CHAR(1) DEFAULT NULL' => '',
6262
'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE',
63-
'TIMESTAMP NOT NULL' => 'NOT_NULL UNSIGNED ZEROFILL BINARY TIMESTAMP',
6463
'VARBINARY(127) DEFAULT NULL' => 'BINARY',
6564
'BLOB' => 'BLOB BINARY',
6665
'TINYBLOB' => 'BLOB BINARY',
@@ -106,13 +105,6 @@ mysqli_close($link);
106105
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
107106
printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
108107

109-
$is_maria_db = strpos(mysqli_get_server_info($link), "MariaDB") !== false;
110-
if ($is_maria_db) {
111-
$columns['TIMESTAMP NOT NULL'] = 'ON_UPDATE_NOW TIMESTAMP BINARY UNSIGNED NOT_NULL';
112-
} else if (mysqli_get_server_version($link) > 50600) {
113-
$columns['TIMESTAMP NOT NULL'] = 'ON_UPDATE_NOW TIMESTAMP BINARY NOT_NULL';
114-
}
115-
116108
foreach ($columns as $column_def => $expected_flags) {
117109
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
118110
printf("[002] %s [%d] %s\n", $column_def,
@@ -150,16 +142,6 @@ mysqli_close($link);
150142
results.The test does not yet fully reflect all server changes/bugs etc.
151143
*/
152144
switch ($column_def) {
153-
case 'TIMESTAMP NOT NULL':
154-
// http://bugs.mysql.com/bug.php?id=30081 - new flag introduced in 5.1.24/6.0.4
155-
$version = mysqli_get_server_version($link);
156-
if ((($version > 50122) && ($version < 60000) && ($version != 50200)) ||
157-
($version >= 60004)) {
158-
// new flag ON_UPDATE_NOW_FLAG (8192)
159-
$expected_flags .= ' ON_UPDATE_NOW';
160-
}
161-
break;
162-
163145
case 'INT UNSIGNED NOT NULL':
164146
case 'INT NOT NULL':
165147
case 'CHAR(1) NOT NULL':

ext/mysqli/tests/mysqli_get_client_stats.phpt

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ mysqli.allow_local_infile=1
662662
$info = $new_info;
663663

664664

665-
// CREATE, ALTER, RENAME, DROP DATABASE
665+
// CREATE, ALTER, DROP DATABASE
666666
if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) {
667667

668668
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
@@ -681,25 +681,13 @@ mysqli.allow_local_infile=1
681681
mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
682682
$info = $new_info;
683683

684-
if (mysqli_get_server_version($link) > 51700) {
685-
if (!mysqli_query($link, "RENAME DATABASE mysqli_get_client_stats TO mysqli_get_client_stats_"))
686-
printf("[%03d] RENAME DATABASE failed, [%d] %s\n", ++$test_counter,
687-
mysqli_errno($link), mysqli_error($link));
688-
689-
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
690-
printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
691-
++$test_counter, gettype($new_info), $new_info);
692-
mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
693-
$info = $new_info;
694-
} else {
695-
if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
696-
printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
697-
mysqli_errno($link), mysqli_error($link));
698-
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
699-
printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
700-
++$test_counter, gettype($new_info), $new_info);
701-
$info = $new_info;
702-
}
684+
if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
685+
printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
686+
mysqli_errno($link), mysqli_error($link));
687+
if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
688+
printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
689+
++$test_counter, gettype($new_info), $new_info);
690+
$info = $new_info;
703691

704692
if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_"))
705693
printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter,

ext/mysqli/tests/mysqli_pconn_max_links.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,12 @@ mysqli.rollback_on_cached_plink=1
9696
var_dump($row);
9797

9898
// change the password for the second DB user and kill the persistent connection
99-
if (!mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")') ||
99+
if (!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') ||
100100
!mysqli_query($link, 'FLUSH PRIVILEGES'))
101101
printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
102102

103103
// change the password for the second DB user and kill the persistent connection
104-
if (!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")') ||
104+
if (!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') ||
105105
!mysqli_query($link, 'FLUSH PRIVILEGES'))
106106
printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
107107

ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,15 @@ mysqli_stmt_fetch - geometry / spatial types
121121
return true;
122122
}
123123

124-
func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "GeomFromText('POINT(2 2)')", 20);
125-
func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "GeomFromText('POINT(1 1)')", 40);
126-
func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "GeomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
127-
func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
128-
func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "GeomFromText('MULTIPOINT(1 1, 2 2)')", 100);
129-
func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "GeomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
130-
func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
131-
func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "GeomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
124+
$geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
125+
func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
126+
func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
127+
func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
128+
func_mysqli_stmt_fetch_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
129+
func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
130+
func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
131+
func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
132+
func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
132133

133134
mysqli_close($link);
134135
print "done!";

ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,15 @@ mysqli_stmt_get_result - geometry / spatial types
123123
return true;
124124
}
125125

126-
func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "GeomFromText('POINT(2 2)')", 20);
127-
func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "GeomFromText('POINT(1 1)')", 40);
128-
func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "GeomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
129-
func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
130-
func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "GeomFromText('MULTIPOINT(1 1, 2 2)')", 100);
131-
func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "GeomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
132-
func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "GeomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
133-
func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "GeomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
126+
$geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText";
127+
func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20);
128+
func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40);
129+
func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60);
130+
func_mysqli_stmt_get_result_geom($link, $engine, "POLYGON", "$geomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5))')", 80);
131+
func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100);
132+
func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120);
133+
func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOLYGON", "$geomFromText('MULTIPOLYGON(((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)),((0 0,10 0,10 10,0 10,0 0),(5 5,7 5,7 7,5 7, 5 5)))')", 140);
134+
func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRYCOLLECTION", "$geomFromText('GEOMETRYCOLLECTION(POINT(1 1),LINESTRING(0 0,1 1,2 2,3 3,4 4))')", 160);
134135

135136
mysqli_close($link);
136137
print "done!";

ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ $db = MySQLPDOTest::factory();
233233
prepex(44, $db, 'DELETE FROM test');
234234
prepex(45, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)',
235235
array('row', 'row'));
236-
$stmt = prepex(46, $db, 'SELECT id, label FROM test');
236+
$stmt = prepex(46, $db, 'SELECT id, label FROM test ORDER BY id');
237237
$tmp = $stmt->fetchAll(PDO::FETCH_ASSOC);
238238
$exp = array(
239239
0 => array(

0 commit comments

Comments
 (0)