kenan77 / php-excel-reader

Automatically exported from code.google.com/p/php-excel-reader
0 stars 0 forks source link

error reading file created with Excel 2004 for Mac #25

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Attempting to import the attached Test.xls file will result in

Notice: Undefined property: rootentry in excel_reader2.php on line 232
Notice: Undefined index: in excel_reader2.php on line 232
Notice: Undefined index: in excel_reader2.php on line 195
[last error repeats infinitely]

Attached patch.diff appears to resolve the problem.

For reference this is excel_reader2.php Version 2.21 on a G5 PowerMac with OS X 
10.4.11 and PHP 
4.4.9 (cli) using Excel 2004 for Mac 11.5.4

Original issue reported on code.google.com by mwcre...@gmail.com on 29 May 2009 at 6:22

Attachments:

GoogleCodeExporter commented 8 years ago
Actually, it could be the problem is that I am running this on PowerPC.  
Specifically, I am thinking the calls to 
unpack "ddouble" which are marked as "machine dependent".  Running on Intel 
(10.5.7) does not have this 
problem, and it appears that dates are coming across wonky on PowerPC but look 
fine in Intel.  sigh.

Original comment by mwcre...@gmail.com on 30 May 2009 at 5:24

GoogleCodeExporter commented 8 years ago
OK, it appears the problem was endianess after all, and not some difference in 
the file format.  Converting the 
packed doubles to little endian seems to fix the problem.  Ignore the previous 
patch, attached is a new patch 
which checks endianess and converts to little endian if necessary.  I have 
tested it on both Intel and PowerPC 
macs.

Original comment by mwcre...@gmail.com on 30 May 2009 at 6:00

Attachments: