-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Open
Description
N tests triggered 1 PHP warning:
1) *project_root*/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xml/Style.php:71
Undefined array key "x"
This php warning fails tests, and does not affect anything related to reading xls file.
Seems like there is an issue with the xls file itself, but "x" key is hardcoded here:
case 'Protection':
$locked = $hidden = null;
$styleAttributesP = $styleData->attributes($namespaces['x']); // HERE IT IS
if (isset($styleAttributes['Protected'])) {
$locked = ((bool) (string) $styleAttributes['Protected']) ? Protection::PROTECTION_PROTECTED : Protection::PROTECTION_UNPROTECTED;
}
if (isset($styleAttributesP['HideFormula'])) {
$hidden = ((bool) (string) $styleAttributesP['HideFormula']) ? Protection::PROTECTION_PROTECTED : Protection::PROTECTION_UNPROTECTED;
}
isset/array_key_exists check is missing, so php warning is triggered.
my suggestion is to add array_key_exists
check to avoid reading unexisting keys from unexisting array:
$styleAttributesP = array_key_exists('x',$namespaces) ? $styleData->attributes($namespaces['x']) : [];
Metadata
Metadata
Assignees
Labels
No labels