Commit Graph

4191 Commits

Author SHA1 Message Date
oleibman f6ee1f29d2 Additional Context Options for http(s) Images
Backport of PR #4276.
2024-12-13 15:25:09 -08:00
oleibman 08597725b8 Tweak to .gitattributes 1.29.6 2024-12-07 21:49:00 -08:00
oleibman bb4b75d1a6 Upgrade Dompdf, Tcpdf, Composer Package 2024-12-07 21:36:03 -08:00
oleibman 345b63a10a 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:14:44 -08:00
oleibman 77206da762 Another Try to Suppress github-pages 2024-11-22 22:45:34 -08:00
oleibman 727cb704d5 Ignore Settings::libXmlLoaderOptions
Backport of PR #4233.
1.29.5
2024-11-21 21:57:44 -08:00
oleibman c5f0f501a1 Upgrade PhpUnit
To a version which knows Php8.4 deprecates E_STRICT.
2024-11-14 14:26:49 -08:00
oleibman bdffbdb717 Upgrade Symfony/Process
Current version (used only in dev) has a security advisory. May as well fix it.
2024-11-12 19:09:15 -08:00
oleibman 2106f0a61f Update GitHub Pages Only for Master Branch 2024-11-12 07:02:43 -08:00
oleibman bedd300acd Change Github Actions Version
Apparently checkout and cache use deprecated v3. Use current v4 instead.
2024-11-10 09:47:18 -08:00
oleibman 7ca7e325dc Fix Changelog - Wrong Tag Was Applied 1.29.4 2024-11-10 08:26:22 -08:00
oleibman 31d7f7962e Backport Security Patch 2024-11-10 01:24:59 -08:00
oleibman 15e028fd93 Backport PR #4189 Csv Method 2024-10-14 22:00:52 -07:00
oleibman 3a5a818d7d Update Changelog 1.29.2 2024-09-29 00:04:47 -07:00
oleibman f0219ff04b Restore 2 Disabled Tests 2024-09-24 17:43:22 -07:00
oleibman d95bc290be Backport Security Patch 2024-09-24 05:49:02 -07:00
oleibman 9c90ed6b23 Used Named Parameter but Still Need to Support Php7.4 2024-09-14 05:48:58 -07:00
oleibman 8b9b378ecd Html Writer Validate Hyperlink Protocols 2024-09-14 05:27:25 -07:00
oleibman fa657fd99b More Tests 2024-09-13 10:10:29 -07:00
oleibman ec0d4af574 AMORDEGRC and Csv Reader
Backports of PR #4162 and PR #4164 intended for 3.0.0.
2024-09-07 21:47:30 -07:00
oleibman 8edc294862 Make Csv Reader Consistent With Other Branches
Very minor tweaks.
2024-09-06 01:50:15 -07:00
oleibman e69cfb954b Used Php8 Construct But Still Need to Support 7.4 2024-09-05 22:47:21 -07:00
oleibman 7551a9f3c7 Preparation for Php8.4
Backport changes applied to master some time ago.
2024-09-05 22:04:02 -07:00
oleibman fb42a103f1 Validate POST Input in Sample 45
Errors will result if input is not numeric.
2024-09-05 13:12:53 -07:00
oleibman 59ee38f748 Unit Tests Skip Nightly Add 8.3 1.29.1 2024-09-02 17:55:32 -07:00
oleibman 00cd98ff93 WebService Test Requires Int Not String 2024-09-02 17:44:42 -07:00
oleibman e27b17e06f Don't Use Phpunit 10 2024-09-02 17:32:14 -07:00
oleibman 7d6cb09f6e Backport Security Patches
2 security patches already applied in Release 2 need to be backported for Release 1.
2024-09-02 04:53:55 -07:00
MarkBaker fde2ccf55e Minor update the change log 1.29.0 2023-06-15 00:48:31 +02:00
oleibman 570660f12a Column Widths, Especially for ODS (#3610)
Fix #3609. Reporter created a spreadsheet with non-adjacent columns having non-default widths. Ods Writer needs to generate entries for the missing columns with default width.

The fix was fairly simple. Testing it was not. Ods Reader basically ignores all styles; they are complicated, declared in (at least) 2 places (content.xml and styles.xml). This change deals only with the problem as reported, in which the missing declarations should be in content.xml. If someone reports a real-world example of this involving styles.xml, I can look at that then. In the meantime, this toehold might serve as a template for adding other style processing to Ods Reader.

Looking at other formats, processing of column widths was also missing from Html Reader, and is now added. Note that this will work only with inline Css declarations on the `col` tags, which can be generated by Html Writer using `setUseInlineCss(true)`. This creates a much larger file than one created without inline CSS.

A general problem became evident when studying the code. Worksheet `columnDimensions` is an unsorted array. This is not a problem per se, but it can easily lead to unexpected results from a `getColumnDimensions` call. The code is changed to sort the array before returning it in `getColumnDimensions`.

One existing test failed as a result of this change. It errorneously tested `getHighestColumn` instead of `getHighestDataColumn`, which caused a problem because the final column declaration included a `number-columns-repeated` attribute. The new result for `getHighestColumn` is correct, and the test is changed to use `getHighestDataColumn` instead, which was certainly its intent.
2023-06-13 17:06:05 -07:00
oleibman eba7271134 Changelog Updates 20230609 (#3612)
Added a few changes not documented since last update.
2023-06-09 10:30:56 -07:00
oleibman a1d960ba81 Improvements for Data Validation (#3605)
Fix #3592. Fix #3594. The original issue asked that Data Validation be added for Xml spreadsheets. However, doing so exposed some other Data Validation problems, which are corrected along with the Xml portion.

The main other problem is that the code for `Cell\DataValidator::isValid` covered almost no possibilities. It is expanded to include all possibilities, except for Custom Types, which I will continue to think about. Many tests are added.

An obscure problem is that Xlsx Reader does not quite work properly when the Data Validation cells are beyond the high-used column or row. We use the high-used values because it is completely impractical to set all the cells in a range when an entire column or row is selected. This change causes the leftmost top cell in a range to be explicitly allocated, affecting the high-used values. It is not 100% effective, but it will be much more difficult to get into the problem situation, which I will continue to think about.

Although our expectation is that we will not see any Xml Spreadsheets using non-standard namespacing, much of the Xml Reader code is changed to use proper namespace techniques. A few areas which just had nothing to do with this change continue to use less robust techniques; I plan to address those soon after implementing this change.

One of the Data Validation types is for time of day. Testing revealed that `Shared\Date::convertIsoDate` was insufficiently robust when determining whether its input consisted of a time of day without date. It is now more robust.
2023-06-08 12:34:00 -07:00
jpachta e258918a81 Update reading-files.md (#3607)
Fixed typo in code examples in name of variable `$columnAddress` that was wrongly shortened to `$column`. Long version of the variable name $columnAddress is used in the corresponding samples scripts so now the docs match the samples.
2023-06-07 22:09:12 -07:00
oleibman a2edbf8776 Unzipped Gnumeric File (#3591)
* Unzipped Gnumeric File

A Gnumeric file is normally a gzipped Xml file. However, the Gnumeric application will also read an unzipped Xml file. Allow PhpSpreadsheet to do the same.

* Scrutinizer (legitimate)

Fix minor problem.
2023-06-03 07:53:54 -07:00
oleibman a0a9b2be21 HyperlinkBase Property, and Html Handling of Properties (#3589)
* HyperlinkBase Property, and Html Handling of Properties

Fix #3573. The original issue concerned non-support of Document Properties in Xml spreadsheets. However, most of the Properties mentioned there were already supported. But the investigation revealed some gaps in Html coverage.

HyperlinkBase is the one property mentioned in the issue that was not supported for Xml, nor indeed for any other format. All the other document properties are 'meta'; but HyperlinkBase is functional - if you supply a relative address for a link, Excel will use HyperlinkBase, if supplied, to convert to an absolute address. (Default is directory where spreadsheet is located.) Here's a summary of how this PR will handle this property for various formats:
- Support is added for Xlsx read and write.
- Support is added for Xml read (there is no Xml writer). Ironically, Excel messes up this processing when reading an Xml spreadsheet; however, PhpSpreadsheet will get it right.
- HyperlinkBase is supported for Xls, but I have no idea how to read or write this property. For now, when writing hyperlinked cells, PhpSpreadsheet will be changed to convert any relative addresses that it can detect to absolute references by adding HyperlinkBase to the relative address. In a similar vein, Xls supports custom properties, but PhpSpreadsheet does not know how to read or write those.
- Gnumeric has no equivalent property, so nothing needs to be done to its reader. Since we don't have a Gnumeric writer, that's not really a problem for us.
- Odt has no equivalent property, so nothing needs to be done to its reader. The Odt writer does not have any special logic for hyperlinks, so, at least for now, will remain unchanged.
- Csv has no equivalent property, so nothing needs to be done to its reader. The Csv writer does not have any special logic for hyperlinks, so, at least for now, will remain unchanged.
- Html allows for an equivalent `base` tag in the head section. Support for this is added to Html reader and writer.

Html Writer was only handling 8 of the 11 'core' properties. Support is added for `created`, `modified`, and `lastModifiedBy`. Custom properties were not supported at all, and now are.

Html Reader did not support any properties. It will now support all of them.

* Scrutinizer

Remove one dead reference.
2023-06-02 23:25:38 -07:00
oleibman 3aab263580 Upgrade mitoteam/jpgraph (#3603)
They have made some changes at my request, the major effect of which is that it will now work with 33_Chart_create_bar_stacked. This is a departure for them in that they have changed the functionality of jpgraph, not merely made sure that it is compatible with new Php releases.
2023-06-01 22:17:30 -07:00
oleibman 9b9e30c582 Upgrade php-cs-fixer (#3602)
Dependabot wanted to do this, but the changes to php-cs-fixer caused it to report errors in 7 modules, all due to spacing in comments. I hate this, but who asked me? Just fix them.
2023-06-01 19:25:09 -07:00
dependabot[bot] 1c6e2dbc9a Bump phpstan/phpstan-phpunit from 1.3.11 to 1.3.13 (#3597)
Bumps [phpstan/phpstan-phpunit](https://github.com/phpstan/phpstan-phpunit) from 1.3.11 to 1.3.13.
- [Release notes](https://github.com/phpstan/phpstan-phpunit/releases)
- [Commits](https://github.com/phpstan/phpstan-phpunit/compare/1.3.11...1.3.13)

---
updated-dependencies:
- dependency-name: phpstan/phpstan-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>
2023-06-01 07:36:59 -07:00
dependabot[bot] 27e8a1f03d Bump mpdf/mpdf from 8.1.5 to 8.1.6 (#3596)
Bumps [mpdf/mpdf](https://github.com/mpdf/mpdf) from 8.1.5 to 8.1.6.
- [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.1.5...v8.1.6)

---
updated-dependencies:
- dependency-name: mpdf/mpdf
  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>
2023-06-01 07:16:29 -07:00
dependabot[bot] 27b3fc3b22 Bump phpunit/phpunit from 9.6.7 to 9.6.8 (#3595)
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.6.7 to 9.6.8.
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.8/ChangeLog-9.6.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.6.7...9.6.8)

---
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>
2023-06-01 07:06:09 -07:00
oleibman b8191244d5 Accommodating Slash with preg_quote - Delimiters (#3584)
PR #3513, developed by @SaidkhojaIftikhor, has been stuck for some time awaiting tests. This is the first of three PRs to replace that one. This PR also allows the use of slash as a thousands separator or decimal separator or currency symbol. These are, of course, very unusual situations; the main reason to support them is so that PhpSpreadsheet code will not crash when users set those options. New Calculation/Engine and AdvancedValueBinder tests confirm these. While making these changes, a few errors were found in AdvancedValueBinder and Calculation/Engine/FormattedNumber, e.g. currencies weren't parsed correctly when period was used as the group separator and comma as the decimal separator. Tests have been added for those situations.
2023-05-27 07:54:12 -07:00
oleibman 5a6d8b9285 Accommodating Slash with preg_quote - Structured Reference Column Names (#3583)
PR #3513, developed by @SaidkhojaIftikhor, has been stuck for some time awaiting tests. This is the second of three PRs to replace that one. This accomodates the use of slash as a delimiter in column names in Tables and Structured References. The source changes are very simple. Additional tests exercise all the source changes.

There is also a preg_quote call when a table is renamed. I have also changed it to accomodate slash, because it's the right thing to do. But ... I can't think how to test it. PhpSpreadsheet will not allow you to set a table name to a string containing a slash (a test is added to confirm), and, if I manually update the Xml in an Xlsx spreadsheet so that the name does contain a slash, Excel will, understandably, complain that the file is corrupt.
2023-05-27 07:40:30 -07:00
oleibman 4f6d1f77a3 Accommodating Slash with preg_quote - Text Functions (#3582)
PR #3513, developed by @SaidkhojaIftikhor, has been stuck for some time awaiting tests. This is the first of three PRs to replace that one. This accomodates the use of slash as a delimiter in functions TEXTAFTER, TEXTBEFORE, TEXTSPLIT, and NUMBERVALUE. The source changes are very simple. Additional tests exercise all the source changes.
2023-05-27 07:16:54 -07:00
oleibman 9a13f526c5 Redo Calculation of Color Tinting (#3580)
* Redo Calculation of Color Tinting

Fix #3550. Some colors are specified in Excel by specifying a theme color to which a tint is applied. The original PHPExcel algorithm for doing this was developed by trial and error, and is good enough a lot of the time. However, for the issue at hand, the resulting color is detectably different from the calculation that Excel makes. Searching the web, I found https://gist.github.com/Mike-Honey/b36e651e9a7f1d2e1d60ce1c63b9b633 which comes much closer for the case in hand, and for all the other cases that I've looked at. That code depends on Python colorsys package; I have adapted the code from the Python gist and package into a new Php class. This doesn't agree perfectly with Excel. However, if each of the red, green, and blue components (each a value between 0 and 255 inclusive) agree within plus or minus 3 (arbitrary choice) of Excel's result, I think that is good enough.

I have added a new test member which reads from a spreadsheet with Xml altered by hand to set up several theme/tint cells. These tests use the plus-or-minus-3 criterion. They result in 100% code coverage of the new class.

Unsuprisingly, some existing tests failed with the new code. Issue2387Test reads a theme/tint font color, and is changed to use the plus-or-minus-3 criterion, comparing against the color as Excel shows it.

ColorChangeBrightness showed 9 failures with the new code. It consists of calculations not involving a spreadsheet. For that reason, I felt it was sufficient to just do an exact match test, changing the 9 old results for new results confirmed with the Python code. I also added one new test case, the one that kicked off this entire PR.

* Scrutinizer Being Stupid

It strikes again.
2023-05-25 13:05:55 -07:00
oleibman 407479f1a2 Non-Static Data Provider (#3585)
That is deprecated in PhpUnit 10. All existing ones were corrected, but a new one slipped by.
2023-05-23 21:14:12 -07:00
oleibman 11854514a0 Changes to NUMBERVALUE, VALUE, DATEVALUE, TIMEVALUE (#3575)
* Changes to NUMBERVALUE, VALUE, DATEVALUE, TIMEVALUE

Fix #3574. Reporter received deprecation notice for NUMBERVALUE function with invalid arguments. In fact, the arguments turn out to be valid after all; NUMBERVALUE treats a null-string or an all-blank-string in the first argument as if it were 0. Fixed this, and added several test cases suggested by it.

VALUE had been parsing its argument the same way as NUMBERVALUE. However, VALUE does not substitute 0 for null-string or all-blank-string. Coded up the difference between the two, and added the same tests for VALUE as for NUMBERVALUE.

VALUE can also pass its argument to DATEVALUE or TIMEVALUE. It is currently over-permissive about that, because Php is over-permissive, e.g. `new DateTime('q')` will return a DateTime object with the current date and time with a timezone of 'q'. Excel will, naturally, return `#VALUE!` for `DATEVALUE('q')`. I don't know that we can ever match Excel's (AFAIK not formally documented) decisions here 100%, but we can get a lot closer by parsing the date string if and only if it contains at least one digit. Code to enforce that is added to DATEVALUE and TIMEVALUE, and appropriate tests are added.

* Failure for Php 7.4 Linux

After not seeing any such problem for many months, this is the second day in a row where result is different on Windows than Linux with no apparent reason to think why that should be the case. At any rate, easily solved.
2023-05-23 08:49:34 -07:00
oleibman dbba802555 WIP Contingency for Zipstream 3.0 (#3410)
Zipstream's newest production release requires Php8.1. This is not necessarily a problem for us as we are locked to an earlier release. However, psr/simple-cache became a real mess for us as people wanted to install PhpSpreadsheet alongside other products which required a version of simple-cache that could not run in some of the versions of Php which we support, and I would like to avoid having to go through that again. This ticket is a contingency to put us ahead of the curve in case such a problem should arise with Zipstream. There is reason to believe that Zipstream is not so widely used as simple-cache, so we do not need to rush this change in. However, should that belief prove incorrect, the change should be ready to go when needed.
2023-05-23 07:35:03 -07:00
oleibman 482fe6de64 Recognize 'Hidden' Attribute and Other Unsupported Options in Xml Spreadsheet (#3567)
* Recognize 'Hidden' Attribute in Xml Spreadsheet

Fix #3566; PhpSpreadsheet should now handle Hidden attribute for rows and columns in Xml spreadsheets. Also added the ability to load Xml spreadsheet from string rather than file, as can be done for Csv and Html.

* Add Support for Top Left Cell

Another missing piece.

* Font Bold/Italic

Was always setting to true rather than checking value for 0/1.

* Active Sheet Index

Had always been set to hard-coded 0. Read it from XML if available.

* Selected Cells

Get Selected Cells from XML when available.

* Worksheet Protection and Style Protection

Add support for those to Xml Reader.

* Column Spans

Not really an essential part of Excel, used in Xml to reduce file size.
2023-05-18 08:04:37 -07:00
oleibman f8121e751d Allow Index_number as Array for VLOOKUP/HLOOKUP (#3570)
Fix #3561. PhpSpreadsheet VLOOKUP/HLOOKUP allow the specification of index_number (third parameter) as an array when lookup_value (first parameter) is supplied as an array. Change to permit index_number as an array even when lookup_value is not an array, as Excel does.
2023-05-17 23:47:06 -07:00
dubox 40203ff6cb Update Html.php (#3535)
* Update Html.php

Add position attr for image whitch driving by MemoryDrawing

* add unit test for pr#3535

* Fix code styles

* Fix code styles

* use a local image instead of  web image

* add image for pr#3535

* code style fix
2023-05-12 07:35:41 -07:00