-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Description
Describe the bug
Warning in ./libraries/classes/ConfigStorage/Relation.php#449
Undefined array key 0 when browsing a table with complex foreign keys
(e.g. Shopware 6 product table).
Steps to reproduce
- Have a Shopware 6 database on MariaDB 10.11
- Open phpMyAdmin and browse the
producttable (SELECT * FROM product) - Warning appears immediately
Root cause
In Relation.php around line 449, the parser result is accessed without a null check:
// BEFORE (broken):
$stmt = $parser->statements[0];When PhpMyAdmin\SqlParser\Parser fails to parse Shopware 6's complex
SHOW CREATE TABLE product output (due to long constraint chains and
self-referencing foreign keys), it returns an empty statements[] array.
Accessing [0] on an empty array triggers the warning.
The instanceof CreateStatement check below already guards the usage
of $stmt, but not the assignment.
Fix
// AFTER (fixed):
$stmt = $parser->statements[0] ?? null;This is safe because the existing instanceof CreateStatement check
handles null gracefully, leaving foreign_keys_data as [].
Server configuration
- phpMyAdmin version: 5.2.3
- MariaDB version: 10.11.11-MariaDB-0+deb12u1 (Debian 12)
- PHP version: PHP 8.3.6
- Web server: nginx version: nginx/1.24.0 (Ubuntu)
Additional context
Shopware 6's product table has ~15+ foreign keys including
self-referencing ones (parent_id → id), which appear to cause the
SqlParser to return an empty statements[] instead of throwing an exception.
Verified fix works on phpMyAdmin 5.2.1 and 5.2.3.