View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0019927 | mantisbt | reports | public | 2015-07-13 11:59 | 2015-09-06 17:37 |
Reporter | Alexis Vibet | Assigned To | vboctor | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Linux | OS | Debian | OS Version | 7 |
Product Version | 1.2.15 | ||||
Target Version | 1.3.0-beta.3 | Fixed in Version | 1.3.0-beta.3 | ||
Summary | 0019927: Wrong datatype in excel XML export | ||||
Description | When generating excel XML export, sometimes the excel datatype is not valid for some particular values. In function excel_prepare_string, excel_api.php file, line 142 : The excel datatype is either "Number" or "String" depending on the result of is_numeric. However is_numeric(" 42") returns true so the "Number" datatype is chosen, but excel does not consider " 42" to be a number and refuse to open the file. | ||||
Steps To Reproduce | In one of the bugs, input " 42" (<space>42) in "OS version", then try to do an excel export : excel will complain the value " 42" is invalid and will refuse to open the file. | ||||
Additional Information | tested with PHP 5.4 on debian 7 XML file opened with Excel 2007 on Windows 7. | ||||
Tags | No tags attached. | ||||
Pull Request: Please test and confirm the fix above. |
|
Alexis Vibet, could you please test if a value like for example 0x539 (which is numeric in terms of PHP is_numeric function) works with Excel 2007? |
|
It would also be interesting to know which field contained the space, since the approach we typically follow is to trim on save. So in addition to trimming on export, we can also fix the missing trim on save. |
|
I tought mantis made a trim on save on all fields. |
|
@vboctor @atrol @vboctor and fgalvis |
|
It does not make that much sense to have different types in one column based on the content of one row. Do we have any standard field that is always numeric? What about always using "String"? |
|
I've updated the pull request to only use numeric for the numeric fields as per @atrol suggestion. My testing shows that it works fine. Please test and let me know. |
|
I am asking as I was not able to reproduce the original issue with newer Excel versions. |
|
@atrol, no I haven't tested on Excel 2007 and won't be able to. But now we are not dependent on is_numeric() and hence the cause mention here for the breakage is no longer relevant. I'm planning to merge the PR soon and if there is an issue we can follow up later. |
|
I don't have access to Excel 2007, but I think I have a 2003 version somewhere at home if that can help. |
|
|
|
Tried Excel 2007, got no error. |
|