Skip to content
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

TypeError (return null) in database designer #14223

Closed
Leymooo opened this Issue Apr 22, 2018 · 24 comments

Comments

@Leymooo
Copy link

commented Apr 22, 2018

Steps to reproduce

  1. Login to pma
  2. Select database
  3. Click to designer

Actual behaviour

Error in processing request
Error code: 500
Error text: Internal Server Error (rejected)
It seems that the connection to server has been lost. Please check your network connectivity and server status.

[Sun Apr 22 18:23:16.590861 2018] [php7:error] [pid 26283] [client 93.185.245.150:54488] PHP Fatal error: Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Database\Designer::getHtmlTableList() must be of the type array, null given, called in /usr/share/phpmyadmin/db_designer.php on line 190 and defined in /usr/share/phpmyadmin/libraries/classes/Database/Designer.php:290\nStack trace:\n#0 /usr/share/phpmyadmin/db_designer.php(190): PhpMyAdmin\Database\Designer->getHtmlTableList(NULL, NULL)\n#1 {main}\n thrown in /usr/share/phpmyadmin/libraries/classes/Database/Designer.php on line 290

Server configuration

Operating system:
Debian 9 (4.9.82-1+deb9u3)
Web server:
Latest apache2 from default repos.
Database:
10.2.14-MariaDB-10.2.14+maria~stretch from http://mirror.23media.de/mariadb/repo/10.2/debian
PHP version:
Latest 7.2.4 (From https://packages.sury.org/php/)
phpMyAdmin version:
4.8.0.1

Client configuration

Browser:
Google Chrome 65.0.3325.181
Operating system:
Windows 7

In pma 4.7.9 designer works good.

@ibennetch

This comment has been minimized.

Copy link
Member

commented Apr 22, 2018

Clearly something isn't right here, but I'm also using the sury PHP package and don't have this problem.

@Piyush3079

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2018

For me too it is working properly. It is giving error, to be specific, a warning which can be ignored, if your database does not have any table.

@Leymooo

This comment has been minimized.

Copy link
Author

commented Apr 23, 2018

Hi! In pma 4.7.9 designer works good, in 4.8.0 and 4.8.0.1 it doesn't work.
There is a video. https://youtu.be/e5O9AXKRxwY

@Leymooo

This comment has been minimized.

Copy link
Author

commented Apr 28, 2018

Hm.. When i login from root and open a designer it works, but when i login from user account designer does not work.

@daehyunNam

This comment has been minimized.

Copy link

commented May 2, 2018

I have the same problem. Is there a solution?

@cloakedch

This comment has been minimized.

Copy link

commented May 16, 2018

Confirming same behaviour. Running PMA in a docker container. PMA 4.8.0.1

@edgarasg

This comment has been minimized.

Copy link

commented May 24, 2018

Same error, running alt-php72 in CloudLinux LVE container, MariaDB 10.2.15 and PMA 4.8.0.1.

@msimon23

This comment has been minimized.

Copy link

commented May 29, 2018

PMA newbie here. Thought I'd share my experience with the same issue to help anyone who might have it for the same reason. Like everyone else who already posted, I was getting the 500 error whenever I clicked on designer. My issue happened to be because my configuration storage wasn't enabled. After I enabled it, I was able to use designer and other configuration tools that weren't working for me.

I fixed it by clicking on the configuration storage error and enabling it. In case you don't see the specific error I had to do a simple click enable, here is an article that shows a different way to enable it.
https://www.techrepublic.com/article/how-to-enable-phpmyadmin-configuration-storage-to-gain-more-options-and-security/

This was done using
Windows 10
Apache 2
MySql 5.7
PHP 7.1.17
phpMyAdmin 4.8.0.1

@daehyunNam

This comment has been minimized.

Copy link

commented May 30, 2018

thank you. There was a problem with phpMyAdmin configuration storage.

https://github.com/skurudo/phpmyadmin-fixer

@edgarasg

This comment has been minimized.

Copy link

commented May 30, 2018

It's not a fix, just a workaround. We need a proper fix for this.

@Leymooo

This comment has been minimized.

Copy link
Author

commented May 30, 2018

I want to remind you that in version 4.7.9 everything is fine, and in 4.8.0 it was broken.
Also after give a acces to 'phpmyadmin' database, designer works good in 4.8.0.1

@ibennetch ibennetch added the has-pr label May 30, 2018

@rodentooth

This comment has been minimized.

Copy link

commented Jun 15, 2018

Any news to this? I'd really like to start designing my db 😄

@troglodyne

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2018

I can confirm this issue. What is missing in the steps to replicate is that you need to have not used designer before (which sets the table positions).

This is because the problem occurs whenever getTablePositions returns null on line 133 of db_designer.php:
$tab_pos = $designerCommon->getTablePositions($display_page);
It later passes $tab_pos to $databaseDesigner->getHtmlTableList on line 191. This bombs out due to it not being an array (which is specified in the function's signature).

The solution is simple, just add the following line after 133:
if( empty($tab_pos) ) $tab_pos = [];, though you can also safely change the return value of getTablePositions in libraries/classes/Database/Designer/Common.php to simply always return array, as the only caller is in db_designer.php

edgarasg's fix to the issue was close to spotting the root cause, but unfortunately only appeared to mask the source of the problem (we had no 'starting' position for the tables, so it couldn't give us the array with positions).

I can submit a PR which alters getTablePositions to properly fix this if that sounds like the direction the maintainer(s) would like to go on the issue.

@sebastianbochan

This comment has been minimized.

Copy link

commented Sep 18, 2018

@troglodyne
Works like a charm. Big thanks!

@edgarasg

This comment has been minimized.

Copy link

commented Sep 19, 2018

Why it's taking so long to fix this? Just make PR and merge it :)

@troglodyne

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2018

Is this even reproducible on the newer 4.8.3 release? When I went back in to look at it, it seems that the function this died on is no longer requiring the argument to always be an array -- see line 321:
?array $tabPos,
IIRC, this means that it can also be null, which is what the problem described in this issue was.

Furthermore, the code I knew it to be dying on used to be over in db_designer.php, which appears to no longer be the case (code got moved into a class, looks like). A refactor may have already solved this problem?

I haven't yet tested 4.8.3 myself yet, so I can't say for sure, but it at least looks fixed to me.

@Leymooo

This comment has been minimized.

Copy link
Author

commented Sep 19, 2018

[Wed Sep 19 21:07:43.661323 2018] [php7:error] [pid 28482] [client 93.185.244.122:65403] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PhpMyAdmin\\Database\\Designer::getHtmlTableList() must be of the type array, null given, called in /usr/share/phpmyadmin/db_designer.php on line 190 and defined in /usr/share/phpmyadmin/libraries/classes/Database/Designer.php:290\nStack trace:\n#0 /usr/share/phpmyadmin/db_designer.php(190): PhpMyAdmin\\Database\\Designer->getHtmlTableList(NULL, NULL)\n#1 {main}\n  thrown in /usr/share/phpmyadmin/libraries/classes/Database/Designer.php on line 290

image

@troglodyne

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2018

Hmm.... well, getHtmlTableList definitely doesn't exist as a function in master anymore, and hasn't since commit 0d26cfb. That's quite a bit before the RELEASE_4_8_2 tag in the git log, so normally that would indicate that it is in release 4.8.2+. The error message you are showing makes me think that the releases are curated somewhat differently, however (I'm not really aware of that process).

