Skip to content

Commit 56890c5

Browse files
authored
a couple last minute tweaks for 5.2.2 (#1262)
* fix inverted condition in sql string literal detection * last minute tweaks
1 parent 434decb commit 56890c5

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* Bug fix: schedule geolocation db install and other events after an install completes successfully instead of during.
1414
* Bug fix: do not allow multiple requests to install Matomo at the same time.
1515
* Bug fix: do not trigger the golocation db install task during install, if it has run at least once before.
16+
* Bug fix: the normal Matomo site selector should not be displayed on Matomo reporting/admin pages. It is now hidden.
1617

1718
= 5.2.0 =
1819
* Update Matomo core to 5.2.1.

classes/WpMatomo/Db/WordPress.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ public function replace_placeholders( $sql ) {
519519
while ( $segment_end < strlen( $sql ) ) {
520520
if ( $sql[ $segment_end ] === $quote ) {
521521
// '' or ""
522-
$is_double_quote = $segment_end + 1 >= strlen( $sql )
523-
|| $sql[ $segment_end + 1 ] === $quote;
522+
$is_double_quote = $segment_end + 1 < strlen( $sql )
523+
&& $sql[ $segment_end + 1 ] === $quote;
524524

525525
if ( $is_double_quote ) {
526526
++$segment_end;

plugins/WordPress/Auth.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ private function authApiWithTokenAuthAppPassword()
140140
return null;
141141
}
142142
$loggedInUserId = $authenticated->ID;
143-
144143
} finally {
145144
remove_filter('application_password_is_api_request', $callback);
146145
}

tests/phpunit/wpmatomo/db/test-wordpress.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ public function get_test_data_for_replace_placeholders() {
326326
'SELECT "?", "?.?", ? FROM mytable WHERE ? <> "?""" AND """?""" > ?',
327327
'SELECT "?", "?.?", %s FROM mytable WHERE %s <> "?""" AND """?""" > %s',
328328
],
329+
[
330+
'SELECT "?", "?.?", ? FROM mytable WHERE ? <> "?""" AND ? <> """?"""',
331+
'SELECT "?", "?.?", %s FROM mytable WHERE %s <> "?""" AND %s <> """?"""',
332+
],
329333
];
330334
}
331335

0 commit comments

Comments
 (0)