kasimbadami / php-excel-reader

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

_format_value call on string overwrites value #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In Method _getCellDetails() a call to _format_value() is performed on
string values (line 1133 on version 2.11). 

If the value in the cell happens to be a number but the format is
'GENERAL', the code overwrites the actual value by the FORMAT, effectively
destroying the original value.

Demo: a call to _format_values('GENERAL', 3, 0) returns 'GENERAL' rather
then '3'

This is probably due to line 474, where the predicted subpattern $part[0]
is used as pattern without checking if that makes any logical sense.

Original issue reported on code.google.com by arne.bla...@gmail.com on 3 Feb 2009 at 7:12

GoogleCodeExporter commented 9 years ago
Fix:

Add this code after line 474:

  if (count($parts)==1) {
    $pattern = $num;
  }

Original comment by arne.bla...@gmail.com on 3 Feb 2009 at 7:16

GoogleCodeExporter commented 9 years ago
Fixed in version 2.2

Original comment by matthew....@gmail.com on 25 Mar 2009 at 2:39

GoogleCodeExporter commented 9 years ago
This issue is infact NOT fixed...

Original comment by DavidM...@gmail.com on 28 Oct 2009 at 1:39

GoogleCodeExporter commented 9 years ago
Output from function :
G

Original comment by DavidM...@gmail.com on 28 Oct 2009 at 1:44