From 2a36babbc881be5db02f1f74d859e6ca1100243b Mon Sep 17 00:00:00 2001 From: David Monllao Date: Fri, 29 Jul 2016 13:59:32 +0800 Subject: [PATCH] MDL-55357 search: Contents include UTF8 characters, adding u modifier --- course/tests/search_test.php | 2 +- search/classes/document.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/course/tests/search_test.php b/course/tests/search_test.php index 5512e07814c..e8ed2fa4c32 100644 --- a/course/tests/search_test.php +++ b/course/tests/search_test.php @@ -123,7 +123,7 @@ class course_search_testcase extends advanced_testcase { $this->assertEquals($course->fullname, $doc->get('title')); // Not nice. Applying \core_search\document::set line breaks clean up. - $summary = preg_replace("/\s+/", " ", content_to_text($course->summary, $course->summaryformat)); + $summary = preg_replace("/\s+/u", " ", content_to_text($course->summary, $course->summaryformat)); $this->assertEquals($summary, $doc->get('content')); $this->assertEquals($course->shortname, $doc->get('description1')); } diff --git a/search/classes/document.php b/search/classes/document.php index 635fbdd8b48..7ed70558781 100644 --- a/search/classes/document.php +++ b/search/classes/document.php @@ -277,7 +277,7 @@ class document implements \renderable, \templatable { $this->data[$fieldname] = intval($value); } else { // Replace all groups of line breaks and spaces by single spaces. - $this->data[$fieldname] = preg_replace("/\s+/", " ", $value); + $this->data[$fieldname] = preg_replace("/\s+/u", " ", $value); } return $this->data[$fieldname];