From b680bb6a90ec89623f789cbd14ada889eac08a53 Mon Sep 17 00:00:00 2001 From: Alex Debril Date: Mon, 28 May 2018 13:46:15 +0200 Subject: [PATCH 1/2] Filter BOM characters (#175) --- src/FeedIo/Reader/Document.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FeedIo/Reader/Document.php b/src/FeedIo/Reader/Document.php index 24f6269a..a8b61d7a 100644 --- a/src/FeedIo/Reader/Document.php +++ b/src/FeedIo/Reader/Document.php @@ -34,7 +34,7 @@ class Document */ public function __construct(string $content) { - $this->content = trim($content); + $this->content = trim(str_replace("\xEF\xBB\xBF",'', $content)); } /** @@ -43,7 +43,7 @@ public function __construct(string $content) */ public function startWith(string $character) : bool { - return substr($this->content, 0, 1) === $character; + return mb_substr($this->content, 0, 1) === $character; } /** From d55dc85494325cb55fdea38b3484e70c257cad1b Mon Sep 17 00:00:00 2001 From: Alex Debril Date: Mon, 28 May 2018 13:49:23 +0200 Subject: [PATCH 2/2] Fix CS --- src/FeedIo/Reader/Document.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FeedIo/Reader/Document.php b/src/FeedIo/Reader/Document.php index a8b61d7a..9f26eb78 100644 --- a/src/FeedIo/Reader/Document.php +++ b/src/FeedIo/Reader/Document.php @@ -34,7 +34,7 @@ class Document */ public function __construct(string $content) { - $this->content = trim(str_replace("\xEF\xBB\xBF",'', $content)); + $this->content = trim(str_replace("\xEF\xBB\xBF", '', $content)); } /**