Changeset 4500

Show
Ignore:
Timestamp:
06/08/08 21:34:23 (13 months ago)
Author:
guilhermeblanco
Message:

Fixed data import when contains numeric values that exceed the maximum int/float PHP values.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.11/lib/Doctrine/Parser/Spyc.php

    r4406 r4500  
    546546      $value = NULL; 
    547547    } elseif (preg_match ('/^[0-9]+$/', $value)) { 
    548     // Cheeky change for compartibility with PHP < 4.2.0 
    549       $value = (int)$value; 
     548      // Cheeky change for compartibility with PHP < 4.2.0 
     549      $raw = $value; 
     550      $value = (int) $value; 
     551 
     552      if ((string) $value != (string) $raw) { 
     553          $value = (string) $raw; 
     554      } 
    550555    } elseif (in_array(strtolower($value), 
    551556                array('true', 'on', '+', 'yes', 'y'))) { 
     
    555560      $value = false; 
    556561    } elseif (is_numeric($value)) { 
    557       $value = (float)$value; 
     562      $raw = $value; 
     563      $value = (float) $value; 
     564 
     565      if ((string) $value != (string) $raw) { 
     566          $value = (string) $raw; 
     567      } 
    558568    } else { 
    559569      // Just a normal string, right?