Module issues when using database table prefix

Created on 17 October 2024, about 1 month ago

Problem/Motivation

When using a prefix for database tables, certain functions do not behave correctly.

This issue is particularly noticeable on the SQL Dump settings page.
When a database prefix is used for example D10_, the columns for the tables do not display data, leaving the tables empty.
Additionally, trying to save the form triggers PHP warnings such as:

Warning: foreach() argument must be of type array|object, string given in Drupal\gdpr_dump\Form\SettingsForm->submitForm() (line 265 of modules/contrib/gdpr/modules/gdpr_dump/src/Form/SettingsForm.php).

The issue arises in functions that run custom queries, including getColumns(), fetchColumnNames(), sanitizeData(), and others.

Steps to Reproduce

  1. Install a clean Drupal site and configure it to use a database table prefix.
  2. Install the "General Data Protection Regulation" module along with its submodule, "General Data Protection Regulation (GDPR) - Obfuscated SQL Dump".
  3. Navigate to the "SQL Dump settings" page and observe that all table columns are blank.

Proposed Resolution

Modify the custom queries within the affected functions to properly handle database table prefixes.

🐛 Bug report
Status

Active

Version

3.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024