1473 Commits

Author SHA1 Message Date
oleibman f5794dc681 Php8.5-related Changes Release222 (#4651) 2025-09-17 17:18:40 -07:00
oleibman 67245f89f8 Option for Readers to create a new blank sheet if none match LoadSheetsOnly list. (#4622)
* Option for Readers to create a new blank sheet if none match LoadSheetsOnly list.

Backport of PR #4618.

* Update CHANGELOG.md
2025-09-01 00:03:14 -07:00
oleibman 50eeec0a81 String Increments and Php8.5 - release222 branch (#4614)
Fix #4600. String incrementation through the `++` operator is deprecated in Php 8.5. Because we make use of that operator to iterate through columns, we are particularly hard hit by that change - unaddressed, it causes over 2,000 errors in our test suite! It is, fortunately, not as difficult as I feared to correct. Replacing the `++` operator with a call to new method `StringHelper::stringIncrement` in 79 statements scattered over 31 source modules (in src, samples, test, and infra) eliminates all the messages in the test suite. It is possible that others are lurking, but I don't know a systematic way of determining if there are others. We'll stick with this for now, and deal with any others as they show up.

This PR will be applied to the master, release390, and release222 branches. It will not be applied to the release210 or release1291 branches, which will now accept security changes only.
2025-08-27 18:38:56 -07:00
oleibman 54b81a105c String Increment Deprecated in Php8.5 - r222 (#4603) 2025-08-25 20:22:09 -07:00
oleibman 4594396d3a Update Mpdf (Php8.5 Compatibility) r222 (#4594) 2025-08-21 13:43:37 -07:00
oleibman 334a67797a Breaking Change When Loading External Images
Images will be loaded from an external source (e.g. http://example.com/img.png) only if the reader is explicitly set to allow it via `$reader->setAllowExternalImages(true)`.
2025-08-02 18:38:33 -07:00
oleibman 22058ce75b All Readers - Allow or Forbid Fetching of External Images Release222 (#4547)
* All Readers - Allow or Forbid Fetching of External Images Release222

Add to all readers the option to allow or forbid fetching external images. This is unconditionally allowed now. The default will be set to "allow", so no code changes are necessary. However, we are giving consideration to changing the default.

* Update Changelog
2025-07-22 21:43:28 -07:00
oleibman 448a3436af Removing Columns/Rows Containing Merged Cells (#4471)
Backport PR #4465.
2025-05-15 21:56:30 -07:00
oleibman 76978140f0 Allow Spreadsheet Serialization Branch release222 (#4407) 2025-03-14 07:37:59 -07:00
oleibman a02e4c2ebe Allow php-cs-fixer to Handle Implicit Backslashes 2025-02-10 23:52:57 -08:00
oleibman 4eefcceee8 Fix TEXT and TIMEVALUE Functions 2.3 Branch (#4354)
Fix #4249. Technically speaking, only the 1.29 branch needs fixing, and only for TEXT. It was fixed for the other branches by PR #3898. However, in adding test cases for the fix, it became apparent that PhpSpreadsheet's parsing in TIMEVALUE (which is called from TEXT in the original issue) did not really match Excel's. There are probably still edge cases where it doesn't, but, in the absence of a spec for how it operates, this will do for now.

We do not usually backport fixes from the master branch. Because this is more of a forward port from the earlier branch, there is an equivalent PR for each active branch.
2025-02-10 20:47:25 -08:00
oleibman 6ef0269e97 Writer Xls Parser Backport 2 Changes
PR #4233 and PR #4244.
2025-02-06 21:26:08 -08:00
oleibman e237309829 Security Patch Control Characters in Protocol 2025-01-23 23:52:50 -08:00
oleibman 51f774ce27 Tweak One Test
Fluke failure in CI push.
2025-01-15 01:51:54 -08:00
oleibman 098b848ee6 Backported Security Patch 2025-01-11 19:22:26 -08:00
oleibman 345e7f09a2 Change hash code for worksheet branch release222 (#4308)
* Change hash code for worksheet branch release210

Backport of PR #4207.

* Retitling Clone Worksheets

Backport of PR #4302.
2025-01-08 14:39:01 -08:00
oleibman d836f2d730 Backport Html Writer Security Patches 2024-12-26 21:17:46 -08:00
oleibman 7019886ac9 Restore Accidentally Disabled Test 2024-12-15 15:02:13 -08:00
oleibman 01c4122a12 Missed One Test 2024-12-08 07:43:45 -08:00
oleibman afa5428588 Upgrade Dompdf 2024-12-07 22:11:49 -08:00
oleibman 0adf030a4f Fix Minor Break Handling Drawings
Backport of #4241. Some security batches caused a minor break in Drawings, forcing `setWorksheet` to come after `setPath`. Although the problem is easily fixed in user code, this was not an intended change. Some slight recoding restores the earlier functionality where the order of calls was not important, without sacrificing the security gains.
2024-11-25 20:26:18 -08:00
oleibman 91a4b42e41 Ignore Settings::libXmlLoaderOptions
Backport of PR #4233.
2024-11-21 22:11:37 -08:00
oleibman 08d4e08cf0 Backport Security Fix 2024-11-10 01:35:47 -08:00
oleibman 8628d6385c Backport PR #4189 Csv Method 2024-10-14 21:44:31 -07:00
oleibman c251ef5efc Restore 2 Disabled Tests 2024-09-24 17:45:23 -07:00
oleibman a9693d1182 Backport Security Patch 2024-09-24 05:53:42 -07:00
oleibman f0b70ed108 Html Writer Validate Hyperlink Protocols 2024-09-14 05:28:06 -07:00
oleibman 3bcd51826b Security Patch 2024-09-13 10:16:19 -07:00
oleibman c2428f622b AMORDEGRC and Csv Reader
Backports of PR #4162 and PR #4164 intended for Php 3.0.0.


Signed-off-by: oleibman <10341515+oleibman@users.noreply.github.com>
2024-09-07 21:32:15 -07:00
oleibman bce30f945e Improve Xlsx Reader Speed
Backport of PR #4153.
2024-09-04 20:27:42 -07:00
oleibman 9450bc1acb Merge branch 'master' into issue4128 2024-08-07 11:31:01 -07:00
oleibman 4500f5a87d Worksheet applyStylesFromArray Retain Active Cell
Fix #4128. PR #4073 introduced applyStylesFromArray method, which allowed setting styles without affecting selectedCells or activeSheet. The first use of this method was in Cell setValueExplicit to set quotePrefix appropriately. The new method did not preserve activeCell. I'm not sure why that should matter, but this seems to have caused a problem for Excel 2016. This seems to be a bug in Excel, one which is fixed in newer releases. However, PhpSpreadsheet can avoid the problem by preserving activeCell as well as selectedCells and activeSheet. This PR makes that change.
2024-08-07 08:12:47 -07:00
oleibman b1e5e326ac Merge branch 'master' into issue4113 2024-08-02 08:42:52 -07:00
oleibman bbf9d15cb2 Php-cs-fixer Enforcing New Rules
The latest release seems to not want you to give a class element both a Php type and a doc-block type. I used the "fix" operand to delete the redundant doc-block declarations, with no other changes. So there should be no change to executable code.
2024-08-01 10:54:54 -07:00
oleibman 85629b77a0 More Extreme Cases 2024-07-31 12:47:19 -07:00
oleibman 7b478adaeb Too Many Digits
We can't handle more digits than Php allows. Neither can Excel. Just do our best without throwing an Error.
2024-07-30 21:17:50 -07:00
oleibman 523afe57f0 Merge pull request #4107 from oleibman/pr848
RATE Function Permits Floating Point NPER
2024-07-30 22:05:12 +00:00
oleibman ae2c3ea5e4 Merge pull request #4106 from oleibman/issue1284
Html Reader Preserve Unicode Whitespace Characters
2024-07-30 22:04:10 +00:00
oleibman 6de86f5d77 Deal With Scientific Notation 2024-07-30 07:37:57 -07:00
oleibman 58ff1491ba Additional Examples Which Were Failing 2024-07-29 08:24:56 -07:00
Adrien Crivelli bea2d4b30f Security: prevent XXE (XML External Entity) when loading files
Prevent XEE by hiding custom entities by using single quote to
declare a non-UTF-8 encoding.

XML standard, https://www.w3.org/TR/xml/#NT-EncodingDecl, allows single
quote to declare encoding, but we did not support it. Instead, we
incorrectly fell back on the default of UTF-8. That incorrectly kept the
XML as non-UTF-8, and thus prevented our regexp-based custom entity
detection mechanism to work.
2024-07-29 16:22:43 +09:00
oleibman ab5965affb Merge branch 'master' into issue4099 2024-07-27 07:36:13 -07:00
oleibman 8225096c6f Merge pull request #4098 from oleibman/issue912
Xlsx Reader and Print/Show Gridlines
2024-07-27 14:27:18 +00:00
oleibman bf0281be34 Merge pull request #4096 from oleibman/issue296
Reference to Defined Name Specifying Worksheet Name
2024-07-27 14:25:50 +00:00
oleibman f553019f95 New Algorithm for TRUNC, ROUNDUP, and ROUNDDOWN
Fix #4113. TRUNC isn't always producing the expected result. There was a promising algorithm at https://stackoverflow.com/questions/4668628/truncate-float-numbers-with-php from user Juan. It works through Php8.3, but failed in Php8.4 (more on this later). User Savageman on the same page has a solution that needs work, but, once the work had taken place, it works on Php8.1-8.4.

The ROUNDUP and ROUNDDOWN functions were adversely affected by Php8.4, probably for the same reasons as Juan's TRUNC suggestion. I put a kludge in place for them some time ago, but I wasn't happy with it. The solution used for TRUNC here suggested a change to the ROUNDUP and ROUNDDOWN code that would no longer require the kludge. The change to those functions now works more cleanly on Php8.1-8.4.
2024-07-26 23:02:11 -07:00
oleibman 459f442b9e Additional Test
New test testGifIssue4112 uses the same technique as reported in the original issue, and it would fail on all PhpSpreadsheet releases, not just 2.2.0.
2024-07-26 11:52:35 -07:00
oleibman 1df4b17d55 Scrutinizer Found a Real Problem
My test was imperfect,and Scrutinizer detected it.
2024-07-26 08:53:00 -07:00
oleibman 762d73daf5 Addsheet May Leave Active Sheet Uninitialized
Fix #4112. Direct cause is that `applyStylesFromArray` tries to save and restore `activeSheetIndex`. However, if activeSheetIndex is -1, indicating no active sheet, the restore should not be attempted. Code is changed to test before attempting to restore.

The actual problem, however, is that user specified a sheet number for `addSheet`. That method will set activeSheetIndex most of the time, but this was a gap - when the supplied sheet number (0 in this case) is greater than activeSheetIndex (-1 in this case), it was leaving activeSheetIndex as -1. It is changed to set activeSheetIndex to 0 when activeSheetIndex is negative.
2024-07-26 08:30:52 -07:00
oleibman b6ff857ba7 RATE Function Permits Floating Point NPER
Suggested by PR #848 from @markkimsal. The RATE calculation had already been corrected, so that part of the PR was unnecessary, however one of the tests included a floating point value for Number of Periods, which Excel permits. PhpSpreadsheet till now expected that parameter to be an integer. This is trivially changed with some tests added.
2024-07-22 08:32:54 -07:00
oleibman 09584d2950 Html Reader Preserve Unicode Whitespace Characters
Fix #1284, which was closed as stale in 2019, but which I will now reopen. Html Reader converts *Unicode* whitespace characters in a DOM text node to space. However, Html treats only space, tab, CR, LF, vertical tab, and form-feed as whitespace. Using a regular expression with the `u` (Unicode) modifier causes a number of other characters to be converted to space inappropriately. The issue mentions "ideographic space" in particular, stating that it is used for formatting and should be preserved. "Non-breaking space" is also used in the same way and should also be preserved. An exception is made for a text node consisting of a single non-breaking space, since that is used as a placeholder by Html Writer; my own guess is that this is the reason why the Unicode modifier was used in the first place.
2024-07-21 19:48:40 -07:00