-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Undefined array key 0 in Relation.php getForeigners() when parsing Shopware 6 product table #20190
Copy link
Copy link
Open
Labels
BugA problem or regression with an existing featureA problem or regression with an existing featureaffects/5.2This issue or pull-request affects 5.2.x releases (and maybe further versions)This issue or pull-request affects 5.2.x releases (and maybe further versions)affects/6.0This issue or pull-request affects 6.0.x releases (and maybe further versions)This issue or pull-request affects 6.0.x releases (and maybe further versions)confirmed/5.2This issue is confirmed to be reproduced on 5.2 at the time this label was setThis issue is confirmed to be reproduced on 5.2 at the time this label was sethas-prAn issue that has a pull request pending that may fix this issue. The pull request may be incompleteAn issue that has a pull request pending that may fix this issue. The pull request may be incompletepatch
Metadata
Metadata
Assignees
Labels
BugA problem or regression with an existing featureA problem or regression with an existing featureaffects/5.2This issue or pull-request affects 5.2.x releases (and maybe further versions)This issue or pull-request affects 5.2.x releases (and maybe further versions)affects/6.0This issue or pull-request affects 6.0.x releases (and maybe further versions)This issue or pull-request affects 6.0.x releases (and maybe further versions)confirmed/5.2This issue is confirmed to be reproduced on 5.2 at the time this label was setThis issue is confirmed to be reproduced on 5.2 at the time this label was sethas-prAn issue that has a pull request pending that may fix this issue. The pull request may be incompleteAn issue that has a pull request pending that may fix this issue. The pull request may be incompletepatch
Type
Fields
Give feedbackNo fields configured for issues without a type.
Describe the bug
Warning in
./libraries/classes/ConfigStorage/Relation.php#449Undefined array key 0when browsing a table with complex foreign keys(e.g. Shopware 6
producttable).Steps to reproduce
producttable (SELECT * FROM product)Root cause
In
Relation.phparound line 449, the parser result is accessed without a null check:When
PhpMyAdmin\SqlParser\Parserfails to parse Shopware 6's complexSHOW CREATE TABLE productoutput (due to long constraint chains andself-referencing foreign keys), it returns an empty
statements[]array.Accessing
[0]on an empty array triggers the warning.The
instanceof CreateStatementcheck below already guards the usageof
$stmt, but not the assignment.Fix
This is safe because the existing
instanceof CreateStatementcheckhandles
nullgracefully, leavingforeign_keys_dataas[].Server configuration
Additional context
Shopware 6's
producttable has ~15+ foreign keys includingself-referencing ones (
parent_id → id), which appear to cause theSqlParser to return an empty
statements[]instead of throwing an exception.Verified fix works on phpMyAdmin 5.2.1 and 5.2.3.