We're running VarBase on PostgreSQL, and get a consistent 500 return when trying to create a custom block. Clicking on a block type on the "Add custom block" page returns a 500, with this error in the Apache logs:
[Mon Apr 24 17:18:15.526889 2017] [proxy_fcgi:error] [pid 8511:tid 139929712387840] [client 2001:4978:312:1:76de:2bff:fef7:1074:60285] AH01071: Got error 'PHP message: TypeError: Argument 1 passed to Drupal\\content_lock\\ContentLock\\ContentLock::__construct() must be an instance of Drupal\\Core\\Database\\Driver\\mysql\\Connection, instance of Drupal\\Core\\Database\\Driver\\pgsql\\Connection given, called in /home/bsafecprehs/public_html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 288 in /home/bsafecprehs/public_html/docroot/modules/contrib/content_lock/src/ContentLock/ContentLock.php on line 88 #0 /home/bsafecprehs/public_html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(288): Drupal\\content_lock\\ContentLock\\ContentLock->__construct(Object(Drupal\\Core\\Database\\Driver\\pgsql\\Connection), Object(Drupal\\Core\\Extension\\ModuleHandler), Object(Drupal\\Core\\Access\\CsrfTokenGenerator), Object(Drupal\\Core\\Datetime\\DateFormatter), Object(Drupal\\Core\\Session\\AccountProxy), Object(Drupal\\Core\\Config\\ConfigFactory))\n#1 /home/bsafecprehs/public_html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupa...\n', referer: https://bsafecprehs.com/block/add?destination=/admin/structure/block/blo...
The issue looks to be passing a PostgreSQL connection where a MySQL connection is expected. Why would a MySQL connection be expected when on a site installed on PostgreSQL? This looks to be happening in the Content Lock module, but I see no database-specific settings in the Content Lock configuration.
Comment | File | Size | Author |
---|---|---|---|
#7 | content_lock-Fix_mysql_specific_code-12055305-7.patch | 1.4 KB | Ben Coleman |
Comments
Comment #2
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedContent locking module
https://www.drupal.org/project/content_lock
From the error back track you posted
Please have a look at the list of issues for Content locking
https://www.drupal.org/project/issues/content_lock?categories=All
or report the issue for them.
Comment #3
Ben Coleman CreditAttribution: Ben Coleman at Accelerated Design, Inc. commentedMoving this to Content Locking
Comment #4
Ben Coleman CreditAttribution: Ben Coleman at Accelerated Design, Inc. commentedCorrecting version
Comment #5
Ben Coleman CreditAttribution: Ben Coleman at Accelerated Design, Inc. commentedComment #6
Ben Coleman CreditAttribution: Ben Coleman at Accelerated Design, Inc. commentedLooking over the code a bit, I note that the issue is that Drupal\content_lock\ContentLock defines the connection variable ($database) as a Drupal\Core\Database\Driver\mysql\Connection. I have not yet dug into this part of Drupal, but I wonder if instead using Drupal\Core\Database\Driver\mysql\Connection, it should use the abstract Drupal\Core\Database\Connection, so that the type will match whichever connection type is is use?
Comment #7
Ben Coleman CreditAttribution: Ben Coleman at Accelerated Design, Inc. commentedThis patch fixes the above issue. Instead of treating the database connection as a Drupal\Core\Database\Driver\mysql\Connection, it treats it as a Drupal\Core\Database\Connection. This works on PostgreSQL. Someone probably should verify that it still works on MySQL, but I think it should.
Comment #8
Ben Coleman CreditAttribution: Ben Coleman at Accelerated Design, Inc. commentedComment #9
Rajab Natshah CreditAttribution: Rajab Natshah at Vardot commentedGood, I will use it.
Thank you Ben.
I think better to add PostgreSQL to the automated functional testing robot.
Comment #11
chr.fritschThanks for the patch, Ben!