-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[0.2.27] behavior change in EMPTY management #75
Comments
Can you tell me what these tests were exactly and how I can reproduce the problem? |
To reproduce, from https://github.com/viest/php-ext-xlswriter (with php 7 devel installed)
Failing test are
On Fedora 31, using libzip 1.7.1 |
I did not write the PHP library, so I need to reproduce this in C to get to the bottom of this. |
Thanks. Now I can reproduce the issue when using XLSXIOREAD_SKIP_EMPTY_CELLS. |
Great... If you have a fix, I can try it before a new release. |
Okay, I will let you know when I committed new code. |
More work than I thought. Not finished yet, but if you like you can already test master if it no longer crashes/hangs. |
Using a6ab8e1 |
Final issues resolved. It took me a while to make sure all combinations of XLSXIOREAD_SKIP_EMPTY_* worked well. |
Looks like f49a3d1 breaks something else
|
Test file used by this test |
Can't reproduce in C. What exactly is being tested here? |
Not clear to me @viest can you please help on this ? IIUC, second row have no value, but 2 empty rows are returned ( |
To clarify, this is the correct behavior. |
Ok, so fixing the tests of the ext side |
This seems unreasonable, there is nothing in worksheet.xml, so you should not add cells. |
The basic idea is to read tables from Excel files. |
Perhaps because it was the old behavior with version <= 0.2.27 ? |
In the If you ignore the sheet.xml file and insert some dummy empty cells, the expenditure in terms of traversal performance will increase. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1:E3"/>
<sheetViews>
<sheetView tabSelected="1" workbookViewId="0"/>
</sheetViews>
<sheetFormatPr defaultRowHeight="15"/>
<sheetData>
<row r="1" spans="1:5">
<c r="B1" t="s">
<v>0</v>
</c>
</row>
<row r="3" spans="1:5">
<c r="A3" t="s">
<v>1</v>
</c>
<c r="E3" s="1">
<v>43726.6259375</v>
</c>
</row>
</sheetData>
<pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
</worksheet> |
Let me clarify a bit more the library was designed to read tables, which means the have header rows and then data below them.
In this case the table would look like:
For the behaviour you're expecting an extra flag could be created to ignore the header line. |
If the original idea was to return an equal number of cells based on the table header, you might also need a configuration that allows users to customize the row where the table header is located. In the actual environment, you may encounter many problems. In many cases, the first row is not the table header. And this modification will destroy the existing application, which needs to be evaluated. |
Okay, so in your opinion, would it be better to require a new flag to get the table behaviour and to default to not using the table behaviour?. |
IMHO: yes, as this will restore old behavior, and make the "table" one new and optional (avoid BC break) |
Yes, keeping the API single responsibility helps to achieve more valuable functions, such as the function of php-ext-xlswriter: skip N lines. |
To be clear about the change
And the PHP extension was used to ignore cell with 0 index. |
For now the table behaviour (determining the number of columns based on header row) is only active when using the XLSXIOREAD_SKIP_EXTRA_CELLS flag. This is now in release 0.2.29. |
IMHO everything looks consistent XLSXIOREAD_SKIP_NONE
Notice: |
|
It's really bad, skip does not mean that he does not exist, so the index also needs to be updated. |
As the design is to support streaming data the engine doesn't read ahead, so it doesn't know what it's going to skip. |
OK, But for now, No skip:
Skipping all
When we expect
Using attached test code |
I'm actually really happy to find this bug -- I'm hoping to use this library to read spreadsheets that don't have headers at all. The data will represent physical layouts, with codes in each cell to indicate what should be placed at that location. The first line will contain only one cell with a description string. It looks like the behavior I'm looking for will be supported with either SKIP_NONE or SKIP_EMPTY_CELLS. The text in the README.md might need updating, though:
|
@brechtsanders any idea about to fix this ? |
Looks like the change in 0.2.27 creates a behavior change resulting in infinite loop.
Found trying to run https://pecl.php.net/package/xlswriter test suite against 0.2.27 (was ok against 0.2.26)
2 tests are failing with process timeout
@viest for information, if you can also have a look
The text was updated successfully, but these errors were encountered: