Doctrine 1
  1. Doctrine 1
  2. DC-179

Wrong length estimation in Doctrine_Validator->validateLength() if locale sets decimal point other than "dot"

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.0-ALPHA1
    • Fix Version/s: 1.2.0-BETA2
    • Component/s: Validators
    • Labels:
      None
    • Environment:
      Apache/2.2.11 (Win32) PHP/5.2.11, windows vista

      Description

      Test case:
      1) set locale: setlocale(LC_ALL, "") (on windows it sets current international control panel settings), in case of Polish locale it changes decimal point to ',' (comma)
      2) try to save value "12,12" of decimal type field (mysql type):

      { type: decimal(4), scale: 2 }

      ,
      3) it gives you validation error (length)

      Summary:
      Doctrine_Validator->validateLength() could not count length properly.

      Idea:
      I changed dot character in explode function to proper env character:

      // changes start
      $localeInfo = localeconv();
      $e = explode($localeInfo["mon_decimal_point"], $value);
      // changes end

      It works for me.

      Enclosed Validator.php

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Adam Michalunio
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: