jenkins-bot has submitted this change and it was merged.

Change subject: Remove use of strencode() in buildLike()
......................................................................


Remove use of strencode() in buildLike()

This may cause unnecessary backslashes (in the case of a literal
% or _) to end up in the query when the DBMS uses C-style string
escaping; however, the query should still work.

Change-Id: I82681f83dd45fcbecf4bfd672f550cd4dba30949
---
M includes/db/Database.php
1 file changed, 2 insertions(+), 6 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/db/Database.php b/includes/db/Database.php
index 16e1ef2..7bbcc2f 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -2539,11 +2539,7 @@
         * @return string
         */
        protected function escapeLikeInternal( $s ) {
-               $s = str_replace( '\\', '\\\\', $s );
-               $s = $this->strencode( $s );
-               $s = str_replace( array( '%', '_' ), array( '\%', '\_' ), $s );
-
-               return $s;
+               return addcslashes( $s, '\%_' );
        }
 
        /**
@@ -2579,7 +2575,7 @@
                        }
                }
 
-               return " LIKE '" . $s . "' ";
+               return " LIKE {$this->addQuotes( $s )} ";
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/138673
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I82681f83dd45fcbecf4bfd672f550cd4dba30949
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: PleaseStand <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to