I encounter the following error when I install the webform module and go to the webform address.
1) drupal 8.6.9
2) postgres

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "*****Name webform******" LINE 5: ...') AND (entity_type = 'webform') AND (entity_id = '*-****Name webform****** ^: SELECT ge.group_id AS group_id FROM {webform_access_group_entity} ge INNER JOIN {webform_access_group_user} gu ON ge.group_id = gu.group_id WHERE (webform_id = :db_condition_placeholder_0) AND (entity_type = :db_condition_placeholder_1) AND (entity_id = :db_condition_placeholder_2) AND (uid = :db_condition_placeholder_3); Array ( [:db_condition_placeholder_0] => *****Name webform****** [:db_condition_placeholder_1] => webform [:db_condition_placeholder_2] => *****Name webform****** [:db_condition_placeholder_3] => 1 ) in Drupal\webform_access\WebformAccessGroupStorage->loadByEntities() (line 203 of /usr/share/nginx/html/drupal-test/web/modules/contrib/webform/modules/webform_access/src/WebformAccessGroupStorage.php).

Comments

naeimi20 created an issue. See original summary.

kb_klash’s picture

I got an email from a customer today about the same issue. I am also using the latest version of Drupal 8 and running on a PostgreSQL database. I get the same error as detailed above.

jrockowitz’s picture

There are 3 PostgreSQL tests that are failing. I am not running PostgreSQL locally.

This seems like a common issue. Any patch which fixes these broken tests would be appreciated.

kb_klash’s picture

I'm definitely adding this to my list of reasons why my shop should switch to MySQL instead of PostgreSQL.

jrockowitz’s picture

Status: Active » Needs work
jmsouney’s picture

I am using Drupal 8.6.10 with a PostgreSQL database and also have the same issue/error.

jrockowitz’s picture

I think webform_query_webform_submission_access_alter() is causing this regression and someone just needs to debug the SQL query being generated.

kb_klash’s picture

Looking into it a little, I was able to find that in webform_access/src/WebformAccessGroupStorage.php in the loadByEntities method, it appears that when it loads $source_entity, the id ( $source_entity->id() ) is coming through as a string when the query that it gets passed to on line 184 ( $query->condition('entity_id', $source_entity->id()); ) is expecting it to be an integer. I commented line 184 out and was able to get past the white screen of death, but I'm getting an message that says "Unable to display this webform. Please contact the site administrator." Obviously this is because it isn't loading it properly, but it is some progress.

I'm going to keep looking at this but I figured this might help with the context.

kb_klash’s picture

Also it looks like my webform_access_group_entity table is completely empty, so maybe nothing is getting in there in the first place?

kb_klash’s picture

In webform_access.module, if I comment out line 176 which states $webform_access_groups = $webform_access_group_storage->loadByEntities($webform, $source_entity, $account); and add a new line under it with $webform_access_groups = [];, I can actually load the page and see the form. I realize this is bypassing the access restrictions and is definitely not the real solution, but at least it gives someone smarter than me a place to look.

jrockowitz’s picture

Status: Needs work » Needs review
StatusFileSize
new1.41 KB

Here is my best guess for a solution.

jrockowitz’s picture

Can someone running Postgres with this issue please review the attached patch?

solide-echt’s picture

StatusFileSize
new2.21 KB

Hey,

Tried it, running Postgres 9.5.3 patched against rev 649b7616 for webform module. The error persisted because the storage definition still expects an integer so simply casting will not work. Please find attached a patch including a hook_update. Please be cautioned: I have not tested this with existing data. But for me this works.

AFAIK Drupal is not completely consistent with ID's being integers or not, I've seen errors like these before with other contribs in D7. Strangely enough after adding an access group still in numeric ID is stored, not the machine name.

Greetings,
Eric

jrockowitz’s picture

This does seem like the right direction. I will look into making sure the update hook is okay.

jrockowitz’s picture

StatusFileSize
new2.48 KB
new3.77 KB

The attached patch includes some minor tweaks.

  • jrockowitz committed 9ab11d6 on 8.x-5.x
    Issue #3034127 by jrockowitz, solide-echt: error webform access with...
jrockowitz’s picture

Status: Needs review » Fixed

I committed the patch. Please download the latest dev release to review.

Status: Fixed » Closed (fixed)

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

gxleano’s picture

I get the same error, I´m using Drupal 8.7.2 with PostgreSQL.