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
Comment #1
Dean Reilly commentedPatch attached.
Comment #2
alexpottIt'd be great to get some tests here...
Comment #3
berdirThere 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.
Comment #4
berdirActually, that doesn't work because it contains a reference to the class and that is different. This does.
Comment #5
jessebeach commentedI tested #4 on the following stack
D8: 23da9dd978e0fd29ca90e669b01840d3de2bd750
#1678002-154: Edit should provide a usable entity-level toolbar for saving fields
#2004350-4: Unserialised database connection objects don't use Drupal's PDO Statement class
#1901100-48: Make Edit module work with TempStore, so revisions are not saved on all atomic field edits
This video shows what the error looked like from the front end: http://www.youtube.com/watch?v=CsOIG5yZPpw&feature=youtube_gdata_player
With the patch above, everything works: http://www.youtube.com/watch?v=F_KA2vhoXqk&feature=youtube_gdata_player
Comment #6
gábor hojtsyThe code also looks pretty reasonable.
Comment #7
dries commentedCommitted to 8.x. Thanks!