Skip to content

Commit a7b222d

Browse files
committed
Merge branch 'origin/QA_5_2'
Signed-off-by: William Desportes <williamdes@wdes.fr>
2 parents 2889205 + 65c9f49 commit a7b222d

11 files changed

Lines changed: 786 additions & 116 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Bug report
3-
about: Create a report to help us improve
3+
about: Create a report to help us improve phpMyAdmin
44

55
---
66

@@ -22,7 +22,7 @@ A clear and concise description of what you expected to happen.
2222

2323
### Screenshots
2424

25-
If applicable, add screenshots to help explain your problem.
25+
If applicable, add screenshots to help explain the bug.
2626

2727
### Server configuration
2828

@@ -39,4 +39,4 @@ If applicable, add screenshots to help explain your problem.
3939

4040
### Additional context
4141

42-
Add any other context about the problem here.
42+
Add any other context about the bug here.

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ phpMyAdmin - ChangeLog
3434
- issue #17308 Fix broken pagination links in the navigation sidebar
3535
- issue #17331 Fix MariaDB has no support for system variable "disabled_storage_engines"
3636
- issue #17315 Fix unsupported operand types in Results.php when running "SHOW PROCESSLIST" SQL query
37+
- issue #17288 Fixed importing browser settings question box after login when having no pmadb
38+
- issue #17288 Fix "First day of calendar" user override has no effect
39+
- issue #17239 Fixed repeating headers are not working
40+
- issue #17298 Fixed import of email-adresses or links from ODS results in empty contents
41+
- issue #17344 Fixed a type error on ODS import with non string values
42+
- issue #17239 Fixed header row show/hide columns buttons on each line after hover are shown on each row
3743

3844
5.1.2 (2022-01-20)
3945
- issue Replaced MySQL documentation redirected links

js/src/functions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,6 +1187,9 @@ Functions.insertQuery = function (queryType) {
11871187
codeMirrorEditor.setValue(data.sql);
11881188
}
11891189
$('#querymessage').html('');
1190+
},
1191+
error: function () {
1192+
$('#querymessage').html('');
11901193
}
11911194
});
11921195
}

