diff --git a/admin/tool/httpsreplace/classes/url_finder.php b/admin/tool/httpsreplace/classes/url_finder.php index 734c4e1a1ea..152827ed96e 100644 --- a/admin/tool/httpsreplace/classes/url_finder.php +++ b/admin/tool/httpsreplace/classes/url_finder.php @@ -153,7 +153,7 @@ class url_finder { if (in_array($column->type, $texttypes)) { $columnname = $column->name; - $select = "$columnname $regexp ?"; + $select = "LOWER($columnname) $regexp ?"; $rs = $DB->get_recordset_select($table, $select, [$httpurls]); $found = array(); @@ -161,7 +161,7 @@ class url_finder { // Regex to match src=http://etc. and data=http://etc.urls. // Standard warning on expecting regex to perfectly parse HTML // read http://stackoverflow.com/a/1732454 for more info. - $regex = '#(src|data)\ *=\ *[\'\"]http://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))[\'\"]#'; + $regex = '#(src|data)\ *=\ *[\'\"]http://[^\s()<>]+(?:\([\w\d]+\)|([^[:punct:]\s]|/))[\'\"]#i'; preg_match_all($regex, $record->$columnname, $match); foreach ($match[0] as $url) { if (strpos($url, $CFG->wwwroot) !== false) { diff --git a/admin/tool/httpsreplace/tests/httpsreplace_test.php b/admin/tool/httpsreplace/tests/httpsreplace_test.php index bcccff8f051..07bb5ae216f 100644 --- a/admin/tool/httpsreplace/tests/httpsreplace_test.php +++ b/admin/tool/httpsreplace/tests/httpsreplace_test.php @@ -74,6 +74,11 @@ class httpsreplace_test extends \advanced_testcase { "outputregex" => '/^$/', "expectedcontent" => '', ], + "Search for params should be case insensitive" => [ + "content" => '', + "outputregex" => '/UPDATE/', + "expectedcontent" => '', + ], "More params should not interfere" => [ "content" => 'A picture

', "outputregex" => '/UPDATE/',