Notice: unserialize() [function.unserialize]: Error at offset 0 of 1634304 bytes in theme_dblog_message() (line 265 of /home/www2/drupal-7.16/modules/dblog/dblog.admin.inc).

Recoverable fatal error: Argument 2 passed to t() must be an array, boolean given, called in /home/www2/drupal-7.16/modules/dblog/dblog.admin.inc on line 265 and defined in t() (line 1478 of /home/www2/drupal-7.16/includes/bootstrap.inc).

Comments

neRok’s picture

Status: Active » Closed (cannot reproduce)

Here is the relevant section from 7.22

    // Messages without variables or user specified text.
    if ($event->variables === 'N;') {
      $output = $event->message;
    }
    // Message to translate with injected variables.
    else {
      $output = t($event->message, unserialize($event->variables));
    }

The errors are occurring due to $event->variables not being a serialized array, but a boolean value (yes/no, maybe wanted to be 'N;'). I would suggest that whichever module has set the error (or has called theme_dblog_message), has not set the property correctly.

Please re-open if you can provide more info.

david_garcia’s picture

Version: 7.16 » 7.x-dev
Issue summary: View changes

But...in case serialized data is not properly set or corrupt in some way, at least we should not be getting WOD:

https://drupal.org/node/2213671

nancydru’s picture

Status: Closed (cannot reproduce) » Closed (duplicate)
tomarnold2’s picture

StatusFileSize
new634 bytes

Hi, I ran into this issue when applying critical core update 7.59. This "fix" avoids the error but masks the upstream problem. I suppose a better fix would be to check if it's an array or not first and then write out to watchdog, but here's a simple patch that I hope someone else running into this will find helpful.

Description
Something was mis-written to dblog and when the data is being unserialized it's coming back with just a number (e.g. the serialized data might somehow be showing-up as {i:4} and then a '4' is the only thing returned). Passing this as an integer when an array is expected causes an error when attempting to view the dblogs. (Note: it's not easy to reproduce unless you somehow have your dblog with an item that was mislogged)

Solution
Cast the returned value from the call to unserialize() as an array to avoid the problem.

Caveats
Not a perfect solution:

  • Masks the upstream issue - that is, why / where was something miswritten to the dblog?
  • Better solution - set a variable to the return value for unserialize(), check if it's an array, log an error if not
  • My first contributed patch - my apologies if I didn't submit this correctly - I read guidelines, etc., and *think* I got naming, etc., right, etc., but ... yah, hence the caveat

Thanks. Love this community. I hope this helps someone like others have helped me so many times.