PhpSpreadsheet/samples/Reader
oleibman ea74c96e98
Name Clashes Between Parsed and Unparsed Drawings (#2423)
* Name Clashes Between Parsed and Unparsed Drawings

This is at least a partial fix for #2396 and #1767 (which has been around for a long time). PhpSpreadsheet renames drawing XML files when it reads them from a spreadsheet. However, when it writes unparsed drawing files, it uses the original names, which can result in a clash with the renamed files. The solution in this PR is to write the unparsed files using the same renaming convention as the the others.

This is an incredibly simple fix, basically a one-line change, for such a long-lived problem. It is conceivable that this PR breaks a more sophisticated file than I have come across, e.g. with multiple unparsed files associated with a single worksheet. However, this PR does fix at least part of the problem for both issues, and causes no regression issues. The changed code was covered in only 2 tests - Reader/XlsxTest testLoadSaveWithEmptyDrawings and Writer/Xlsx/UnparsedDataTest testLoadSaveXlsxWithUnparsedData.

2396 is covered by a new test Unparsed2396Test. I had trouble figuring out what to test for 1767. Since it is a problem that becomes evident only when the output file is opened in Excel, I added a new sample to cover it.

* Sloppy Errors

I neglected to run php-cs-fixer and phpstan, and it bit me.

* Scrutinizer

It's not as good as Phpstan at recognizing problems that can't happen due to previous assertions.

* Scrutinizer Again

It can be really stupid sometimes.
2021-12-09 23:37:15 -08:00
..
sampleData Name Clashes Between Parsed and Unparsed Drawings (#2423) 2021-12-09 23:37:15 -08:00
01_Simple_file_reader_using_IOFactory.php Merge all examples together 2017-10-01 17:48:59 +09:00
02_Simple_file_reader_using_a_specified_reader.php Merge all examples together 2017-10-01 17:48:59 +09:00
03_Simple_file_reader_using_the_IOFactory_to_return_a_reader.php Merge all examples together 2017-10-01 17:48:59 +09:00
04_Simple_file_reader_using_the_IOFactory_to_identify_a_reader_to_use.php Merge all examples together 2017-10-01 17:48:59 +09:00
05_Simple_file_reader_using_the_read_data_only_option.php Merge all examples together 2017-10-01 17:48:59 +09:00
06_Simple_file_reader_loading_all_worksheets.php Merge all examples together 2017-10-01 17:48:59 +09:00
07_Simple_file_reader_loading_a_single_named_worksheet.php Merge all examples together 2017-10-01 17:48:59 +09:00
08_Simple_file_reader_loading_several_named_worksheets.php Merge all examples together 2017-10-01 17:48:59 +09:00
09_Simple_file_reader_using_a_read_filter.php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
10_Simple_file_reader_using_a_configurable_read_filter.php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
11_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_1).php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
12_Reading_a_workbook_in_chunks_using_a_configurable_read_filter_(version_2).php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
13_Simple_file_reader_for_multiple_CSV_files.php Merge all examples together 2017-10-01 17:48:59 +09:00
14_Reading_a_large_CSV_file_in_chunks_to_split_across_multiple_worksheets.php Work on renaming method arguments for the Readers and Writers 2020-11-19 16:41:52 +01:00
15_Simple_file_reader_for_tab_separated_value_file_using_the_Advanced_Value_Binder.php Rename classes to keep them in their related namespaces 2017-10-29 17:39:42 +09:00
16_Handling_loader_exceptions_using_TryCatch.php Tweaks to Input File Validation (#2217) 2021-07-24 20:44:04 -07:00
17_Simple_file_reader_loading_several_named_worksheets.php Upgrade to PHP-CS-Fixer 2.7 2017-10-01 20:07:04 +09:00
18_Reading_list_of_worksheets_without_loading_entire_file.php Merge all examples together 2017-10-01 17:48:59 +09:00
19_Reading_worksheet_information_without_loading_entire_file.php Merge all examples together 2017-10-01 17:48:59 +09:00
20_Reader_worksheet_hyperlink_image.php Reduce PHPStan error in tests 2021-04-12 11:10:23 +09:00
21_Reader_CSV_Long_Integers_with_String_Value_Binder.php String value binder (#901) 2019-02-23 18:40:07 +01:00
22_Reader_issue1767.php Name Clashes Between Parsed and Unparsed Drawings (#2423) 2021-12-09 23:37:15 -08:00