New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument 5 passed to PhpMyAdmin\Table::_getSQLToCreateForeignKey() must be of the type array, string given #13941

Closed
xuefer opened this Issue Jan 16, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@xuefer

xuefer commented Jan 16, 2018

Steps to reproduce

  1. submit Foreign key constraints

Expected behaviour

Foreign key constraints added

Actual behaviour

Uncaught TypeError: Argument 5 passed to PhpMyAdmin\Table::_getSQLToCreateForeignKey() must be of the type array, string given, called in /var/www/htdocs/phpMyAdmin/libraries/classes/Table.php on line 2384 and defined in /var/www/htdocs/phpMyAdmin/libraries/classes/Table.php:2464
Stack trace:
#0 /var/www/htdocs/phpMyAdmin/libraries/classes/Table.php(2384): PhpMyAdmin\Table->_getSQLToCreateForeignKey('users', Array, 'tracker', 'lkp', 'type', '', 'RESTRICT', 'RESTRICT')
#1 /var/www/htdocs/phpMyAdmin/libraries/classes/Controllers/Table/TableRelationController.php(253): PhpMyAdmin\Table->updateForeignKeys(Array, Array, Array, Array, Array, 'users', Array)
#2 /var/www/htdocs/phpMyAdmin/libraries/classes/Controllers/Table/TableRelationController.php(127): PhpMyAdmin\Controllers\Table\TableRelationController->updateForForeignKeysAction()
#3 /var/www/htdocs/phpMyAdmin/tbl_relation.php(70): PhpMyAdmin\Controllers\Table\TableRelationController->indexAction()
#4 {main}
 thrown in /var/www/htdocs/phpMyAdmin/libraries/classes/Table.php on line 2464

Server configuration

Operating system: Gentoo

Web server: lighttpd

Database: mariadb

PHP version: 7.1

phpMyAdmin version: git master rev 2823d27

Client configuration

Browser: Chrome

Operating system: Windows

philly-php added a commit to philly-php/phpmyadmin that referenced this issue Feb 22, 2018

fix: wrong argument type passed when creating foreign key
we were passing a string into the function to create sql to create a foreign key constraint. This function expects an array, since foreign keys can reference multiple columns.

Fixes Issue phpmyadmin#13941

Signed-off-by: Leonid Sklyut <lsklyut@kbra.com>

philly-php added a commit to philly-php/phpmyadmin that referenced this issue Feb 23, 2018

refactor: cast the foreign field to an array prior to using it
right now, there is no way to select multiple columns for an index, even though mysql allows it. Since the destination_foreign_column will always be a string at the moment, I am casting it to an array prior to using it, as the code expects it to be one.

we were passing a string into the function to create sql to create a foreign key constraint. This function expects an array, since foreign keys can reference multiple columns.

Fixes Issue phpmyadmin#13941

Signed-off-by: Leonid Sklyut <lsklyut@kbra.com>

@mauriciofauth mauriciofauth self-assigned this Mar 27, 2018

@mauriciofauth mauriciofauth added the bug label Mar 27, 2018

@mauriciofauth mauriciofauth referenced this issue Mar 27, 2018

Closed

Fix broken Relation View #14010

4 of 4 tasks complete

mauriciofauth added a commit that referenced this issue Mar 27, 2018

Fixes error in foreign key sql generation + drop foreign key contraint (
#14031)

* Fixes error in foreign key sql genration, issue #14030
Changed:
	templates/table/relation/foreign_key_row.twig
The destination_column_names were getting passed as a 1d array, the names when extracted gave a string. Passing it as a 2d array (see templates/table/relation/foreign_key_row.twig lines 123,133) fixes the issue.

Sign-Off-By: Lakshay arora (b16060@students.iitmandi.ac.in)

* Fixes error in foreign key sql generation + drop foreign key contraint, issue #14030
Changed:
	templates/table/relation/foreign_key_row.twig

Fix #13941
Fix #14009
Close #14037
Close #14010

Signed-off-by: Lakshay arora <b16060@students.iitmandi.ac.in>
(cherry picked from commit 00b5962)
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment