Merge pull request #2995 from PHPOffice/Matrix-Operations-Additional

Additional for PR #2964; validate value after extracting from flattened array
This commit is contained in:
Mark Baker 2022-08-07 19:15:57 +02:00 committed by GitHub
commit d13b07ba6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -1164,13 +1164,13 @@ class Matrix
*/ */
private function validateExtractedValue($value, bool $validValues): array private function validateExtractedValue($value, bool $validValues): array
{ {
if (!is_numeric($value) && is_array($value)) {
$value = Functions::flattenArray($value)[0];
}
if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) { if ((is_string($value)) && (strlen($value) > 0) && (!is_numeric($value))) {
$value = trim($value, '"'); $value = trim($value, '"');
$validValues &= StringHelper::convertToNumberIfFraction($value); $validValues &= StringHelper::convertToNumberIfFraction($value);
} }
if (!is_numeric($value) && is_array($value)) {
$value = Functions::flattenArray($value)[0];
}
return [$value, $validValues]; return [$value, $validValues];
} }