Community & Support

'Notice: unserialize() [function.unserialize]: Error at Offset' when changing event dates

On a live server (problem never occured on development server) all events created using Events module have reset to 1 Jan 1970 and any attempt to change them fails and gives this error:

Notice: unserialize() [function.unserialize]: Error at offset 1016 of 1016 bytes in /home/fhlinux166/w/womeninjournalism.co.uk/user/htdocs/includes/bootstrap.inc on line 390

Having tried updating Events to dev version and then changing it back to same version on dev server, I am convinced this is a server / Drupal issue rather than the module itself.

Does anyone know what is causing this? Googling the problem gives a wide variety of reasons but nothing I can pinpoint. I'm not a PHP developer so this isn't really my strong point....

Thanks

R

Comments

I get the error and haven't

I get the error and haven't found any posts about it

same error here at line 390

same error here at line 390 w/ drupal 5.10

------------------------------------------------
http://www.designbrigade.com

Me too on 5.10

http://drupal.org/node/211207

seems to have an solution, but haven't investigated yet
-Andre'

André Angelantoni
Founder, PostPeakLiving.com

MBSTRING

I had the same problem . Check your drupal stauts report and check if the mbstring php module is installed on your server.
Hope this fix yours.

Just installed the Acquia

Just installed the Acquia stack and seeing the same message. Clearing the cache did not solve. The fix is in [Site Information] http://www.doitwithdrupal.com/2008/sessions/basecamp-built-drupal . I completed the info, ie Site Name and email address and the message seems to have gone away.

have this in Drupal 6 too.

have this in Drupal 6 too. Did as described above (entered emailaddress) but that didn't fix the prob.

---------------------------------------------
what we do in life echoes in eternity

have this problem too

I have this problem too. I am programming a module, made a menu option for admin/settings/my_email and calls the form creation function in my_email.admin.inc, and that looks fine, but when I enter the values I want to save, I get:

Notice: unserialize() [function.unserialize]: Error at offset 1480 of 2307 bytes in /var/www/vhosts/richmahn/subdomains/new/httpdocs/includes/bootstrap.inc on line 478

Notice: unserialize() [function.unserialize]: Error at offset 1677 of 2504 bytes in /var/www/vhosts/richmahn/subdomains/new/httpdocs/includes/bootstrap.inc on line 478

However, the fields in the form do save (i.e. can retrieve with variable_get()) Any thoughts?

---
Science = Knowledge, including real supernatural events that lead from our creation to the purpose of where we are today.
---

Here is your answer...

This error occurs when there is a character or characters within your array that you would like to serialize that will mess up the serialized string. The one that usually kills people is the ampersand. Here is a quick solution.

Add these functions:

function formatSerialize(&$strItem, $strKey)
{
    $strItem = str_replace('&', '[amp;]',$strItem);
}
   
function formatSerializeRev(&$strItem, $strKey)
{
    $strItem = str_replace('[amp;]', '&',$strItem);
}

Now that you have these in place, just before your serialize your array:
Run the following: (This is assuming your array variable name is $arrMenu)

array_walk_recursive($arrMenu,'formatSerialize');
$strSerialized = serialize($arrMenu);

once you have successfully unserialized your array, you can run the other:

$arrMenu = unserialize($strSerialized);
array_walk_recursive($arrMenu,'formatSerializeRev');

Good luck,

Marco

uncommon characters in database

Hi guys,

I had the same error on my site after migrating it to another server. (=> mysqldb : export - import)
after that i got this error, pinpointing this line (third one):

    $result = db_query('SELECT * FROM {variable}');
    while ($variable = db_fetch_object($result)) {
      $variables[$variable->name] = unserialize($variable->value);

via phpmyadmin i took a peek in the DB of my site in the variables table and one of the variables (footer variable) had some strange characters in it. After removal of these characters everything worked fine again. I guess somewhere along the export-import procedure the "é" character changed into two strange characters with which the unserialize function had serious problems ;)

i'm not saying that everybody's unserialize error can be solved by messing around in the variables table. You should start by looking into the bootstrap.inc file on the specified line to see what it is the unserialize function is trying to unserialize. Then you should try to find out where that data is coming from, and correct it.

Good luck everybody,

Peter Verbeek.

DB Collation

I had these 'strange' characters in my DB after migrating from one server to another and I was resolving it as Peter describes above. This will fix the problem but I will now describe how I stopped the problem occuring.

I found I had different DB and Table collations between my live and dev servers. Using PHPAdmin I simple changed the rogue collations (in my case I had some latin_swedish collations - I cannot explain why) so all the collations, for db and all tables, matched (in my case utf8_general_ci). I then re-exported and imported the db and problem solved!

Don't forget to back up your db before doing this!

Hope this helps, Phil

DB tuner module

Thanks! I'm trying to do this but its very tedious using phpmyadmin (you have to go to each table, select every column...). For D6 there is the DB tuner module

Unfortunately I'm on D7, so i ran

a code to change all tables to utf8_general_ci

Now, every table is utf8_general_ci

Anyway, I'm still getting this error

Notice: unserialize() [function.unserialize]: Error at offset 256 of 337 bytes en UserController->attachLoad() (línea 288 de /var/www/modules/user/user.module).

Edit: I removed the code, because it brought other dangerous issues, I had to restore a backup

Upgraded to Drupal 7 on local server.

Notice: Undefined index: required in field_multiple_value_form() (line 207 of /Applications/MAMP/htdocs/sitename/modules/field/field.form.inc).

Listed as a php type by the Database logging module. Ran /update/php followed by initiating a cron run.

Looks like it worked. Can't get the notice reappear.

Tied up with other projects. Just got back to this and found it didn't work as first thought still have a problem. Now changed to:

Notice: Undefined index: module in _field_info_prepare_instance_display() (line 353 of /Applications/MAMP/htdocs/sitename/modules/field/field.info.inc).

Problem cleared by clearing email as suggested by Arnaud Fischer's above post. Thanks Arnaud.

Re-export and re-import

In my case, I just re-export data from 'variable' table in the first site and then re-import again in the second site, and that's solved the problem.

nobody click here