3

Context, using doctrine to store an array as longtext in mysql column. Received some Notice: unserialize(): Error at offset 250 of 255 bytes.I therefore did some backtracking to realize the serialized string was truncated because its too big for a long text column. I really doubt that is the case. This string is near and far away from being 4GB.

Someone from this question suggested to take a look at SET max_allowed_packet but mine is 32M.

 a:15:{i:0;s:7:"4144965";i:1;s:7:"4144968";i:2;s:7:"4673331";i:3;s:7:"4673539";i:4;s:7:"4673540";i:5;s:7:"4673541";i:6;s:7:"5138026";i:7;s:7:"5140255";i:8;s:7:"5140256";i:9;s:7:"5140257";i:10;s:7:"5140258";i:11;s:7:"5152925";i:12;s:7:"5152926";i:13;s:7:"51

Mysql table collation: utf8_unicode_ci

Any help would be greatly appreciated !!

Full Error

Operation failed: There was an error while applying the SQL script to the database.
ERROR 1406: 1406: Data too long for column 'numLotCommuns' at row 1
SQL Statement:
UPDATE `db`.`table` SET `numLotCommuns`='a:15:{i:0;s:7:\"4144965\";i:1;s:7:\"4144968\";i:2;s:7:\"4673331\";i:3;s:7:\"4673539\";i:4;s:7:\"4673540\";i:5;s:7:\"4673541\";i:6;s:7:\"5138026\";i:7;s:7:\"5140255\";i:8;s:7:\"5140256\";i:9;s:7:\"5140257\";i:10;s:7:\"5140258\";i:11;s:7:\"5152925\";i:12;s:7:\"5152926\";i:13;s:7:\"51}' WHERE `id`='14574'
Community
  • 1
  • 1
delmalki
  • 1,326
  • 1
  • 13
  • 31

2 Answers2

2

The column was a tinytext...

Only logical explanation I can understand from this is that whether when I created my table in earlier version of doctrine, the default was tiny text

OR

I remember changing the type of the column within doctrine annotations and maybe the update didn't fully convert the type correctly.

Bottom line, check your types even though you use an orm.

delmalki
  • 1,326
  • 1
  • 13
  • 31
0

Your column must have been defined as varchar(250). You need to first convert it to the longtext.

Dharam Gollapudi
  • 6,328
  • 2
  • 34
  • 42