Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 291050

Exception: Serialization of 'Closure' is not allowed in serialize() (line 154 of dblog.module)

$
0
0

Problem

  • When an exception is thrown during a entity storage controller save() operation, all you get is this fatal error:

    Error message

    Exception: Serialization of 'Closure' is not allowed in serialize() (line 154 of \core\modules\dblog\dblog.module).

    The website has encountered an error. Please try again later.
  • Whereas the dumping the entry that was supposed to be logged contains the actual error that may be this:

    SQLSTATE[42S22]: Column not found: 1054 Unknown column ...

Cause

  • The $log_entry being passed to hook_watchdog() contains a 'backtrace' in its variables, which in turn contains the DrupalKernel/DI container and other classes and Closures that cannot be serialized.
  • dblog_watchdog() performs this:

          'variables' => serialize($log_entry['variables']),

Viewing all articles
Browse latest Browse all 291050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>