diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-27 17:26:42 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-12-27 17:26:42 +0100 |
commit | 7e130df2497a3410eb8e20be235048cd465bca77 (patch) | |
tree | 681cde99044658d0524dea5cc20f86dd92f4832f | |
parent | 3fafa19777efb50810c7d3e7fb08f66f2e868e7d (diff) | |
parent | b0efd18f7844da29931737b8a1cf461c7493e168 (diff) | |
download | php-git-7e130df2497a3410eb8e20be235048cd465bca77.tar.gz |
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
-rw-r--r-- | ext/mysqli/tests/bug77956.phpt | 10 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_expire_password.phpt | 2 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_fetch_field_flags.phpt | 18 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_get_client_stats.phpt | 28 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_pconn_max_links.phpt | 4 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt | 17 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt | 17 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt | 2 |
8 files changed, 40 insertions, 58 deletions
diff --git a/ext/mysqli/tests/bug77956.phpt b/ext/mysqli/tests/bug77956.phpt index 0a3fd183ef..d2f74d7c01 100644 --- a/ext/mysqli/tests/bug77956.phpt +++ b/ext/mysqli/tests/bug77956.phpt @@ -4,6 +4,16 @@ ensure an error is returned when mysqli.allow_local_infile is off <?php require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); + +$link = mysqli_init(); +if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) { + die(sprintf("skip Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error())); +} + +require_once('local_infile_tools.inc'); +if ($msg = check_local_infile_support($link, $engine)) + die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error)); + ?> --INI-- mysqli.allow_local_infile=0 diff --git a/ext/mysqli/tests/mysqli_expire_password.phpt b/ext/mysqli/tests/mysqli_expire_password.phpt index fdf8b783fb..149c4425f0 100644 --- a/ext/mysqli/tests/mysqli_expire_password.phpt +++ b/ext/mysqli/tests/mysqli_expire_password.phpt @@ -92,7 +92,7 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'% printf("[007] Cannot connect [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); } else { - $link->query("SET PASSWORD=PASSWORD('expiretest')"); + $link->query("SET PASSWORD='expiretest'"); printf("[008] Connect allowed, pw set, [%d] %s\n", $link->errno, $link->error); if ($res = $link->query("SELECT id FROM test WHERE id = 1")) var_dump($res->fetch_assoc()); diff --git a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt index 45b009051b..169c5d653f 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_flags.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_flags.phpt @@ -60,7 +60,6 @@ mysqli_close($link); 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY' => 'NOT_NULL PRI_KEY UNSIGNED AUTO_INCREMENT NUM PART_KEY', 'CHAR(1) DEFAULT NULL' => '', 'CHAR(1) NOT NULL' => 'NOT_NULL NO_DEFAULT_VALUE', - 'TIMESTAMP NOT NULL' => 'NOT_NULL UNSIGNED ZEROFILL BINARY TIMESTAMP', 'VARBINARY(127) DEFAULT NULL' => 'BINARY', 'BLOB' => 'BLOB BINARY', 'TINYBLOB' => 'BLOB BINARY', @@ -106,13 +105,6 @@ mysqli_close($link); if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); - $is_maria_db = strpos(mysqli_get_server_info($link), "MariaDB") !== false; - if ($is_maria_db) { - $columns['TIMESTAMP NOT NULL'] = 'ON_UPDATE_NOW TIMESTAMP BINARY UNSIGNED NOT_NULL'; - } else if (mysqli_get_server_version($link) > 50600) { - $columns['TIMESTAMP NOT NULL'] = 'ON_UPDATE_NOW TIMESTAMP BINARY NOT_NULL'; - } - foreach ($columns as $column_def => $expected_flags) { if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) { printf("[002] %s [%d] %s\n", $column_def, @@ -150,16 +142,6 @@ mysqli_close($link); results.The test does not yet fully reflect all server changes/bugs etc. */ switch ($column_def) { - case 'TIMESTAMP NOT NULL': - // http://bugs.mysql.com/bug.php?id=30081 - new flag introduced in 5.1.24/6.0.4 - $version = mysqli_get_server_version($link); - if ((($version > 50122) && ($version < 60000) && ($version != 50200)) || - ($version >= 60004)) { - // new flag ON_UPDATE_NOW_FLAG (8192) - $expected_flags .= ' ON_UPDATE_NOW'; - } - break; - case 'INT UNSIGNED NOT NULL': case 'INT NOT NULL': case 'CHAR(1) NOT NULL': diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index 6df6e2bee7..5894789e37 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -662,7 +662,7 @@ mysqli.allow_local_infile=1 $info = $new_info; - // CREATE, ALTER, RENAME, DROP DATABASE + // CREATE, ALTER, DROP DATABASE if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) { if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) @@ -681,25 +681,13 @@ mysqli.allow_local_infile=1 mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); $info = $new_info; - if (mysqli_get_server_version($link) > 51700) { - if (!mysqli_query($link, "RENAME DATABASE mysqli_get_client_stats TO mysqli_get_client_stats_")) - printf("[%03d] RENAME DATABASE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE'); - $info = $new_info; - } else { - if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_")) - printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter, - mysqli_errno($link), mysqli_error($link)); - if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) - printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", - ++$test_counter, gettype($new_info), $new_info); - $info = $new_info; - } + if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_")) + printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter, + mysqli_errno($link), mysqli_error($link)); + if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info)) + printf("[%03d] Expecting array/any_non_empty, got %s/%s\n", + ++$test_counter, gettype($new_info), $new_info); + $info = $new_info; if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_")) printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter, diff --git a/ext/mysqli/tests/mysqli_pconn_max_links.phpt b/ext/mysqli/tests/mysqli_pconn_max_links.phpt index 19105b3c66..228334d7ba 100644 --- a/ext/mysqli/tests/mysqli_pconn_max_links.phpt +++ b/ext/mysqli/tests/mysqli_pconn_max_links.phpt @@ -96,12 +96,12 @@ mysqli.rollback_on_cached_plink=1 var_dump($row); // change the password for the second DB user and kill the persistent connection - if (!mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")') || + if (!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') || !mysqli_query($link, 'FLUSH PRIVILEGES')) printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // change the password for the second DB user and kill the persistent connection - if (!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")') || + if (!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') || !mysqli_query($link, 'FLUSH PRIVILEGES')) printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); diff --git a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt index 22eb7c9074..f76d407ad0 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt @@ -121,14 +121,15 @@ mysqli_stmt_fetch - geometry / spatial types return true; } - func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "GeomFromText('POINT(2 2)')", 20); - func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "GeomFromText('POINT(1 1)')", 40); - func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "GeomFromText('LINESTRING(0 0,1 1,2 2)')", 60); - 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); - func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "GeomFromText('MULTIPOINT(1 1, 2 2)')", 100); - func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "GeomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); - 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); - 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); + $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText"; + func_mysqli_stmt_fetch_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20); + func_mysqli_stmt_fetch_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40); + func_mysqli_stmt_fetch_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60); + 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); + func_mysqli_stmt_fetch_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100); + func_mysqli_stmt_fetch_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); + 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); + 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); mysqli_close($link); print "done!"; diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt index a2965b7362..aeadc3b1d7 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt @@ -123,14 +123,15 @@ mysqli_stmt_get_result - geometry / spatial types return true; } - func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "GeomFromText('POINT(2 2)')", 20); - func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "GeomFromText('POINT(1 1)')", 40); - func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "GeomFromText('LINESTRING(0 0,1 1,2 2)')", 60); - 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); - func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "GeomFromText('MULTIPOINT(1 1, 2 2)')", 100); - func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "GeomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); - 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); - 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); + $geomFromText = $link->server_version >= 80000 ? "ST_GeomFromText" : "GeomFromText"; + func_mysqli_stmt_get_result_geom($link, $engine, "GEOMETRY", "$geomFromText('POINT(2 2)')", 20); + func_mysqli_stmt_get_result_geom($link, $engine, "POINT", "$geomFromText('POINT(1 1)')", 40); + func_mysqli_stmt_get_result_geom($link, $engine, "LINESTRING", "$geomFromText('LINESTRING(0 0,1 1,2 2)')", 60); + 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); + func_mysqli_stmt_get_result_geom($link, $engine, "MULTIPOINT", "$geomFromText('MULTIPOINT(1 1, 2 2)')", 100); + func_mysqli_stmt_get_result_geom($link, $engine, "MULTILINESTRING", "$geomFromText('MULTILINESTRING((0 0,1 1,2 2),(0 0,1 1,3 3))')", 120); + 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); + 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); mysqli_close($link); print "done!"; diff --git a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt index c88b90663b..efd472edc6 100644 --- a/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt +++ b/ext/pdo_mysql/tests/pdo_mysql_prepare_native.phpt @@ -233,7 +233,7 @@ $db = MySQLPDOTest::factory(); prepex(44, $db, 'DELETE FROM test'); prepex(45, $db, 'INSERT INTO test(id, label) VALUES (1, ?), (2, ?)', array('row', 'row')); - $stmt = prepex(46, $db, 'SELECT id, label FROM test'); + $stmt = prepex(46, $db, 'SELECT id, label FROM test ORDER BY id'); $tmp = $stmt->fetchAll(PDO::FETCH_ASSOC); $exp = array( 0 => array( |