Problem/Motivation

On installation when setting the field index for data the webform_submitted_data schema must be passed to db_add_index(). Otherwise the user is met with;
Catchable fatal error: Argument 4 passed to db_add_index() must be of the type array, none given.

Proposed resolution

Pass the webform_submitted_data schema to db_add_index().

Reference

https://api.drupal.org/api/drupal/core!includes!database.inc/function/db...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swim created an issue. See original summary.

swim’s picture

Status: Active » Needs review
FileSize
644 bytes

Please find patch attached.

Status: Needs review » Needs work

The last submitted patch, 2: webform-pass-webform-submitted-data-schema-2579569-1-8.patch, failed testing.

The last submitted patch, 2: webform-pass-webform-submitted-data-schema-2579569-1-8.patch, failed testing.

dunin’s picture

dunin’s picture

Status: Needs work » Needs review

Review my patch.

Status: Needs review » Needs work

The last submitted patch, 5: webform-pass-webform-submitted-data-schema-2579569-5.patch, failed testing.

swim’s picture

8.x-4.x-dev won't pass testing until the actual tests are updated; otherwise we get CI error. Patch in #5 looks good, while db_index_exists and db_driver are available in D8 they'll be deprecated for D9.

tedbow’s picture

@dunin your patch in #5 worked for me.

I am uploading another version with just a couple small changes.

  1. +++ b/webform.install
    @@ -752,9 +753,12 @@ function webform_install() {
    +	$connectionOptions = Database::getConnection()->getConnectionOptions();
    

    Just indentation problem.

  2. +++ b/webform.install
    @@ -752,9 +753,12 @@ function webform_install() {
    +	$webform_schema = webform_schema();
    

    Call to webform_schema is not needed unless if statement is true.

podarok’s picture

Assigned: Unassigned » podarok
Category: Task » Bug report
Status: Needs work » Fixed

Fixed in latest dev

Status: Fixed » Closed (fixed)

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

fenstrat’s picture

Assigned: podarok » Unassigned
Status: Closed (fixed) » Active

As noted in #2556817-12: Include field specification when adding an index to "data" field for webform_submitted_data the fix that is mentioned in #10 isn't ideal, the fix from #9 is a better solution.

fenstrat’s picture

Status: Active » Fixed

Committed and pushed to 8.x-4.x. Thanks!

  • fenstrat committed 5c77b84 on 8.x-4.x
    Issue #2579569 by swim, dunin, tedbow: Fixed db_add_index does not...

Status: Fixed » Closed (fixed)

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