Skip to content

Commit 26d58b4

Browse files
authored
Merge branch 'master' into powernullarg
2 parents f8d994b + 1314f82 commit 26d58b4

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/PhpSpreadsheet/Reader/Html.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,8 @@ public function canRead(string $filename): bool
147147
return false;
148148
}
149149

150-
$beginning = $this->readBeginning();
151-
if (preg_match(self::STARTS_WITH_BOM, $beginning)) {
152-
return true;
153-
}
150+
$beginning = preg_replace(self::STARTS_WITH_BOM, '', $this->readBeginning()) ?? '';
151+
154152
$startWithTag = self::startsWithTag($beginning);
155153
$containsTags = self::containsTags($beginning);
156154
$endsWithTag = self::endsWithTag($this->readEnding());

tests/PhpSpreadsheetTests/IOFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public static function providerIdentify(): array
102102
// Following not readable by Excel.
103103
//['samples/templates/Excel2003XMLTest.xml', 'Xml', Reader\Xml::class],
104104
['samples/templates/46readHtml.html', 'Html', Reader\Html::class],
105+
['tests/data/Reader/CSV/encoding.utf8bom.csv', 'Csv', Reader\Csv::class],
105106
];
106107
}
107108

0 commit comments

Comments
 (0)