Open BlackbitDevs opened 1 week ago
PS: I stumbled upon the int-cast. The method
isActive()
returns boolean but_readHeader()
contains$this->active = (int)$xmlReader->getAttribute('tabSelected');
- how can$this->active
actually become abool
?
protected ?bool $active = null;
Any int value gets juggled to a boolean value when assigned to a typed (boolean) property
So
$this->active = 1 // true
$this->active = 0 // false
$this->active = 420 // true
In https://github.com/aVadim483/fast-excel-reader/blob/53b2725954cabfa898b67e76ea36e873e870ad19/src/FastExcelReader/Sheet.php#L295-L302
$this->active
gets set via https://github.com/aVadim483/fast-excel-reader/blob/53b2725954cabfa898b67e76ea36e873e870ad19/src/FastExcelReader/Sheet.php#L374But if this line does not get executed,
$this->active
staysnull
which results in a PHP TypeError (because the method is required to returnbool
). Am not sure if this is the desired behaviour or in other words if https://github.com/aVadim483/fast-excel-reader/blob/53b2725954cabfa898b67e76ea36e873e870ad19/src/FastExcelReader/Sheet.php#L373-L375 actually should get executed for EVERY valid Excel file. But in our case it was not.PS: I stumbled upon the int-cast. The method
isActive()
returns boolean but_readHeader()
contains$this->active = (int)$xmlReader->getAttribute('tabSelected');
- how can$this->active
actually become abool
?