From 22839d92afcb51b8bd79810b2f9e50fcca1a5b7e Mon Sep 17 00:00:00 2001
From: Alexander Makarov <sam@rmcreative.ru>
Date: Mon, 25 Aug 2014 17:04:08 +0400
Subject: [PATCH] Fixes #4812: Fixed search filter

---
 extensions/debug/CHANGELOG.md                          | 3 ++-
 extensions/debug/components/search/matchers/SameAs.php | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/extensions/debug/CHANGELOG.md b/extensions/debug/CHANGELOG.md
index ba4a9c4..9e1432c 100644
--- a/extensions/debug/CHANGELOG.md
+++ b/extensions/debug/CHANGELOG.md
@@ -5,7 +5,8 @@ Yii Framework 2 debug extension Change Log
 --------------------------
 
 - Bug #1263: Fixed the issue that Gii and Debug modules might be affected by incompatible asset manager configuration (qiangxue)
-- Bug #3956: Debug toolbar was affecting flash message removal (samdark) 
+- Bug #3956: Debug toolbar was affecting flash message removal (samdark)
+- Bug #4812: Fixed search filter (samdark)
 - Enh #2299: Date and time in request list is now never wrapped (samdark)
 - Enh #3088: The debug module will manage their own URL rules now (qiangxue)
 - Enh #3103: debugger panel is now not displayed when printing a page (githubjeka)
diff --git a/extensions/debug/components/search/matchers/SameAs.php b/extensions/debug/components/search/matchers/SameAs.php
index 65bdadc..a0aea86 100644
--- a/extensions/debug/components/search/matchers/SameAs.php
+++ b/extensions/debug/components/search/matchers/SameAs.php
@@ -26,10 +26,10 @@ class SameAs extends Base
      */
     public function match($value)
     {
-        if (!$this->partial) {
-            return (mb_strtolower($this->baseValue, 'utf8') == mb_strtolower($value, 'utf8'));
+        if ($this->partial) {
+            return mb_stripos($value, $this->baseValue, \Yii::$app->charset) !== false;
         } else {
-            return (mb_strpos(mb_strtolower($value, 'utf8'), mb_strtolower($this->baseValue, 'utf8')) !== false);
+            return strcmp(mb_strtoupper($this->baseValue, \Yii::$app->charset), mb_strtoupper($value, \Yii::$app->charset)) === 0;
         }
     }
 }
--
libgit2 0.27.1