Skip to content

Commit

Permalink
Issue 3461 - Establish boundary for function prefix regexp to prevent…
Browse files Browse the repository at this point in the history
… NETWORKDAYS being picked up by DAYS
  • Loading branch information
MarkBaker committed Mar 17, 2023
1 parent 99a7de3 commit e58d51f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).

- Updates Cell formula absolute ranges/references, and Defined Name absolute ranges/references when inserting/deleting rows/columns [Issue #3368](https://github.com/PHPOffice/PhpSpreadsheet/issues/3368) [PR #3402](https://github.com/PHPOffice/PhpSpreadsheet/pull/3402)
- EOMONTH() and EDATE() Functions should round date value before evaluation [Issue #3436](https://github.com/PHPOffice/PhpSpreadsheet/issues/3436) [PR #3437](https://github.com/PHPOffice/PhpSpreadsheet/pull/3437)
- NETWORKDAYS function erroneously being converted to NETWORK_xlfn.DAYS in Xlsx Writer [Issue #3461](https://github.com/PHPOffice/PhpSpreadsheet/issues/3461) [PR #3463](https://github.com/PHPOffice/PhpSpreadsheet/pull/3463)


## 1.28.0 - 2023-02-25
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Writer/Xlsx/FunctionPrefix.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class FunctionPrefix
{
const XLFNREGEXP = '/(?:_xlfn\.)?((?:_xlws\.)?('
const XLFNREGEXP = '/(?:_xlfn\.)?((?:_xlws\.)?\b('
// functions added with Excel 2010
. 'beta[.]dist'
. '|beta[.]inv'
Expand Down
5 changes: 5 additions & 0 deletions tests/PhpSpreadsheetTests/Writer/Xlsx/FunctionPrefixTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public function functionPrefixProvider(): array
'New Function requiring Double-Prefix already partially Prefixed #2' => ['_xlfn._xlws.FILTER()', '_xlws.FILTER()'],
'New Function requiring Double-Prefix already Fully Prefixed' => ['_xlfn._xlws.FILTER()', '_xlfn._xlws.FILTER()'],
'Multiple Functions' => ['_xlfn._xlws.SORT(_xlfn._xlws.FILTER(A:A, A:A<>""))', 'SORT(FILTER(A:A, A:A<>""))'],
'DAYS/NETWORKDAYS 1' => ['_xlfn.DAYS(DATE(2023,1,1),TODAY())', 'DAYS(DATE(2023,1,1),TODAY())'],
'DAYS/NETWORKDAYS 2' => ['_xlfn.DAYS(DATE(2023,1,1),TODAY())', '_xlfn.DAYS(DATE(2023,1,1),TODAY())'],
'DAYS/NETWORKDAYS 3' => ['ABS(_xlfn.DAYS(DATE(2023,1,1),TODAY()))', 'ABS(DAYS(DATE(2023,1,1),TODAY()))'],
'DAYS/NETWORKDAYS 4' => ['ABS(_xlfn.DAYS(DATE(2023,1,1),TODAY()))', 'ABS(_xlfn.DAYS(DATE(2023,1,1),TODAY()))'],
'DAYS/NETWORKDAYS 5' => ['NETWORKDAYS(DATE(2023,1,1),TODAY(), C:C)', 'NETWORKDAYS(DATE(2023,1,1),TODAY(), C:C)'],
];
}

Expand Down

0 comments on commit e58d51f

Please sign in to comment.