Commit Graph

6287 Commits

Author SHA1 Message Date
oleibman e2927cfa71 Merge commit from fork 2026-04-04 21:30:27 -07:00
oleibman 93c94eb31d Merge commit from fork
* Test Protocol Not Supplied Before Using is_file

* added missing assertFile and renamed prohibitPhar

* More Tests

---------

Co-authored-by: calligraf0 <115566010+calligraf0@users.noreply.github.com>
2026-04-04 21:04:58 -07:00
oleibman 36013a3db5 Merge pull request #4849 from PHPOffice/dependabot/composer/tecnickcom/tcpdf-6.11.2
Bump tecnickcom/tcpdf from 6.11.0 to 6.11.2
2026-04-01 13:35:13 +00:00
oleibman 274676f1bb Merge pull request #4848 from PHPOffice/dependabot/composer/dompdf/dompdf-3.1.5
Bump dompdf/dompdf from 3.1.4 to 3.1.5
2026-04-01 13:34:53 +00:00
oleibman 3f0eb5a432 Merge pull request #4846 from PHPOffice/dependabot/composer/mpdf/mpdf-8.3.1
Bump mpdf/mpdf from 8.2.7 to 8.3.1
2026-04-01 13:34:32 +00:00
dependabot[bot] f7de90492b Bump tecnickcom/tcpdf from 6.11.0 to 6.11.2
Bumps [tecnickcom/tcpdf](https://github.com/tecnickcom/TCPDF) from 6.11.0 to 6.11.2.
- [Changelog](https://github.com/tecnickcom/TCPDF/blob/main/CHANGELOG.TXT)
- [Commits](https://github.com/tecnickcom/TCPDF/compare/6.11.0...6.11.2)

---
updated-dependencies:
- dependency-name: tecnickcom/tcpdf
  dependency-version: 6.11.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-01 12:44:53 +00:00
dependabot[bot] 6c0e818845 Bump dompdf/dompdf from 3.1.4 to 3.1.5
Bumps [dompdf/dompdf](https://github.com/dompdf/dompdf) from 3.1.4 to 3.1.5.
- [Release notes](https://github.com/dompdf/dompdf/releases)
- [Commits](https://github.com/dompdf/dompdf/compare/v3.1.4...v3.1.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-01 12:44:50 +00:00
dependabot[bot] 989a4d25a5 Bump mpdf/mpdf from 8.2.7 to 8.3.1
Bumps [mpdf/mpdf](https://github.com/mpdf/mpdf) from 8.2.7 to 8.3.1.
- [Release notes](https://github.com/mpdf/mpdf/releases)
- [Changelog](https://github.com/mpdf/mpdf/blob/development/CHANGELOG.md)
- [Commits](https://github.com/mpdf/mpdf/compare/v8.2.7...v8.3.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-01 12:44:42 +00:00
oleibman d16e20d915 Merge pull request #4843 from TobiasBg/patch-1
Refactor hyperlink URL assignment logic
2026-03-31 05:41:04 +00:00
oleibman eeabef74a4 Update CHANGELOG.md 2026-03-30 22:36:51 -07:00
oleibman 82ac6cec01 Merge pull request #4824 from kemo/perf/spreadsheet-copy-without-serialize
Examine Performance of Clone vs Serialize/Unserialize
2026-03-31 05:22:40 +00:00
oleibman e750f1a472 Merge branch 'master' into perf/spreadsheet-copy-without-serialize 2026-03-30 22:18:34 -07:00
oleibman cc25b620b7 Update CHANGELOG.md 2026-03-30 22:17:38 -07:00
oleibman 7467fe4f19 Wrong Case for File Name 2026-03-27 23:00:45 -07:00
oleibman 162fd2ce5b Add Unit Test 2026-03-27 22:54:55 -07:00
kemo e9e467de10 Revert copy() to serialize, keep benchmark and docblocks
Drop the clone-based copy() since benchmark results vary across PHP
versions and platforms. Keep the benchmark test (renamed to end in Test)
in a separate testsuite so users can assess which approach suits their
environment. Add docblock @see references on copy() and __clone().
2026-03-25 16:52:09 +01:00
Tobias Bäthge c20e9a8021 Update src/PhpSpreadsheet/Reader/Xlsx/Hyperlinks.php
Fix wrong white space from copy/paste from editor.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-23 21:57:39 +01:00
Tobias Bäthge c7f3ffba19 Refactor hyperlink URL assignment logic
Properly detect URLs with an anchor, like `https://example.com/#anchor` and don't convert them into an "internal" URL.
2026-03-23 21:32:18 +01:00
oleibman 5a18a925f9 Rename Benchmark Test 2026-03-22 08:32:27 -07:00
oleibman eb391d1f22 Merge pull request #4839 from oleibman/issue4838
Some Problems with Conditional Colorscale for Html
2026-03-22 14:54:46 +00:00
oleibman 0c1ad4ef03 Merge branch 'master' into issue4838 2026-03-22 07:50:52 -07:00
oleibman d153ff7bd8 Update CHANGELOG.md 2026-03-22 07:50:01 -07:00
oleibman 2d644e9ac3 Merge pull request #4837 from oleibman/extendcsv
Make Reader/Csv Easily Extendable
2026-03-22 14:27:30 +00:00
oleibman 77da519053 Update CHANGELOG.md 2026-03-22 07:23:38 -07:00
oleibman 16372fd403 Merge pull request #4841 from acataluddi/issue-4840
Issue 4840
2026-03-22 00:15:04 +00:00
Adriano Cataluddi 0393546118 Marked the Date.safeModify() method with @codeCoverageIgnore. 2026-03-21 19:07:17 +01:00
Adriano C. 0f01633d09 Merge branch 'master' into issue-4840 2026-03-21 15:11:51 +01:00
Adriano Cataluddi 51457b6904 Update CHANGELOG.md: rearranged entries for consistency and moved Date detection fix to Fixed section. 2026-03-21 15:10:35 +01:00
Adriano Adriano c69391d419 # This is a combination of 13 commits.
# This is the 1st commit message:

Integrated unit test to capture the bug.

# This is the commit message #2:

Added Date.safeModify() method for secure DateTime modifications and integrated exception handling - Fixed #4840.

# This is the commit message #3:

PHPCS Fixes.

# This is the commit message #4:

PHPCS Fixes.

# This is the commit message #5:

Codestyle fix.

# This is the commit message #6:

Added description to CHANGELOG.md.

# This is the commit message #7:

Enhanced Date.safeModify() to ensure consistent exception handling across PHP versions, addressing changes in DateTime::modify() behavior in PHP 8.3 - #4840.

# This is the commit message #8:

Confusion Checking for Union Arguments

Fix #4832. PR #4657 added support for passing union arguments to functions. User reports a problem with a peculiar formula afterwards. See issue for details - the very loose restrictions placed on worksheet names can lead to an ambiguous situation for the parser.

This problem arose with a function whose first argument was a cell address *including sheet name*. Parser is changed to try to avoid this situation. If the regular expression which tells us we have a potential need for union has a left parenthesis in the "sheet name" without a right parenthesis, then it will no longer try to treat the formula as containing union arguments except in the unlikely event that "sheet name" truly is a worksheet title in the spreadsheet. This feels pretty kludgey, but it solves the problem at hand, and seems unlikely to cause problems. There may still be edge cases more subtle than the one in the issue; I am satisfied to wait for reports of such.

# This is the commit message #9:

Weird Regexp Difference between Php8.4+ and Php8.3-

Specify codeCoverageIgnore for now, remove later.

# This is the commit message #10:

Move Test to More Sensible Location

# This is the commit message #11:

Ods Reader/Writer Support for Integer Styles with Leading Zero

Fix #1606, which went stale and is now reopened. PR #4806 supplied support for some Number Formats for Ods, but did not directly address this issue. This PR does. In addition to the original issue, this could be useful for zip codes. As I stated in 4806, I may be amenable to adding some unsupported styles to the built-in list, but the custom style option will always be around in case I am being slow or unreasonable.

# This is the commit message #12:

A Bit More Flexibility

And some more tests.

# This is the commit message #13:

Update CHANGELOG.md

Xlsx Writer Support Data URI for Images

Fix #4823. When writing a spreadsheet to Html, a data Uri can be used if `embedImages` is true. Reading such an Html spreadsheet and attempting to write it to Xlsx results in an Exception. It should be noted that Excel itself cannot open the Html properly; none of the images are present.

The PhpSpreadsheet problem arises not with the inclusion of the image, but rather with attempting to include the appropriate entry in `[ContentTypes].xml`. This PR corrects that problem.

For the record, Xls Writer does not have a problem with this situation. Just to demonstrate that, a parallel test for Xls Writer is added in addition to the new Xlsx Writer test.

Update CHANGELOG.md

Update CHANGELOG.md

Added phpcs and php-cs-fixer corrections #4840.

Updated DateTest to handle DateMalformedStringException for PHP 8.3 in excelToDateTimeObject exception tests.

Fixed phpcs issues.

Fixed php-cs-fixer issue.

Updated DateTest so to not directly reference DateMalformedStringException class which is not existing prior to PHP 8.3.

Refactored DateTest to dynamically set the expected exception class, ensuring compatibility across PHP versions.

Removed unused Throwable import and updated expected exception type in DateTest for consistency with PHP version handling.

Added DateMalformedStringException polyfill to solve the phpstan issue.

Fixed phpcs issue.
2026-03-21 15:09:06 +01:00
oleibman ff7ef51df0 Merge pull request #4835 from oleibman/issue4832
Confusion Checking for Union Arguments
2026-03-21 06:12:23 +00:00
oleibman afbbb20860 Update CHANGELOG.md 2026-03-20 23:08:11 -07:00
oleibman 0d417609ba Merge branch 'master' into issue4832 2026-03-20 23:05:04 -07:00
oleibman 686f034e96 Merge pull request #4831 from oleibman/issue4823
Xlsx Writer Support Data URI for Images
2026-03-21 05:57:43 +00:00
oleibman 3e24ec381a Update CHANGELOG.md 2026-03-20 22:53:43 -07:00
oleibman 4a8884bf0e Merge pull request #4822 from oleibman/leading0
Ods Reader/Writer Support for Integer Styles with Leading Zero
2026-03-21 05:03:52 +00:00
oleibman a0030aa1e6 Update CHANGELOG.md 2026-03-20 21:59:55 -07:00
oleibman cbdd6ae148 Coverage 2026-03-17 16:23:06 -07:00
oleibman fb096885d8 Some Problems with Conditional Colorscale for Html
Fix #4838. Some processing of Html Conditional Formatting which worked with PhpSpreadsheet 5.3 does not work with 5.4. There are 2 problems. The first was caused by PR 4763, which moved some code out of Html Writer to an easier-to-access location. One of the intermediate variables in Html Writer was not available in the new location; its simulation turned out to be imperfect.

When evaluating Colorscale, the cells in question need to be ranked. This was done using `rangesToArray` with the formatting option set to `true`. This code, inherited from 5.3, was a mistake; it should have been set to `false`. As coded, it created problems for cells formatted as percentages (it is not clear why 5.3 did not suffer a similar fate). Making that change fixes the problem. The fix is demonstrated in the first new test `testPercentages`.

A second problem affected 5.3. The code to assign a colorscale color to a cell concatenated the alpha, red, green, and blue colors expressed in hex digits. But it did not properly handle the case when any of those was only 1 digit long. The second new test `testPercentages2` demonstrates that this problem is now fixed.
2026-03-17 14:33:45 -07:00
kemo 1c1242aa2d Move benchmarks to tests/Benchmark to avoid running with unit tests 2026-03-16 15:01:04 +01:00
oleibman 7cf4171858 Add a Constant 2026-03-13 09:27:39 -07:00
oleibman 981d429630 Make Reader/Csv Easily Extendable
Fix #4836, an issue which I was about to dismiss out-of-hand, but I decided that we could and should be making it a bit easier for our users to avoid problems. To that end, I have changed most of the private properties in Reader/Csv from `private` to `protected`. This allows users to extend the class easily; it is a better option than the existing `constructorCallback` - less awkward, not reliant on static settings, etc. (I know more now than I did when I introduced it.) Taking advantage of the new extendability, a new class `Reader\CsvNoEscape` is added which forces the use of null-string as the escape character, and prevents the use of auto-detection of Mac line-endings; both of these are schedule for removal with Php9.
This actually makes `CsvNoEscape` a better option than `Csv`;
it should probably be used for all new development.

Because `IOFactory` is heavily used for loading files, it has some changes to better accommodate `CsvNoEscape` (and other classes). In particular, methods `createReader`, `load`, `identify`, and `createReaderForFile` now allow a new `mergeArray` parameter, where that parameter is merged with the static `IOFactory::$readers` array when deciding on a Reader class to be used. This allows the user to override the default Csv Reader, without having to change a static array, and without affecting IOFactory's ability to find other matching readers if no suitable entry is found in `mergeArray`.
2026-03-12 16:50:21 -07:00
oleibman 70e94a647d Move Test to More Sensible Location 2026-03-12 10:41:43 -07:00
oleibman c01c67f468 Weird Regexp Difference between Php8.4+ and Php8.3-
Specify codeCoverageIgnore for now, remove later.
2026-03-11 21:40:18 -07:00
oleibman 5aeca473e6 Confusion Checking for Union Arguments
Fix #4832. PR #4657 added support for passing union arguments to functions. User reports a problem with a peculiar formula afterwards. See issue for details - the very loose restrictions placed on worksheet names can lead to an ambiguous situation for the parser.

This problem arose with a function whose first argument was a cell address *including sheet name*. Parser is changed to try to avoid this situation. If the regular expression which tells us we have a potential need for union has a left parenthesis in the "sheet name" without a right parenthesis, then it will no longer try to treat the formula as containing union arguments except in the unlikely event that "sheet name" truly is a worksheet title in the spreadsheet. This feels pretty kludgey, but it solves the problem at hand, and seems unlikely to cause problems. There may still be edge cases more subtle than the one in the issue; I am satisfied to wait for reports of such.
2026-03-11 20:14:12 -07:00
kemo 43a08eab36 Fix stale docblock on copy method 2026-03-11 07:29:14 +01:00
oleibman dfab88262a Xlsx Writer Support Data URI for Images
Fix #4823. When writing a spreadsheet to Html, a data Uri can be used if `embedImages` is true. Reading such an Html spreadsheet and attempting to write it to Xlsx results in an Exception. It should be noted that Excel itself cannot open the Html properly; none of the images are present.

The PhpSpreadsheet problem arises not with the inclusion of the image, but rather with attempting to include the appropriate entry in `[ContentTypes].xml`. This PR corrects that problem.

For the record, Xls Writer does not have a problem with this situation. Just to demonstrate that, a parallel test for Xls Writer is added in addition to the new Xlsx Writer test.
2026-03-10 19:52:51 -07:00
kemo 90cc61e7fb Fix cs-fixer: use short class name in phpdoc 2026-03-11 00:01:33 +01:00
kemo afac1badab Fix phpstan and code style errors 2026-03-10 23:59:21 +01:00
kemo bab63aa83e Add benchmark test for clone vs serialize spreadsheet copy 2026-03-10 15:23:55 +01:00
kemo e599953942 Replace serialize/unserialize in Spreadsheet::copy() with clone 2026-03-10 15:04:47 +01:00