If your CSV file just contains "<" symbol in any position of the first 2048 bytes it will be incorrectly identified as an HTML file if you're using PHPExcel_IOFactory::identify() call to determine a reader for needed files.
After returning the reader any attempts to load the file will fail with the following error message (obviously, because it is not an HTML document):
DOMDocument::loadHTML(): htmlParseStartTag: invalid element name in Entity, line: 59 in phpoffice/phpexcel/Classes/PHPExcel/Reader/HTML.php:478
I'd recommend to use another way of checking to make sure it's really HTML file, or at least allow user to override PHPExcel_IOFactory::$_autoResolveClasses so it would be possible to remove HTML from there.
The issue is related to code of that function:
https://github.com/PHPOffice/PHPExcel/blob/185bf412339526c97a98d959c3c0ecf4b7c80016/Classes/PHPExcel/Reader/HTML.php#L131-L141
If your CSV file just contains "<" symbol in any position of the first 2048 bytes it will be incorrectly identified as an HTML file if you're using
PHPExcel_IOFactory::identify()
call to determine a reader for needed files. After returning the reader any attempts to load the file will fail with the following error message (obviously, because it is not an HTML document):DOMDocument::loadHTML(): htmlParseStartTag: invalid element name in Entity, line: 59 in phpoffice/phpexcel/Classes/PHPExcel/Reader/HTML.php:478
I'd recommend to use another way of checking to make sure it's really HTML file, or at least allow user to override
PHPExcel_IOFactory::$_autoResolveClasses
so it would be possible to remove HTML from there.Thanks.