Skip to content

Commit a70b08d

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2 parents d03234f + f7f85bb commit a70b08d

11 files changed

Lines changed: 17473 additions & 30 deletions

File tree

‎ChangeLog‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ phpMyAdmin - ChangeLog
3535
- issue #17287 Fixed sorting the database list with "statistics" enabled on "Data" column creates a PHP type error
3636
- issue #17368 Fix for invalid cache when losing access to config storage after it being cached
3737
- issue #17387 Fix session cookie not respecting the CookieSameSite configuration directive in PHP 7.2
38+
- issue #16769 Fix create index form accepting too many columns
39+
- issue #16816 Disable editing to system schemas
40+
- issue #16853 Add better error handling when IndexedDB is not working
3841

3942
5.1.3 (2022-02-10)
4043
- issue #17308 Fix broken pagination links in the navigation sidebar

‎js/src/designer/database.js‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ var DesignerOfflineDB = (function () {
8484
}
8585
};
8686

87-
request.onerror = designerDB.onerror;
87+
request.onerror = function () {
88+
Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error');
89+
};
8890
};
8991

9092
/**
@@ -94,6 +96,11 @@ var DesignerOfflineDB = (function () {
9496
* @return {void}
9597
*/
9698
designerDB.loadObject = function (table, id, callback) {
99+
if (datastore === null) {
100+
Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error');
101+
return;
102+
}
103+
97104
var objStore = designerDB.getObjectStore(table);
98105
var cursorRequest = objStore.get(parseInt(id));
99106

@@ -110,6 +117,11 @@ var DesignerOfflineDB = (function () {
110117
* @return {void}
111118
*/
112119
designerDB.loadAllObjects = function (table, callback) {
120+
if (datastore === null) {
121+
Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error');
122+
return;
123+
}
124+
113125
var transaction = designerDB.getTransaction(table);
114126
var cursorRequest = designerDB.getCursorRequest(transaction, table);
115127
var results = [];
@@ -136,6 +148,11 @@ var DesignerOfflineDB = (function () {
136148
* @return {void}
137149
*/
138150
designerDB.loadFirstObject = function (table, callback) {
151+
if (datastore === null) {
152+
Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error');
153+
return;
154+
}
155+
139156
var transaction = designerDB.getTransaction(table);
140157
var cursorRequest = designerDB.getCursorRequest(transaction, table);
141158
var firstResult = null;
@@ -162,6 +179,11 @@ var DesignerOfflineDB = (function () {
162179
* @return {void}
163180
*/
164181
designerDB.addObject = function (table, obj, callback) {
182+
if (datastore === null) {
183+
Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error');
184+
return;
185+
}
186+
165187
var objStore = designerDB.getObjectStore(table);
166188
var request = objStore.put(obj);
167189

@@ -181,6 +203,11 @@ var DesignerOfflineDB = (function () {
181203
* @return {void}
182204
*/
183205
designerDB.deleteObject = function (table, id, callback) {
206+
if (datastore === null) {
207+
Functions.ajaxShowMessage(Messages.strIndexedDBNotWorking, null, 'error');
208+
return;
209+
}
210+
184211
var objStore = designerDB.getObjectStore(table);
185212
var request = objStore.delete(parseInt(id));
186213

‎js/src/functions.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ Functions.ajaxShowMessage = function (message, timeout, type) {
18471847
selfClosing = false;
18481848
}
18491849
// Figure out whether (or after how long) to remove the notification
1850-
if (newTimeOut === undefined) {
1850+
if (newTimeOut === undefined || newTimeOut === null) {
18511851
newTimeOut = 5000;
18521852
} else if (newTimeOut === false) {
18531853
selfClosing = false;

‎libraries/classes/Controllers/JavaScriptMessagesController.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,10 @@ private function setMessages(): array
687687
'strU2FErrorAuthenticate' => _pgettext('U2F error', 'Invalid security key.'),
688688

689689
/* Designer */
690+
'strIndexedDBNotWorking' => __(
691+
'You can not open, save or delete your page layout, as IndexedDB is not working'
692+
. ' in your browser and your phpMyAdmin configuration storage is not configured for this.'
693+
),
690694
'strTableAlreadyExists' => _pgettext(
691695
'The table already exists in the designer and can not be added once more.',
692696
'Table %s already exists!'

‎libraries/classes/Controllers/Table/IndexesController.php‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
use function count;
1818
use function is_array;
19+
use function is_numeric;
1920
use function json_decode;
21+
use function min;
2022

2123
/**
2224
* Displays index edit/creation form and handles it.
@@ -94,7 +96,18 @@ private function displayForm(Index $index): void
9496
$add_fields += $_POST['added_fields'];
9597
}
9698
} elseif (isset($_POST['create_index'])) {
97-
$add_fields = $_POST['added_fields'];
99+
/**
100+
* In most cases, an index may consist of up to 16 columns, so add an initial limit.
101+
* More columns could be added later if necessary.
102+
*
103+
* @see https://dev.mysql.com/doc/refman/5.6/en/multiple-column-indexes.html "up to 16 columns"
104+
* @see https://mariadb.com/kb/en/innodb-limitations/#limitations-on-schema "maximum of 16 columns"
105+
* @see https://mariadb.com/kb/en/myisam-overview/#myisam-features "Maximum of 32 columns per index"
106+
*/
107+
$add_fields = 1;
108+
if (is_numeric($_POST['added_fields']) && $_POST['added_fields'] >= 2) {
109+
$add_fields = min((int) $_POST['added_fields'], 16);
110+
}
98111
}
99112

100113
// Get fields and stores their name/type

‎libraries/classes/LanguageManager.php‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class LanguageManager
3535
* - Match regular expression
3636
* - MySQL locale
3737
*
38-
* @var array
38+
* @var array<string, string[]>
39+
* @psalm-var array<string, array{non-empty-string, non-empty-string, string, non-empty-string, string}>
3940
*/
4041
private static $languageData = [
4142
'af' => [
@@ -192,6 +193,13 @@ class LanguageManager
192193
'en[_-]gb|english (United Kingdom)',
193194
'en_GB',
194195
],
196+
'enm' => [
197+
'enm',
198+
'English (Middle)',
199+
'',
200+
'enm|english (middle)',
201+
'',
202+
],
195203
'eo' => [
196204
'eo',
197205
'Esperanto',

‎libraries/classes/Sql.php‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,8 @@ private function getQueryResponseForResultsReturned(
14541454
$editable = ($hasUnique
14551455
|| $GLOBALS['cfg']['RowActionLinksWithoutUnique']
14561456
|| $updatableView)
1457-
&& $justOneTable;
1457+
&& $justOneTable
1458+
&& ! Utilities::isSystemSchema($db);
14581459

14591460
$_SESSION['tmpval']['possible_as_geometry'] = $editable;
14601461

@@ -1468,7 +1469,7 @@ private function getQueryResponseForResultsReturned(
14681469
'hasPrintLink' => true,
14691470
]);
14701471

1471-
if (Utilities::isSystemSchema($db) || ! $editable) {
1472+
if (! $editable) {
14721473
$displayParts = DisplayParts::fromArray([
14731474
'hasEditLink' => false,
14741475
'deleteLink' => DisplayParts::NO_DELETE,

‎phpstan-baseline.neon‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5045,11 +5045,6 @@ parameters:
50455045
count: 1
50465046
path: libraries/classes/LanguageManager.php
50475047

5048-
-
5049-
message: "#^Property PhpMyAdmin\\\\LanguageManager\\:\\:\\$languageData type has no value type specified in iterable type array\\.$#"
5050-
count: 1
5051-
path: libraries/classes/LanguageManager.php
5052-
50535048
-
50545049
message: "#^Unsafe access to private property PhpMyAdmin\\\\LanguageManager\\:\\:\\$languageData through static\\:\\:\\.$#"
50555050
count: 2

0 commit comments

Comments
 (0)