Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-84

Long string fields are being silently changed to 255 characters in the schema

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.0.1
    • Fix Version/s: 2.0.2, 2.1
    • Component/s: Schema Managers
    • Labels:
      None

      Description

      I have an entity like this:

      /**
       * @orm:Entity
       */
      class Product
      {
          /**
           * @orm:Id
           * @orm:Column(name="Merchant",type="string",length=50)
           */
          protected $merchant;
      
          /**
           * @orm:Column(name="Name",type="string",length=500)
           */
          protected $name;
      }

      When I change the length of $name field to 4000 it updates the schema like it is supposed to:

      php.exe -f console doctrine:schema:update --dump-sql
      ALTER TABLE product CHANGE Name Name VARCHAR(4000) NOT NULL

      But when I change the length to 5000 it just silently without any warning uses value 255 instead:

      php.exe -f console doctrine:schema:update --dump-sql
      ALTER TABLE product CHANGE Name Name VARCHAR(255) NOT NULL

      I had to look into actual table definition using mysql browser to find this issue because doctrine doesn't even warn about it. This could lead to some pretty serious bugs!

        Activity

        Oleg Anashkin created issue -
        Hide
        Benjamin Eberlei added a comment -

        Fixed in master and 2.0.x

        Show
        Benjamin Eberlei added a comment - Fixed in master and 2.0.x
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.2 [ 10118 ]
        Fix Version/s 2.1 [ 10068 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12339 ] jira-feedback2 [ 17691 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17691 ] jira-feedback3 [ 20046 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-84, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Oleg Anashkin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: