Merge branch 'QA_5_0'

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-10-13 13:52:29 +02:00
commit 0d97b16d16
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889
8 changed files with 170 additions and 8 deletions

View File

@ -51,6 +51,9 @@ phpMyAdmin - ChangeLog
- issue #14795 Include routines in the export in a predictable order
5.0.4 (not yet released)
- issue #16245 Fix failed Zoom search clears existing values
- issue Fixed a PHP error when reporting a particular JS error
- issue #16326 Fixed latitude and longitude swap for geometries in edit mode
5.0.3 (2020-10-09)
- issue #15983 Require twig ^2.9

View File

@ -1,5 +1,8 @@
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* This file is internal to phpMyAdmin.
* @license see the main phpMyAdmin license.
*
* @fileoverview A jquery plugin that allows drag&drop sorting in tables.
* Coded because JQuery UI sortable doesn't support tables. Also it has no animation
*

View File

@ -112,7 +112,10 @@ class ErrorReport
return [];
}
$exception = $_POST['exception'];
$exception['stack'] = $this->translateStacktrace($exception['stack']);
if (isset($exception['stack'])) {
$exception['stack'] = $this->translateStacktrace($exception['stack']);
}
if (isset($exception['url'])) {
[$uri, $scriptName] = $this->sanitizeUrl($exception['url']);

View File

@ -1710,11 +1710,18 @@ class Util
$hex = bin2hex($data);
$spatialAsText = 'ASTEXT';
$spatialSrid = 'SRID';
if ($dbi->getVersion() >= 50600) {
$axisOrder = '';
$mysqlVersionInt = $dbi->getVersion();
if ($mysqlVersionInt >= 50600) {
$spatialAsText = 'ST_ASTEXT';
$spatialSrid = 'ST_SRID';
}
$wktsql = 'SELECT ' . $spatialAsText . "(x'" . $hex . "')";
if ($mysqlVersionInt >= 80010 && ! $dbi->isMariaDb()) {
$axisOrder = ', \'axis-order=long-lat\'';
}
$wktsql = 'SELECT ' . $spatialAsText . "(x'" . $hex . "'" . $axisOrder . ')';
if ($includeSRID) {
$wktsql .= ', ' . $spatialSrid . "(x'" . $hex . "')";
}

View File

@ -79,10 +79,10 @@
{% if criteria_column_names[i] is defined and criteria_column_names[i] != 'pma_null' %}
{% set key = keys[criteria_column_names[i]] %}
{% set properties = self.getColumnProperties(i, key) %}
{% set type = type|merge({i: properties['type']}) %}
{% set collation = collation|merge({i: properties['collation']}) %}
{% set func = func|merge({i: properties['func']}) %}
{% set value = value|merge({i: properties['value']}) %}
{% set type = type|merge({(i): properties['type']}) %}
{% set collation = collation|merge({(i): properties['collation']}) %}
{% set func = func|merge({(i): properties['func']}) %}
{% set value = value|merge({(i): properties['value']}) %}
{% endif %}
{# Column type #}
<td dir="ltr">
@ -97,9 +97,10 @@
{{ func[i] is defined ? func[i]|raw }}
</td>
{# Inputbox for search criteria value #}
<td></td>
<td>
{{ value[i] is defined ? value[i]|raw }}
</td>
<td>
{# Displays hidden fields #}
<input type="hidden" name="criteriaColumnTypes[{{ i }}]" id="types_{{ i }}"
{%- if criteria_column_types[i] is defined %} value="{{ criteria_column_types[i] }}"{% endif %}>

View File

@ -953,6 +953,8 @@ class ConfigTest extends AbstractTestCase
/**
* Should test getting unique value for theme
*
* @group 32bit-incompatible
*/
public function testGetThemeUniqueValue(): void
{

View File

@ -478,6 +478,8 @@ class CoreTest extends AbstractNetworkTestCase
* @param string $size Size
* @param int $expected Expected value
*
* @group 32bit-incompatible
*
* @dataProvider providerTestGetRealSize
*/
public function testGetRealSize(string $size, int $expected): void

View File

@ -8,6 +8,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Tests;
use PhpMyAdmin\Core;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\MoTranslator\Loader;
use PhpMyAdmin\SqlParser\Context;
use PhpMyAdmin\SqlParser\Token;
@ -17,6 +18,7 @@ use function date_default_timezone_get;
use function date_default_timezone_set;
use function file_exists;
use function floatval;
use function hex2bin;
use function htmlspecialchars;
use function ini_get;
use function ini_set;
@ -2156,4 +2158,143 @@ class UtilTest extends AbstractTestCase
]*/
];
}
/**
* Some data to test Util::asWKT for testAsWKT
*/
public function dataProviderAsWKT(): array
{
return [
[
'SELECT ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\')',
['POINT(1 1)'],
'POINT(1 1)',
false,
50300,
],
[
'SELECT ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\'),'
. ' SRID(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'\'POINT(1 1)\',0',
true,
50300,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\')',
['POINT(1 1)'],
'POINT(1 1)',
false,
50700,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\'),'
. ' ST_SRID(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'\'POINT(1 1)\',0',
true,
50700,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\', \'axis-order=long-lat\'),'
. ' ST_SRID(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'\'POINT(1 1)\',0',
true,
80010,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\'),'
. ' ST_SRID(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'\'POINT(1 1)\',0',
true,
50700,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\', \'axis-order=long-lat\')',
[
'POINT(1 1)',
'0',
],
'POINT(1 1)',
false,
80010,
],
[
'SELECT ST_ASTEXT(x\'000000000101000000000000000000f03f000000000000f03f\')',
[
'POINT(1 1)',
'0',
],
'POINT(1 1)',
false,
50700,
],
];
}
/**
* Test to get data asWKT
*
* @param string $expectedQuery The query to expect
* @param array $returnData The data to return for fetchRow
* @param string $functionResult Result of the Util::asWKT invocation
* @param bool $SRIDOption Use the SRID option or not
* @param int $mysqlVersion The mysql version to return for getVersion
*
* @dataProvider dataProviderAsWKT
*/
public function testAsWKT(
string $expectedQuery,
array $returnData,
string $functionResult,
bool $SRIDOption,
int $mysqlVersion
): void {
$oldDbi = $GLOBALS['dbi'];
$dbi = $this->getMockBuilder(DatabaseInterface::class)
->disableOriginalConstructor()
->getMock();
$dbi->expects($SRIDOption ? $this->once() : $this->exactly(2))
->method('getVersion')
->will($this->returnValue($mysqlVersion));
$dbi->expects($SRIDOption ? $this->once() : $this->exactly(2))
->method('tryQuery')
->with($expectedQuery)
->will($this->returnValue([]));// Omit the real object
$dbi->expects($SRIDOption ? $this->once() : $this->exactly(2))
->method('fetchRow')
->will($this->returnValue($returnData));
$GLOBALS['dbi'] = $dbi;
if (! $SRIDOption) {
// Also test default signature
$this->assertSame($functionResult, Util::asWKT(
(string) hex2bin('000000000101000000000000000000F03F000000000000F03F')
));
}
$this->assertSame($functionResult, Util::asWKT(
(string) hex2bin('000000000101000000000000000000F03F000000000000F03F'),
$SRIDOption
));
$GLOBALS['dbi'] = $oldDbi;
}
}