Further tweaks to safe and lang injection 2, a=chris
Further tweaks to safe and lang injection 2, a=chris
diff --git a/src/models/PhraseModel.php b/src/models/PhraseModel.php
index fe039efd9..387143584 100755
--- a/src/models/PhraseModel.php
+++ b/src/models/PhraseModel.php
@@ -753,8 +753,8 @@ class PhraseModel extends ParallelModel
$weight = substr($matches[2][0], strlen($meta_word));
}
}
- if (!empty($matches[0]) && substr($matches[0], 0, 11)
- == 'media:image') {
+ if (!empty($matches[0]) && is_string($matches[0])
+ && substr($matches[0], 0, 11) == 'media:image') {
$found_media_image = true;
}
if ($meta_word == 'safe:' && !empty($matches[0])) {
@@ -773,7 +773,7 @@ class PhraseModel extends ParallelModel
}
$found_metas = array_unique($found_metas);
if (!$found_media_image &&
- (!empty($found_metas) || !empty($phrase_string)) {
+ (!empty($found_metas) || !empty($phrase_string))) {
if (!$found_lang) {
$lang_parts = explode("-", $locale_tag);
$found_metas[] = "lang:" . $lang_parts[0];
@@ -1554,7 +1554,7 @@ class PhraseModel extends ParallelModel
$out_query = "";
$pipe = "";
foreach ($disjunct_phrases as $disjunct) {
- if (!stristr($disjunct, "lang:")&&
+ if (!stristr($disjunct, "lang:") &&
!stristr($disjunct, "media:image")) {
$locale_tag = L\guessLocaleFromString($original_query);
$lang_parts = explode("-", $locale_tag);