fix non utf-8 strings in article body, title, guid and author

This commit is contained in:
Bernhard Posselt 2013-12-12 21:56:10 +01:00
Родитель 35558e6b51
Коммит 321584dc33
1 изменённых файлов: 14 добавлений и 0 удалений

Просмотреть файл

@ -152,6 +152,20 @@ class Item extends Entity implements IAPI {
}
public function fromRow(array $array) {
// sanitize them fucked up non utf-8 strings because PHP's glorious idea
// on how to handle non utf-8 srtings in json_encode is to just *BOOM*
// in your face, which results in a spinning wheel. Forever.
foreach($array as $key => $value) {
if($key === 'body' || $key === 'author' || $key === 'title' ||
$key === 'guid' || $key === 'guidHash') {
$array[$key] === iconv('UTF-8', 'UTF-8//IGNORE', $value);
}
}
parent::fromRow($array);
}
public function setAuthor($name) {
parent::setAuthor(strip_tags($name));
}