Commit Graph

3267 Commits

Author SHA1 Message Date
MarkBaker f3d5028518 Work on setting up locale-aware formatted number conversion for the Csv Reader
Unit tests for locale-aware boolean conversion for Csv Reader
2022-03-02 08:53:29 +01:00
dependabot[bot] a7a48bf0ca
Bump dompdf/dompdf from 1.1.1 to 1.2.0 (#2633)
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v1.1.1...v1.2.0)

---
updated-dependencies:
- dependency-name: dompdf/dompdf
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 03:58:33 -08:00
dependabot[bot] 30815cc060
Bump phpunit/phpunit from 9.5.13 to 9.5.16 (#2635)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.13 to 9.5.16.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.13...9.5.16)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 03:48:06 -08:00
dependabot[bot] a8ebf45fd7
Bump phpstan/phpstan from 1.4.5 to 1.4.6 (#2634)
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/master/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/1.4.5...1.4.6)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-03-01 03:34:55 -08:00
oleibman f575d2b8b2
Add Ability to Suppress Mac Line Ending Check for CSV Reader (#2623)
With the deprecation of `auto_detect_line_endings` in Php8.1, there have been some tickets (issue #2609 and PR #2438). Although the deprecation message is suppressed, users with a homegrown error handler may still see it. I am not very concerned about that symptom, but I imagine that there will be more similar tickets in future. This PR adds a new property/method to Reader/CSV to allow the user to avoid the deprecated code, at the negligible cost of being unable to read a CSV with Mac line endings even on a Php version that could support it.
2022-03-01 02:01:37 -08:00
oleibman 8258919d72
Phpstan Differences from Php7 to Php8 (#2631)
These changes were already implemented as PR #2428. They were, alas, regressed by PR #2585. If at first you don't succeed ...

As configured, Phpstan running under Php7 reports no errors. However, running under Php8, it reports 100 (!) errors. The vast majority of these are due to two reasons:
- renaming parameters in Php builtin functions in preparation for named parameters.
- using the new class GdImage rather than type resource as the argument type for many image-based functions.

Regardless of the cause, this will be a problem sooner or later. This PR is an attempt to get ahead of that problem. For source members, it tweaks only the Phpstan configuration files, without changing any PhpSpreadsheet code. For the small number of test members involved, the code is fixed. Php7 and Php8 both report no errors with this configuration.

Because this involves no changes to code, and because Phpstan baseline is a common cause of merge difficulties, I will probably merge this in a day or two, more quickly than I customarily do.
2022-03-01 01:53:12 -08:00
MarkBaker 5579712688 Make CSV Reader boolean casting (e.g. string ``"TRUE"` to boolean `TRUE`) locale-aware. 2022-02-27 23:06:22 +01:00
Mark Baker fe969f59cc
Merge pull request #2627 from PHPOffice/Improve-Translation-Separator-Conflict
Resolve `translateSeparator()` method to handle separators cleanly
Some refactoring of the Ods Reader classes to eliminate code duplication
2022-02-27 13:48:45 +01:00
MarkBaker b31d42c52f Some Refactoring of the Ods Reader, moving all formula and address translation from Ods to Excel into a separate class to eliminate code duplication 2022-02-27 13:31:24 +01:00
MarkBaker 99f488efc6 Resolve `translateSeparator()` method to handle separators (row and column) for array functions as well as for function argument separators; and cleanly handle nesting levels
Note that this method is used when translating Excel functions between en and other locale languages, as well as when converting formulae between different spreadsheet formats (e.g. Ods to Excel)

Nor is this a perfect solution, as there may still be issues when function calls have array arguments that themselves contain function calls; but it's still better than the current logic
2022-02-27 13:01:09 +01:00
Mark Baker e6047cfa9d
Merge pull request #2626 from PHPOffice/Ods-Merge-Range-Tests
Unit tests for merge ranges for Ods Reader/Writer
2022-02-26 23:04:28 +01:00
MarkBaker 444d0fd77c Unit tests for merge ranges for Ods Reader/Writer 2022-02-26 22:51:15 +01:00
Mark Baker d88e8f85ba
Merge pull request #2625 from PHPOffice/Iso-Date-Datatype-Additional-Unit-Tests
Minor refactoring of ISO Date checking
2022-02-26 16:10:24 +01:00
MarkBaker 138638ad57 Ensure that selected worksheet is correctly set from Gnumeric Reader 2022-02-26 16:00:28 +01:00
MarkBaker 2af0b66f5f Read number formatting for Gnumeric... highlighted as not occurring when reading date values 2022-02-26 15:20:00 +01:00
MarkBaker fe901d13b4 Read number formatting for Gnumeric... highlighted as not occurring when reading date values 2022-02-26 15:08:12 +01:00
MarkBaker 52071e9f4a ODS Reader should also use the new Method for date values 2022-02-26 15:07:20 +01:00
MarkBaker ef4029df63 Refactor ISO data type validation from cell to shared date; add extra checks for invalid dates; and appropriate unit tests 2022-02-26 14:13:12 +01:00
oleibman 9cf526a920
Reading Xlsx With Supplied Palette (#2595)
Fix #2499, which see for details of an obscure problem affecting both PhpSpreadsheet and Excel. Add support for palette contained in workbook styles. This seems to be a very rare occurrence, so allow it only when the palette contains exactly 64 entries. If there are other possibilities, we'll presumably have a new workbook to guide us how to handle them. Also add some tests for specification of indexed color without palette, another rarity (no in-range examples amongst our current files). Also change one private static array, initialized once at run-time and never changed, to a constant.
2022-02-23 22:09:22 -08:00
Thorsten Ho 0cb60a5098
Fix XLSX broken vertical align font style (#2619)
* Fix XLSX broken vertical align font style

* Add fix information to changelog

* Fix phpcs issues
2022-02-23 20:23:59 -08:00
Mark Baker 579145eb3c
Wrap actual file loading in protected methods, while just providing a stub `load()` method in the BaseReader abstract. This is to allow a wrapper in the file loader logic across all Readers, with a try/catch block that can be used to handle special loader settings. (#2620) 2022-02-23 21:31:57 +01:00
Mark Baker 16953e27d8
Adjust Cell Reference regexp in Calculation Engine to handle worksheet names containing quotes (#2617)
* Capture of worksheet name in Calculation Engine cell references modified to handle apostrophe and quote marks, and made non-greedy to avoid ensure that multiple quoted worksheet names in a formula aren't all captured in one go

* Split some of the unit tests into separate test classes
2022-02-22 15:55:59 +01:00
Mark Baker 3c57d9e291
Fix for issue #2614 (#2615)
* Fix for issue #2614

* Unit test (in ISREF() tests) that covers issue #2614
2022-02-22 09:06:10 +01:00
Mark Baker c9f948bd91
Initial work on implementing Array-enabled for the HLOOKUP() and VLOOKUP() functions (#2611)
* Initial work on implementing Array-enabled for the HLOOKUP() and VLOOKUP() functions

* In the MATCH() function, we should also use `evaluateArrayArgumentsIgnore()` because the lookupvalue and matchType arguments can be array arguments, but lookupArray is always a dataset matrix
2022-02-21 19:56:21 +01:00
Mark Baker db21d043fe
Implementation of the ISREF() information function (#2613) 2022-02-21 18:47:23 +01:00
Mark Baker 0ee4d96576
Array-enable the ISFORMULA() function (#2610)
Implement Array-enabled for  ERROR.TYPE() function
Extract ERROR.TYPE() function tests into separate test file
Extract error function tests into separate test files

And thus complete the implemented Information functions
2022-02-20 19:32:13 +01:00
Mark Baker 35b65bef8c
First steps toward array-enabling the information functions (#2608)
* First steps toward array-enabling the information functions

Also includes moving unit tests out from Functions and into a separate, dedicated Information folder

* Resolve issue with IF(), branch pruning and calculation cache (ensure that we don't convert the if condition to a bool before we've tested to see if it evaluates to an error)
More refactoring
2022-02-20 16:46:25 +01:00
oleibman 9893926ff9
Add Test For NULL=0 (#2607)
Fix #2523. This isn't actually a fix; the problem was reported and confirmed for 1.21, but had already been fixed in master (and remains fixed in 1.22). This PR just adds a unit test for the original problem.
2022-02-19 13:12:44 -08:00
Mark Baker 71927f5591
Issue 2551 array enable lookup ref functions (#2606)
* Start work on array-enabling the Lookup and Reference functions

Requires a new method (`evaluateArrayArgumentsSubsetFrom()`) in the `ArrayEnabled` Trait to handle functions where the arguments that need special array handling are trailing rather than leading arguments
2022-02-19 18:49:01 +01:00
Mark Baker c10d86eb9c
Start work on array-enabling the Lookup and Reference functions (#2602)
* Start work on array-enabling the Lookup and Reference functions

Requires a new method (`evaluateArrayArgumentsSubsetFrom()`) in the `ArrayEnabled` Trait to handle functions where the arguments that need special array handling are trailing rather than leading arguments
2022-02-19 18:36:50 +01:00
Mark Baker d5dc58d20e
Extract information functions (#2605)
* Split Information functions into a dedicated class and namespace and categorise as Value or Error
* Refactor all error functions into the new ExcelError class
2022-02-19 13:53:17 +01:00
Mark Baker 9c473682bc
Set precision for Database function unit tests, for RowColumnReference and Dimension Helper unit tests (#2604) 2022-02-18 21:37:26 +01:00
Adrien Crivelli 3c0004760d
Prepare changelog for next version 2022-02-18 14:01:46 +01:00
Adrien Crivelli 3a9e29b4f3
1.22.0 2022-02-18 13:57:07 +01:00
Adrien Crivelli f4885d90dc
PHP 8.1 compatibility 2022-02-18 13:14:35 +01:00
Mark Baker 0371ccb686
Convert all relevant Logical functions to support array arguments (#2600) 2022-02-18 02:56:23 +01:00
Mark Baker e580f10c46
Unit test some basic arra-formula chaining (#2599) 2022-02-17 19:37:40 +01:00
Mark Baker 03993bce05
The last big block of Engineering functions; those involving complex numbers (#2597) 2022-02-17 15:17:33 +01:00
Roland Eigelsreiter 1a4e4ed7c5 fix php 8.1 error when autoFilter['ref'] is null 2022-02-17 14:43:18 +01:00
Mark Baker ef839f56be
Get started with array-enabling the Engineering functions - Erf, Bessel, bitwise, comparisons Unit of Measure and Number base conversions first (#2594) 2022-02-16 18:32:07 +01:00
Mark Baker cdbe5c7c9b
Converting Statistical functions to be array-enabled (phase #2) (#2593) 2022-02-15 20:34:39 +01:00
Mark Baker f1cb75eaec
Start work on Array-enabling the Statistical functions (#2588) 2022-02-15 14:41:17 +01:00
Mark Baker 7901eb0b91
Eliminate calls to flattenSingleValue() that are no longer required in TextData Functions when we're checking for array values as arguments (#2592) 2022-02-15 01:29:12 +01:00
Mark Baker 70c12d2b05
Eliminate calls to flattenSingleValue() that are no longer required when we're checking for array values as arguments (#2591) 2022-02-14 23:11:53 +01:00
Mark Baker 7e996a7c98
Eliminate calls to flattenSingleValue() that are no longer required when we're checking for array values as arguments (#2590) 2022-02-14 22:59:39 +01:00
Aaron Layson aff97833c6
Renamed "worskeet" to "worksheet" comment typo (#2589) 2022-02-14 08:07:04 -08:00
Mark Baker e3b7cb5f9d
I'm ignoring SUMIF() and SUMIFS() for the moment; so this should complete all the applicable Math/Trig functions;so the subset SERIESSUM() function and RANDBETWEEN() should complete Math/Trig (#2586) 2022-02-13 12:50:05 +01:00
oleibman c9d1df8554
Update Changelog (#2587)
Catch up with some earlier changes.
2022-02-13 00:45:27 -08:00
Mark Baker de2fb1f438
Reset phpstan to level 8... there's too many issues working with mixed and needing to cast to a specific type like string; but the alternative for maintaining exact types is a unnecessar extra of code for explicit handling of casting with checks that we don't need when we know datatypes from manual viewing of the codebase (#2585) 2022-02-12 22:04:02 +01:00
Mark Baker 8f3c52a3cf
Enable array-readiness for more Math/Trig functions (#2584)
* Enable array-readiness for more Math/Trig functions; CEILING() FLOOR() (and variants), TRUNC(), BASE() and the various Logarithms
* Minor refactoring
2022-02-12 20:47:47 +01:00