parent
5441b2fa73
commit
75dfcb5a36
|
@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
- Call garbage collector after removing a column to prevent stale cached values
|
||||
- Trying to remove a column that doesn't exist deletes the latest column
|
||||
- Keep big integer as integer instead of lossely casting to float [#874](https://github.com/PHPOffice/PhpSpreadsheet/pull/874)
|
||||
- Fix branch pruning handling of non boolean conditions [#1167](https://github.com/PHPOffice/PhpSpreadsheet/pull/1167)
|
||||
|
||||
## [1.9.0] - 2019-08-17
|
||||
|
||||
|
|
|
@ -3809,13 +3809,19 @@ class Calculation
|
|||
if ($this->branchPruningEnabled && isset($tokenData['onlyIf'])) {
|
||||
$onlyIfStoreKey = $tokenData['onlyIf'];
|
||||
$storeValue = $branchStore[$onlyIfStoreKey] ?? null;
|
||||
$storeValueAsBool = ($storeValue === null) ?
|
||||
true : (bool) Functions::flattenSingleValue($storeValue);
|
||||
if (is_array($storeValue)) {
|
||||
$wrappedItem = end($storeValue);
|
||||
$storeValue = end($wrappedItem);
|
||||
}
|
||||
|
||||
if (isset($storeValue) && (($storeValue !== true)
|
||||
|| ($storeValue === 'Pruned branch'))
|
||||
if (isset($storeValue)
|
||||
&& (
|
||||
!$storeValueAsBool
|
||||
|| Functions::isError($storeValue)
|
||||
|| ($storeValue === 'Pruned branch')
|
||||
)
|
||||
) {
|
||||
// If branching value is not true, we don't need to compute
|
||||
if (!isset($fakedForBranchPruning['onlyIf-' . $onlyIfStoreKey])) {
|
||||
|
@ -3838,12 +3844,17 @@ class Calculation
|
|||
if ($this->branchPruningEnabled && isset($tokenData['onlyIfNot'])) {
|
||||
$onlyIfNotStoreKey = $tokenData['onlyIfNot'];
|
||||
$storeValue = $branchStore[$onlyIfNotStoreKey] ?? null;
|
||||
$storeValueAsBool = ($storeValue === null) ?
|
||||
true : (bool) Functions::flattenSingleValue($storeValue);
|
||||
if (is_array($storeValue)) {
|
||||
$wrappedItem = end($storeValue);
|
||||
$storeValue = end($wrappedItem);
|
||||
}
|
||||
if (isset($storeValue) && ($storeValue
|
||||
|| ($storeValue === 'Pruned branch'))
|
||||
if (isset($storeValue)
|
||||
&& (
|
||||
$storeValueAsBool
|
||||
|| Functions::isError($storeValue)
|
||||
|| ($storeValue === 'Pruned branch'))
|
||||
) {
|
||||
// If branching value is true, we don't need to compute
|
||||
if (!isset($fakedForBranchPruning['onlyIfNot-' . $onlyIfNotStoreKey])) {
|
||||
|
|
|
@ -55,7 +55,14 @@ function calculationTestDataGenerator()
|
|||
$formula3 = '=IF(A4="take A", A3, B3)';
|
||||
$set8 = [4, $dataArray5, $formula3, 'E5', ['A3'], ['B3']];
|
||||
|
||||
return [$set0, $set1, $set2, $set3, $set4, $set5, $set6, $set7, $set8];
|
||||
$dataArray6 = [
|
||||
['=IF(22,"a","b")']
|
||||
];
|
||||
$set9 = ['a', $dataArray6, '=A1', 'A2'];
|
||||
|
||||
return [
|
||||
$set0, $set1, $set2, $set3, $set4, $set5, $set6, $set7, $set8, $set9
|
||||
];
|
||||
}
|
||||
|
||||
return calculationTestDataGenerator();
|
||||
|
|
Loading…
Reference in New Issue