Answers.Body: <p>This is because Craft stores the <code>sortOrder</code> values in the database with a MySQL column type of <code>tinyint</code> that happens to be signed, which means it can store a range of <code>-128</code> to <code>127</code>.</p>
  
  <p>Aside from the fact that negative sort orders don't make much sense, that means if you have 127 or more Matrix blocks to sort, things will stop working as expected.  Because <a href="http://www.wired.com/1997/01/did-gates-really-say-640k-is-enough-for-anyone/" rel="nofollow">127 things to sort ought to be enough for anyone</a>, right?</p>
  
  <p>Regardless, in the next (<a href="https://craftcms.com/changelog#build2765" rel="nofollow">post 2.5.2765</a>) release, we've changed <em>all</em> sort order column in the database to be unsigned <code>smallint</code>s, which means they can store a range of <code>0</code> to <code>65535</code>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-02-24T18:11:59.567Z
Answers.LastActivityDate: 2016-02-24T18:11:59.567Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&amp;drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save at all, reverting the order as soon as I refresh.</p>
  
  <p>I've pumped the php.ini settings (<code>upload_max_filesize=128M</code>, <code>post_max_size=256M</code>
  ,<code>max_input_vars=4000</code>) and set the block limit in CP to 200 so that shouldn't be the issue.</p>
  
  <p>I'm also not getting a logged error.</p>
  
  <p>Does this ring a bell with anybody?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-24T16:50:23.510Z
Comments.Text: Just to follow up, I'm able to add and change block content, ie the title, text or any fields within a block. Did some troubleshooting and it seems that any blocks after position 125 fails to update the sortOrder in the DB. Also, if I drag a block above the 125 mark, it sorts OK.
Comments.UserDisplayName: terjeofnorway
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-24T22:49:43.930Z
Comments.Text: FYI: [Craft 2.5.2767](https://craftcms.com/changelog#build2767) is now up, fixing the issue as per Brad's answer below.
Comments.UserDisplayName: Mats Mikkel Rummelhoff
Tags: <matrix><ordering><limit><blocks><number>
Title: Unable to sort large number of blocks in Matrix field in CP and template
ThreadText: # Unable to sort large number of blocks in Matrix field in CP and template
  
  (Asked by: username_0 on 2016-02-24)
  
  I have about 145 blocks in a single Matrix. If I try and re-arrange (drag&drop) the first few blocks, and then hit save, all is well. However, trying to re-arrange the last few blocks doesn't save at all, reverting the order as soon as I refresh.
  
  I've pumped the php.ini settings (`upload_max_filesize=128M`, `post_max_size=256M`
  ,`max_input_vars=4000`) and set the block limit in CP to 200 so that shouldn't be the issue.
  
  I'm also not getting a logged error.
  
  Does this ring a username_2 with anybody?
  
  **Tags:** matrix, ordering, limit, blocks, number
  
  > **Comments:**
  > **username_0**: Just to follow up, I'm able to add and change block content, ie the title, text or any fields within a block. Did some troubleshooting and it seems that any blocks after position 125 fails to update the sortOrder in the DB. Also, if I drag a block above the 125 mark, it sorts OK.  
  > **username_1**: FYI: [Craft 2.5.2767](https://craftcms.com/changelog#build2767) is now up, fixing the issue as per username_2's answer below.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-02-24. Score: 3 | Accepted answer
  
  This is because Craft stores the `sortOrder` values in the database with a MySQL column type of `tinyint` that happens to be signed, which means it can store a range of `-128` to `127`.
  
  Aside from the fact that negative sort orders don't make much sense, that means if you have 127 or more Matrix blocks to sort, things will stop working as expected. Because [127 things to sort ought to be enough for anyone](http://www.wired.com/1997/01/did-gates-really-say-640k-is-enough-for-anyone/), right?
  
  Regardless, in the next ([post 2.5.2765](https://craftcms.com/changelog#build2765)) release, we've changed *all* sort order column in the database to be unsigned `smallint`s, which means they can store a range of `0` to `65535`.
  
  
  ---
  
  