-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HLookup::hLookupSearch(..) sends wrong arguments to LookupBase::checkMatch(..). #2123
Comments
This is still and issue for us so I created a test excel sheet to demonstrate the problem. Running this code:
On this excel spreadsheet: hlookup-test.xlsx Results in:
ping @MarkBaker let me know if I should provide any more information ;-) |
Hi! I had the same problem.
Also waiting for a solution to the problem. =) |
See issue PHPOffice#2123. HLOOKUP needs to do some conversions between column numbers and letters which it had not been doing. HLOOKUP tests were performed using direct calls to the function in question rather than in the context of a spreadsheet. This contributed to keeping this error obscured even though there were, in theory, sufficient test cases. The tests are changed to perform in spreadsheet context. For the most part, the test cases are unchanged. One of the expected results was wrong; it has been changed, and a new case added to cover the case it was supposed to be testing. After getting the HLOOKUP tests in order, it turned out that a test using literal arrays which had been succeeding now failed. The array constructed by the literals are considerably different than those constructed using spreadsheet cells; additional code was added to handle this situation.
See issue #2123. HLOOKUP needs to do some conversions between column numbers and letters which it had not been doing. HLOOKUP tests were performed using direct calls to the function in question rather than in the context of a spreadsheet. This contributed to keeping this error obscured even though there were, in theory, sufficient test cases. The tests are changed to perform in spreadsheet context. For the most part, the test cases are unchanged. One of the expected results was wrong; it has been changed, and a new case added to cover the case it was supposed to be testing. After getting the HLOOKUP tests in order, it turned out that a test using literal arrays which had been succeeding now failed. The array constructed by the literals are considerably different than those constructed using spreadsheet cells; additional code was added to handle this situation.
Fixed in 1.19.0 |
This is:
What is the expected behavior?
Calling
$cell->getCalculatedValue()
($cell
is instance ofPhpOffice\PhpSpreadsheet\Cell
) should work but it fails with the latest master.What is the current behavior?
After $cell->getCalculatedValue() is called, the program fails with following error:
Here is the $cell variable value before
$cell->getCalculatedValue()
is called:And here are the values from a breakpoint right before the error is triggered at
HLookup.php:73, PhpOffice\PhpSpreadsheet\Calculation\LookupRef\HLookup::hLookupSearch()
What are the steps to reproduce?
Unfortunately, I cannot simply share the the excel file that fails because it is from one of our customers but let me know if any more information is needed apart from what was shared above. ;-)
Which versions of PhpSpreadsheet and PHP are affected?
Tested on current master branch with PHP 8.0 and 7.4.
The text was updated successfully, but these errors were encountered: