You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the index of the entry on success or FALSE on failure.
The Reader\Xlsx::getFromZipArchive function does not check whether the return value of ZipArchive::locateName is false. When it is, it's passed straight into ZipArchive::getFromIndex, which casts it to an integer, resulting in it retrieving the entry at index 0.
Previously the function did not check whether the return value of `ZipArchive::locateName`
was `false`. And when it was, it was passed straight into `ZipArchive::getFromIndex`,
which casts it to an integer, resulting in it incorrectly retrieving the entry at index `0`.
FixesPHPOffice#262ClosesPHPOffice#268
This is:
What is the expected behavior?
The
Reader\Xlsx::getFromZipArchive
function should returnfalse
if the zip entry could not be located.What is the current behavior?
If it exists, the contents of the zip entry at index
0
is returned.What are the steps to reproduce?
Provided upon (further) request. 😅
Which versions of PhpSpreadsheet and PHP are affected?
All PhpSpreadsheet versions. Tested on PHP 7.0.17.
ZipArchive::locateName
The
Reader\Xlsx::getFromZipArchive
function does not check whether the return value ofZipArchive::locateName
isfalse
. When it is, it's passed straight intoZipArchive::getFromIndex
, which casts it to an integer, resulting in it retrieving the entry at index0
.PhpSpreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php
Lines 304 to 312 in 25ff914
ZipArchive::getFromName
appears to be a good alternative:The text was updated successfully, but these errors were encountered: