When serialising the datbase connection object we remove the connection, schema and driverClasses objects before hand and reinitialise them when the string is unserialised. However, when recreating the PDO connection class we don't set ATTR_STATEMENT_CLASS again so any statements created use the default PHP PDO class which doesn't have all of the methods Drupal expects and so can lead to issues.

As a quick fix I've added in some code to set the attribute again but it might be better to look into calling out to the constructor again to avoid duplicating code.

Comments

Dean Reilly’s picture

Status: Active » Needs review
StatusFileSize
new662 bytes

Patch attached.

alexpott’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

It'd be great to get some tests here...

berdir’s picture

There you go.

This has been driving @jbeach crazy in #1901100: Make Edit module work with TempStore, so revisions are not saved on all atomic field edits where this results in fatal error. So raising priority.

berdir’s picture

Actually, that doesn't work because it contains a reference to the class and that is different. This does.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

The code also looks pretty reasonable.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.