Simply having the refactor in the aforementioned commit (it looks like a multi-part refactor) in the next release should fix it however, so I'm not sure that just making a PR is the "right" way to fix this.

@Leymooo

This comment has been minimized.

Copy link
Author

commented Sep 20, 2018

Yes. In master this bug fixed.
image

@williamdes

This comment has been minimized.

Copy link
Member

commented Oct 12, 2018

[Designer] Javascript error when table_coords or pdf_pages is missing

Describe the bug

Throws an error :A fatal JavaScript error has occurred. Would you like to send an error report?

To Reproduce

Steps to reproduce the behavior:

  1. Create the phpmyadmin database using chk_rel.php
  2. Move table_coords to table_coords1 and pdf_pages to pdf_pages1
  3. Log out
  4. Log in
  5. Go to designer on database phpmyadmin

Expected behavior

Show tables.

Screenshots

Error

Server configuration

  • phpMyAdmin version: 4.8.3

Logs

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PhpMyAdmin\\Database\\Designer::getHtmlTableList() must be of the type array, null given, called in /usr/share/phpmyadmin/db_designer.php on line 190 and defined in /usr/share/phpmyadmin/libraries/classes/Database/Designer.php:290\nStack trace:\n#0 /usr/share/phpmyadmin/db_designer.php(190): PhpMyAdmin\\Database\\Designer->getHtmlTableList(NULL, NULL)\n#1 {main}\n  thrown in /usr/share/phpmyadmin/libraries/classes/Database/Designer.php on line 290

Code

$tab_pos = $designerCommon->getTablePositions($display_page);

public function getTablePositions($pg)
{
$cfgRelation = $this->relation->getRelationsParam();
if (! $cfgRelation['pdfwork']) {
return null;

public function getHtmlTableList(array $tab_pos, $display_page)

@williamdes williamdes self-assigned this Oct 12, 2018

@williamdes williamdes added the bug label Oct 12, 2018

@williamdes williamdes added this to the 4.8.4 milestone Oct 12, 2018

@williamdes williamdes added this to To Do in Designer Oct 12, 2018

@williamdes

This comment has been minimized.

Copy link
Member

commented Oct 12, 2018

@Leymooo Can you try my pull request ?

@Leymooo

This comment has been minimized.

Copy link
Author

commented Oct 12, 2018

Maybe this is was my bad, that i dont close a issue. As i wrote before it was already fixed in master when i test it on 20.09. Also with this PR designer is OK and works good.

@williamdes

This comment has been minimized.

Copy link
Member

commented Oct 12, 2018

@Leymooo This issue still exists on 4.8.x
Do not close it. Thank you for testing the PR.

mauriciofauth added a commit that referenced this issue Oct 31, 2018

mauriciofauth added a commit that referenced this issue Oct 31, 2018

Add ChangeLog entry for #14223
[CI skip]

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>

@williamdes williamdes changed the title Designer does not work TypeError (return null) in database designer Nov 27, 2018

@williamdes williamdes moved this from To Do to Done in Designer Nov 27, 2018

ibennetch added a commit that referenced this issue Dec 11, 2018

Fixes #14223 - designer error
See: #14223 (comment)
Signed-off-by: William Desportes <williamdes@wdes.fr>

ibennetch added a commit that referenced this issue Dec 11, 2018

Add ChangeLog entry for #14223
[CI skip]

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
@dogukanarkan

This comment has been minimized.

Copy link

commented Mar 27, 2019

@troglodyne thank you so much. That works for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.