Good day

After update from 7.0 to 7.2, i got

Notice: unserialize() [function.unserialize]: Error at offset 65533 of 65535 bytes in views_db_object->load_row() (line 1857 в /mysite/sites/all/modules/views/includes/ Notice: unserialize() [function.unserialize]:


Error at offset 65501 of 65535 bytes в views_db_object->load_row() (line 1857 in /mysite/sites/all/modules/views/includes/

What is it?
What can I do?


merlinofchaos’s picture

What is the result of 'describe views_view' and 'describe views_display' from mysql prompt?

Valeratal’s picture

merlinofchaos’s picture

Status: Active » Closed (won't fix)

65535 is a really interesting number, as that is the maximum number you get with a short int. That suggests that while your database is showing that you have a longtext it is not, in fact, storing a longtext and that -- somehow -- the serialized blob fields are getting cut off.

I don't know what we could possibly do about this. It may be a bug in DBTNG or in your database version or in your PDO version? I don't know where to begin to investigate that.

I don't think there's much we can do about it in Views. :(

Carol11’s picture

Title: Function.unserialize Error at offset 65533 of 65535 bytes » unserialize() [function.unserialize]: Error at offset 2642 of 3582 bytes in views_db_object->load_row() (row 2004
Version: 7.x-3.0-beta3 » 7.x-3.0-rc1

the title appears when I go to structure->blocks

row 2004 is in my version of the second row of
'filter' => array(
'title' => t('Filter criteria'),
'ltitle' => t('filter criteria'),
'stitle' => t('Filter criterion'),
'lstitle' => t('filter criterion'),
'plural' => 'filters',

I had some problems with beta3 before and installed the last version of views(3.0-rc1). It did not solve my problems. But I lost during this upgrade the operators of my filter conditions. I was able to fix it. But I was still not happy, because I get tabs with 'view' and 'view items' even if the user is not loged in. And I get it also for simple articles. A further problem is that a view block in the main content region is not really recognized by the system and I still get the Welcome title and the information that no content was created. So I have to create at least one article for the main content region.
I decided to upgrade to drupal 7.4 because I had some trouble with wysiwyg too. I was not happier afterwards and decided to bring my system back to version 7.2. And now I get the above error message ....
Please do not tell me that I have to start again with an installation of drupal 7.4. I think that drupal 7 is not in the condition to start with it. Are you able to give as some information, when views will be in a stable state?

Carol11’s picture

I was able to reproduce this unserialize problem with a smaller SQL file in my local installation. When I split one of the rows containing the content of column display_options of table views_display inserting CR/LF in the PHP array data, I get this problem. So it was probably my failure using the wrong export format. But anyway. It would be very nice if you catch this exception in further versions and remove such characters. It is not easy to analyze the SQL file and like me not all people test the SQL export file with an import in a local installation before changing the original database.

Carol11’s picture

sorry. I have this problem also in a local system which was upgraded from 7.2 to 7.4 and from views beta3 to rc1. And there was definitively no database import.

xamount’s picture

I was having this same error. It seems to be related to the way the mysql db was exported and imported. Anyways, to fix the error (at least manually), here is how I did it:

I truncated these tables:


Then I exported and imported all my custom views manually.

I got the solution from here.

mustafa.ata’s picture

Yes it works, Thanks xamount.


nicl’s picture

Just want to add, I had this problem and xamount's solution also worked for me. :) So thanks!

ps. in my case the db import was problematic because the site was migrating to a rubbishy shared host with limited mysql access and config options :(

pasive’s picture

As for me, I moved all views to code and it resolved the unserialize issues.

Summit’s picture

Hi, How to make views to code, do you have a framework to share?
Thanks in advance, greetings, Martijn

rootical’s picture

I've got hundreds of views.. And i don't want at all to manually remove export/import them.
Please, someone, any other solution?

memcinto’s picture

For other ways to solve the problem, see In addition, I was able to solve the problem by editing each of my Views one by one, making a trivial change (adding a space to the view description, e.g.), and saving the View. After each save, the error repeated, until I apparently got to the problem view. Once I saved that view, the error went away.

SocialNicheGuru’s picture

Issue summary: View changes

I got this error too.

There was a view that was created by a module.
I updated the module.
The associated view self-corrected.
I had to go back and save it.
Error went away

Aurochs’s picture

Thanks - helped me - what i did is (i use adminer) i imported a back-up database just as doubling my original database and deleted the 2 tables inthe old database and imported them from the backup-database (i made backup some adys ago so i am lucky)

feddovdm’s picture

Indeed, find the view and save it (also update your view module can help).

megastruktur’s picture

If you have dozens of views you don't have to remove them all, just need to find, where is the error.
This short MySQL script will show you the view, which is broken:

SELECT v.vid,, v.display_options, length(display_options)
FROM views_display vd
LEFT JOIN views_view v ON v.vid = vd.vid
WHERE length(display_options)="HEREISTHENUMBER"

Just change the HEREISTHENUMBER to whatever is in your error (in our case 3582):
Error at offset 2642 of 3582 bytes.

Then you can copy display_options column value to you text editor, find the str 2642 (a place of error) and try to figure out, why serialization is broken (in my case there was a s:4:" ? " - we don't have 4 symbols here, so I changed it to s:4:"hell" and saved the table).

After that I was able to access view and (just in case) made a minor change and clicked Save :)

Summit’s picture

Great info Megastruktur!!!

millionleaves’s picture

Here's the SQL from #17 in full (it wouldn't run on my server as written in #17 with the table name abbreviations).

select views_view.vid,, views_display.display_options, length(display_options)
from views_view views_view
left join views_display views_display on views_view.vid = views_display.vid
where length(display_options) = "HEREISTHENUMBER";

This solution gave me what I needed - identified a number of broken views. Editing and fixing them got rid of the error reported here.