libraries/classes/Display/Results.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2885,12 +2885,6 @@ private function getRepeatingHeaders(
28852885
* @param string $urlSqlQuery the analyzed sql query
28862886
*
28872887
* @return array<int,string|array<string, bool|string>>
2888-
* @phpstan-return array{string, string, string, string,
2889-
* array{
2890-
* db: string, table: string, where_clause: string,
2891-
* clause_is_unique: bool, sql_query: string, goto: string
2892-
* }
2893-
* }
28942888
*/
28952889
private function getModifiedLinks(
28962890
$whereClause,

libraries/classes/Header.php

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ class Header
4747
* @var Menu
4848
*/
4949
private $menu;
50-
/**
51-
* Whether to offer the option of importing user settings
52-
*
53-
* @var bool
54-
*/
55-
private $userprefsOfferImport;
5650
/**
5751
* The page title
5852
*
@@ -123,13 +117,6 @@ public function __construct()
123117
$this->scripts = new Scripts();
124118
$this->addDefaultScripts();
125119
$this->headerIsSent = false;
126-
// if database storage for user preferences is transient,
127-
// offer to load exported settings from localStorage
128-
// (detection will be done in JavaScript)
129-
$this->userprefsOfferImport = false;
130-
if ($GLOBALS['config']->get('user_preferences') === 'session' && ! isset($_SESSION['userprefs_autoload'])) {
131-
$this->userprefsOfferImport = true;
132-
}
133120

134121
$this->userPreferences = new UserPreferences();
135122
}
@@ -156,34 +143,25 @@ private function addDefaultScripts(): void
156143
$this->scripts->addFile('menu_resizer.js');
157144

158145
// Cross-framing protection
146+
// At this point browser settings are not merged
147+
// this is good that we only use file configuration for this protection
159148
if ($GLOBALS['cfg']['AllowThirdPartyFraming'] === false) {
160149
$this->scripts->addFile('cross_framing_protection.js');
161150
}
162151

163-
if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') {
164-
$this->scripts->addFile('vendor/tracekit.js');
165-
$this->scripts->addFile('error_report.js');
166-
}
152+
$this->scripts->addFile('rte.js');
167153

168154
// Here would not be a good place to add CodeMirror because
169155
// the user preferences have not been merged at this point
170156

171157
$this->scripts->addFile('messages.php', ['l' => $GLOBALS['lang']]);
172-
$this->scripts->addCode($this->getVariablesForJavaScript());
173158
$this->scripts->addFile('config.js');
174159
$this->scripts->addFile('doclinks.js');
175160
$this->scripts->addFile('functions.js');
176161
$this->scripts->addFile('navigation.js');
177162
$this->scripts->addFile('indexes.js');
178163
$this->scripts->addFile('common.js');
179164
$this->scripts->addFile('page_settings.js');
180-
if ($GLOBALS['cfg']['enable_drag_drop_import'] === true) {
181-
$this->scripts->addFile('drag_drop_import.js');
182-
}
183-
184-
if (! $GLOBALS['config']->get('DisableShortcutKeys')) {
185-
$this->scripts->addFile('shortcuts_handler.js');
186-
}
187165

188166
$this->scripts->addCode($this->getJsParamsCode());
189167
}
@@ -355,7 +333,7 @@ public function getDisplay(): string
355333
$version = self::getVersionParameter();
356334

357335
// The user preferences have been merged at this point
358-
// so we can conditionally add CodeMirror
336+
// so we can conditionally add CodeMirror, other scripts and settings
359337
if ($GLOBALS['cfg']['CodemirrorEnable']) {
360338
$this->scripts->addFile('vendor/codemirror/lib/codemirror.js');
361339
$this->scripts->addFile('vendor/codemirror/mode/sql/sql.js');
@@ -368,10 +346,36 @@ public function getDisplay(): string
368346
}
369347
}
370348

349+
if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') {
350+
$this->scripts->addFile('vendor/tracekit.js');
351+
$this->scripts->addFile('error_report.js');
352+
}
353+
354+
if ($GLOBALS['cfg']['enable_drag_drop_import'] === true) {
355+
$this->scripts->addFile('drag_drop_import.js');
356+
}
357+
358+
if (! $GLOBALS['config']->get('DisableShortcutKeys')) {
359+
$this->scripts->addFile('shortcuts_handler.js');
360+
}
361+
362+
$this->scripts->addCode($this->getVariablesForJavaScript());
363+
371364
$this->scripts->addCode('ConsoleEnterExecutes=' . ($GLOBALS['cfg']['ConsoleEnterExecutes'] ? 'true' : 'false'));
372365
$this->scripts->addFiles($this->console->getScripts());
373366

374-
if ($this->userprefsOfferImport) {
367+
// if database storage for user preferences is transient,
368+
// offer to load exported settings from localStorage
369+
// (detection will be done in JavaScript)
370+
$userprefsOfferImport = false;
371+
if (
372+
$GLOBALS['config']->get('user_preferences') === 'session'
373+
&& ! isset($_SESSION['userprefs_autoload'])
374+
) {
375+
$userprefsOfferImport = true;
376+
}
377+
378+
if ($userprefsOfferImport) {
375379
$this->scripts->addFile('config.js');
376380
}
377381

@@ -387,7 +391,7 @@ public function getDisplay(): string
387391
$customHeader = Config::renderHeader();
388392

389393
// offer to load user preferences from localStorage
390-
if ($this->userprefsOfferImport) {
394+
if ($userprefsOfferImport) {
391395
$loadUserPreferences = $this->userPreferences->autoloadGetHeader();
392396
}
393397

libraries/classes/Plugins/Import/ImportOds.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ public function doImport(?File $importHandle = null, array &$sql_data = []): voi
232232
/**
233233
* Get value
234234
*
235-
* @param array $cell_attrs Cell attributes
236-
* @param array $text Texts
235+
* @param SimpleXMLElement $cell_attrs Cell attributes
236+
* @param SimpleXMLElement $text Texts
237237
*
238238
* @return float|string
239239
*/
@@ -258,7 +258,15 @@ protected function getValue($cell_attrs, $text)
258258
/* We need to concatenate all paragraphs */
259259
$values = [];
260260
foreach ($text as $paragraph) {
261-
$values[] = (string) $paragraph;
261+
// Maybe a text node has the content ? (email, url, ...)
262+
// Example: <text:a ... xlink:href="mailto:contact@example.org">test@example.fr</text:a>
263+
$paragraphValue = $paragraph->__toString();
264+
if ($paragraphValue === '' && isset($paragraph->{'a'})) {
265+
$values[] = $paragraph->{'a'}->__toString();
266+
continue;
267+
}
268+
269+
$values[] = $paragraphValue;
262270
}
263271

264272
return implode("\n", $values);
@@ -365,7 +373,7 @@ private function iterateOverRows(
365373
if (! $col_names_in_first_row) {
366374
if ($_REQUEST['ods_empty_rows'] ?? false) {
367375
foreach ($tempRow as $cell) {
368-
if (strcmp('NULL', $cell)) {
376+
if (strcmp('NULL', (string) $cell)) {
369377
$tempRows[] = $tempRow;
370378
break;
371379
}

phpstan-baseline.neon

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,6 +2865,16 @@ parameters:
28652865
count: 1
28662866
path: libraries/classes/Display/Results.php
28672867

2868+
-
2869+
message: "#^Binary operation \"\\+\" between array\\<string, bool\\|string\\>\\|string and array\\{default_action\\: 'insert'\\} results in an error\\.$#"
2870+
count: 3
2871+
path: libraries/classes/Display/Results.php
2872+
2873+
-
2874+
message: "#^Binary operation \"\\+\" between array\\<string, bool\\|string\\>\\|string and array\\{default_action\\: 'update'\\} results in an error\\.$#"
2875+
count: 3
2876+
path: libraries/classes/Display/Results.php
2877+
28682878
-
28692879
message: "#^Cannot access offset int\\<0, max\\> on mixed\\.$#"
28702880
count: 2
@@ -6175,16 +6185,6 @@ parameters:
61756185
count: 1
61766186
path: libraries/classes/Plugins/Import/ImportOds.php
61776187

6178-
-
6179-
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:getValue\\(\\) has parameter \\$cell_attrs with no value type specified in iterable type array\\.$#"
6180-
count: 1
6181-
path: libraries/classes/Plugins/Import/ImportOds.php
6182-
6183-
-
6184-
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:getValue\\(\\) has parameter \\$text with no value type specified in iterable type array\\.$#"
6185-
count: 1
6186-
path: libraries/classes/Plugins/Import/ImportOds.php
6187-
61886188
-
61896189
message: "#^Method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:iterateOverColumns\\(\\) has parameter \\$col_names with no value type specified in iterable type array\\.$#"
61906190
count: 1
@@ -6246,12 +6246,7 @@ parameters:
62466246
path: libraries/classes/Plugins/Import/ImportOds.php
62476247

62486248
-
6249-
message: "#^Parameter \\#1 \\$cell_attrs of method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:getValue\\(\\) expects array, SimpleXMLElement\\|null given\\.$#"
6250-
count: 1
6251-
path: libraries/classes/Plugins/Import/ImportOds.php
6252-
6253-
-
6254-
message: "#^Parameter \\#2 \\$text of method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:getValue\\(\\) expects array, SimpleXMLElement given\\.$#"
6249+
message: "#^Parameter \\#1 \\$cell_attrs of method PhpMyAdmin\\\\Plugins\\\\Import\\\\ImportOds\\:\\:getValue\\(\\) expects SimpleXMLElement, SimpleXMLElement\\|null given\\.$#"
62556250
count: 1
62566251
path: libraries/classes/Plugins/Import/ImportOds.php
62576252

psalm-baseline.xml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="4.19.0@a2ad69ae4f5ab1f7d225a8dc4e2ec2d9415ed599">
2+
<files psalm-version="4.20.0@f82a70e7edfc6cf2705e9374c8a0b6a974a779ed">
33
<file src="index.php">
44
<InvalidGlobal occurrences="1">
55
<code>global $containerBuilder;</code>
@@ -5983,6 +5983,14 @@
59835983
<code>$this-&gt;properties['num_rows'] &gt; 0 ? $this-&gt;properties['num_rows'] - 1 : 0</code>
59845984
<code>$this-&gt;properties['num_rows'] &gt; 0 ? $this-&gt;properties['num_rows'] - 1 : 0</code>
59855985
</PossiblyInvalidArgument>
5986+
<PossiblyInvalidOperand occurrences="6">
5987+
<code>$editCopyUrlParams</code>
5988+
<code>$editCopyUrlParams</code>
5989+
<code>$editCopyUrlParams</code>
5990+
<code>$editCopyUrlParams</code>
5991+
<code>$editCopyUrlParams</code>
5992+
<code>$editCopyUrlParams</code>
5993+
</PossiblyInvalidOperand>
59865994
<PossiblyNullArgument occurrences="1">
59875995
<code>$colVisibCurrent</code>
59885996
</PossiblyNullArgument>
@@ -10317,12 +10325,7 @@
1031710325
</ReferenceConstraintViolation>
1031810326
</file>
1031910327
<file src="libraries/classes/Plugins/Import/ImportOds.php">
10320-
<InvalidArgument occurrences="2">
10321-
<code>$cell_attrs</code>
10322-
<code>$text</code>
10323-
</InvalidArgument>
10324-
<MixedArgument occurrences="19">
10325-
<code>$cell</code>
10328+
<MixedArgument occurrences="18">
1032610329
<code>$col_names</code>
1032710330
<code>$col_names</code>
1032810331
<code>$db</code>
@@ -10342,6 +10345,9 @@
1034210345
<code>$tempRows[$i]</code>
1034310346
<code>$tempRows[0]</code>
1034410347
</MixedArgument>
10348+
<MixedArgumentTypeCoercion occurrences="1">
10349+
<code>$values</code>
10350+
</MixedArgumentTypeCoercion>
1034510351
<MixedArrayAccess occurrences="8">
1034610352
<code>$rows[$j]</code>
1034710353
<code>$rows[$j]</code>
@@ -10361,12 +10367,15 @@
1036110367
<MixedAssignment occurrences="7">
1036210368
<code>$cell</code>
1036310369
<code>$max_cols</code>
10364-
<code>$paragraph</code>
1036510370
<code>$tables[$i][Import::ROWS]</code>
1036610371
<code>$tables[$i][]</code>
1036710372
<code>$tempRows[]</code>
1036810373
<code>$tempRows[]</code>
10374+
<code>$values[]</code>
1036910375
</MixedAssignment>
10376+
<MixedMethodCall occurrences="1">
10377+
<code>__toString</code>
10378+
</MixedMethodCall>
1037010379
<MixedPropertyFetch occurrences="1">
1037110380
<code>$xml-&gt;children('office', true)-&gt;{'body'}-&gt;{'spreadsheet'}</code>
1037210381
</MixedPropertyFetch>

0 commit comments

Comments
 (0)