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
- [x] a bug report
- [ ] a feature request
- [x] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)
What is the expected behavior?
See below
What is the current behavior?
See below
What are the steps to reproduce?
An empty argument passed to a function on the False side of an IF function will cause an "Internal Error" when evaluated. I initially thought this might be due to PR #3868, but this also happened before the PR. In addition, that PR affected only 4 functions, and this problem will arise when an argument is omitted from any function.
FixPHPOffice#3875. Even better, fixPHPOffice#2146, which has been open for 2.5 years.
Empty arguments are improperly placed on the stack; in particular, they are added without `onlyIf` and `onlyIfNot` attributes.This results in problems described in 3875.
IF has a somewhat unexpected design. In Excel, `IF(false, valueIfTrue)` evaluates as `false`, but `IF(false, valueIfTrue,)` evaluates as 0. This means that IF empty arguments should be handled in the same manner as MIN/MAX/MINA/MAXA, but you need to be careful to distinguish empty from omitted.
Also note that IF requires 2 operands - `IF(true)` is an error, but `IF(true,)` evaluates to 0.
This is:
What is the expected behavior?
See below
What is the current behavior?
See below
What are the steps to reproduce?
An empty argument passed to a function on the False side of an IF function will cause an "Internal Error" when evaluated. I initially thought this might be due to PR #3868, but this also happened before the PR. In addition, that PR affected only 4 functions, and this problem will arise when an argument is omitted from any function.
Disabling branch pruning eliminates the problem.
A1 will be correctly calculated as 99 without pruning, but will receive an internal error with pruning.
There is no problem if no argument is omitted.
A1 will be correctly calculated as 99 with or without pruning.
There is no problem if an argument is omitted on the TRUE side.
A1 will be correctly calculated as 0 with or without pruning.
What features do you think are causing the issue
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
All
Which versions of PhpSpreadsheet and PHP are affected?
All
The text was updated successfully, but these errors were encountered: