From 483ef49d7ca49c6e7eea8288db9fb4bdd59cdc58 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 16 Sep 2013 17:26:29 +0200 Subject: manually convert ' to ' because its not built into PHP for author an title --- tests/unit/utility/FeedFetcherTest.php | 4 ++-- utility/feedfetcher.php | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/unit/utility/FeedFetcherTest.php b/tests/unit/utility/FeedFetcherTest.php index 7bbf54371..3865bda9f 100644 --- a/tests/unit/utility/FeedFetcherTest.php +++ b/tests/unit/utility/FeedFetcherTest.php @@ -104,7 +104,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $this->url = 'http://tests'; $this->permalink = 'http://permalink'; - $this->title = 'my title&lt;'; + $this->title = 'my&lt;' title'; $this->guid = 'hey guid here'; $this->body = 'let the bodies hit the floor test'; $this->body2 = 'let the bodies hit the floor test'; @@ -196,7 +196,7 @@ class FeedFetcherTest extends \OCA\AppFramework\Utility\TestUtility { $item->setStatus(0); $item->setUnread(); $item->setUrl($this->permalink); - $item->setTitle(html_entity_decode(html_entity_decode($this->title))); + $item->setTitle('my<\' title'); $item->setGuid($this->guid); $item->setGuidHash(md5($this->guid)); $item->setBody($this->body2); diff --git a/utility/feedfetcher.php b/utility/feedfetcher.php index 2475e7c27..e36fe3beb 100644 --- a/utility/feedfetcher.php +++ b/utility/feedfetcher.php @@ -112,8 +112,15 @@ class FeedFetcher implements IFeedFetcher { private function decodeTwice($string) { - return html_entity_decode( - html_entity_decode($string, ENT_COMPAT, 'UTF-8'), ENT_COMPAT, 'UTF-8' + // behold! ' is not converted by PHP thats why we need to do it + // manually (TM) + return str_replace(''', '\'', + html_entity_decode( + html_entity_decode( + $string, ENT_QUOTES, 'UTF-8' + ), + ENT_QUOTES, 'UTF-8' + ) ); } -- cgit v1.2.3