The website encountered an unexpected error. Please try again later.Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column 'gid' at row 1: INSERT INTO {node_access} (nid, langcode, fallback, realm, gid, grant_view, grant_update, grant_delete) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7), (:db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13, :db_insert_placeholder_14, :db_insert_placeholder_15); Array
(
[:db_insert_placeholder_0] => 46
[:db_insert_placeholder_1] => en
[:db_insert_placeholder_2] => 1
[:db_insert_placeholder_3] => content_access_roles
[:db_insert_placeholder_4] =>
[:db_insert_placeholder_5] => 1
[:db_insert_placeholder_6] => 1
[:db_insert_placeholder_7] => 0
[:db_insert_placeholder_8] => 46
[:db_insert_placeholder_9] => en
[:db_insert_placeholder_10] => 1
[:db_insert_placeholder_11] => all
[:db_insert_placeholder_12] => 0
[:db_insert_placeholder_13] => 1
[:db_insert_placeholder_14] => 0
[:db_insert_placeholder_15] => 0
)
in Drupal\node\NodeAccessControlHandler->writeGrants() (line 165 of core/modules/node/src/NodeAccessControlHandler.php).
content_access.module is using deprecated function writeGrants when trying to change grants on the node. Drupal.org recommends that it should be replaced with acquireGrants.
Comment | File | Size | Author |
---|---|---|---|
#17 | content_access-2971094-17.patch | 1.92 KB | MustangGB |
| |||
#16 | content_access-2971094-16.patch | 1.96 KB | MustangGB |
#8 | deprecated_function_writegrants_throws_error_2971094_8.patch | 1.92 KB | brooke_heaton |
Comments
Comment #2
Pejka CreditAttribution: Pejka as a volunteer commentedComment #3
Pejka CreditAttribution: Pejka as a volunteer commentedComment #4
Pejka CreditAttribution: Pejka as a volunteer commentedComment #6
imclean CreditAttribution: imclean commentedAcquiring grants is not the same as writing them. You'll need to add a
write()
after theaquire()
. See #2473021: Deprecate NodeAccessControlHandlerInterface::writeGrants() for removal in Drupal 9.0.xThere are also 3 other instances:
Comment #7
brooke_heaton CreditAttribution: brooke_heaton as a volunteer commentedThis is now happening on Drupal 8.8.1 using content_access 8.x-1.0-alpha1 and it is a fatal error. Increasing Priority to Major.
Comment #8
brooke_heaton CreditAttribution: brooke_heaton as a volunteer commentedAttached patch replaces deprecated writeGrants function with:
Comment #9
brooke_heaton CreditAttribution: brooke_heaton as a volunteer commentedComment #10
AkashKumar07 CreditAttribution: AkashKumar07 commentedI tested the patch of #8 on my local. LGTM.
Thanks
Comment #11
imclean CreditAttribution: imclean commentedThese should be injected.
\Drupal::
shouldn't be used in a class.There is more deprecated code unrelated to this patch, such as
drupal_set_message()
andt()
.Comment #12
imclean CreditAttribution: imclean commentedComment #13
gisleUnassigning to let others try to finalize this one.
Comment #14
AkashKumar07 CreditAttribution: AkashKumar07 commentedI will work on this today.
Comment #15
AkashKumar07 CreditAttribution: AkashKumar07 commentedComment #16
MustangGB CreditAttribution: MustangGB commentedRerolled
Comment #17
MustangGB CreditAttribution: MustangGB commentedTrying again
Comment #19
gisleThank you for the patch, MustangGB. It has been committed to the latest development snapshot. It looks like this make the project compatible with Drupal 9, which is great!
As pointed out by imclean in comment #11,
\Drupal::
shouldn't be used in a class. However, I prefer to close this one as fixed, and split that out into a separate issue.