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

PhpMyAdmin\Url::getFromRoute() must be of the type string, null given #16713

Closed
svaningelgem opened this issue Mar 4, 2021 · 13 comments · Fixed by #16714
Closed

PhpMyAdmin\Url::getFromRoute() must be of the type string, null given #16713

svaningelgem opened this issue Mar 4, 2021 · 13 comments · Fixed by #16714
Assignees
Labels
Bug A problem or regression with an existing feature
Projects
Milestone

Comments

@svaningelgem
Copy link

Describe the bug

I received this error:

PhpMyAdmin\Url::getFromRoute() must be of the type string, null given

To Reproduce

Steps to reproduce the behavior:

  1. Install 5.1.0 zip file on the server
  2. setup config file with cookie login
  3. Login
  4. Get the error immediately.

Expected behavior

Getting the normal screen

Server configuration

  • Operating system: Debian GNU/Linux 10 (buster)
  • Web server: Apache/2.4.38
  • Database version: 5.7.33
  • PHP version: PHP 7.3.27-1~deb10u1
  • phpMyAdmin version: 5.1.0

Client configuration

  • Browser: Firefox
  • Operating system: Win10

Additional context

Temporary fix:
Remove "string" from the PhpMyAdmin\Url::getFromRoute() method:

public static function getFromRoute($route, array $additionalParameters = []): string

Stacktrace:

Mar  4 09:10:39 calculation-server php: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Url::getFromRoute() must be of the type string, null given, called in [...]/tmp/twig/58/58c5c0c1b5dbd6c9ffbe3eb3ff4d045c3ea6ed770ea4c6d8adb0e964e263f7c8.php on line 47 and defined in [...]/libraries/classes/Url.php:289
Mar  4 09:10:39 calculation-server php: Stack trace:
Mar  4 09:10:39 calculation-server php: #0 [...]/tmp/twig/58/58c5c0c1b5dbd6c9ffbe3eb3ff4d045c3ea6ed770ea4c6d8adb0e964e263f7c8.php(47): PhpMyAdmin\Url::getFromRoute(NULL)
Mar  4 09:10:39 calculation-server php: #1 [...]/vendor/twig/twig/src/Template.php(405): __TwigTemplate_bca7df91540ab1052aa77dd2ecc2c43f39b06b4429ce97a0060d6039695a4d49->doDisplay(Array, Array)
Mar  4 09:10:39 calculation-server php: #2 [...]/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)
Mar  4 09:10:39 calculation-server php: #3 [...]/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)
Mar  4 09:10:39 calculation-server php: #4 [...]/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)
Mar  4 09:10:39 calculation-server php: #5 [...]/libraries/classes/Template.php(129): Twig\TemplateWrapper->render(Array)
Mar  4 09:10:39 calculation-server php: #6 [...]/libraries/classes/Menu.php(247): PhpMyAdmin\Template->render('menu/breadcrumb...', Array)
Mar  4 09:10:39 calculation-server php: #7 [...]/libraries/classes/Menu.php(72): PhpMyAdmin\Menu->getBreadcrumbs()
Mar  4 09:10:39 calculation-server php: #8 [...]/libraries/classes/Header.php(444): PhpMyAdmin\Menu->getDisplay()
Mar  4 09:10:39 calculation-server php: #9 [...]/libraries/classes/Response.php(331): PhpMyAdmin\Header->getDisplay()
Mar  4 09:10:39 calculation-server php: #10 [...]/libraries/classes/Response.php(345): PhpMyAdmin\Response->getDisplay()
Mar  4 09:10:39 calculation-server php: #11 [...]/libraries/classes/Response.php(507): PhpMyAdmin\Response->htmlResponse()
Mar  4 09:10:39 calculation-server php: #12 [internal function]: PhpMyAdmin\Response->response()
Mar  4 09:10:39 calculation-server php: #13 {main}
Mar  4 09:10:39 calculation-server php:   thrown in [...]/libraries/classes/Url.php on line 289
@williamdes
Copy link
Member

Hi @svaningelgem
I am curious to know what config you have, could you send your config.inc.php file please (you may remove sensitive data) ?

@williamdes williamdes added this to the 5.1.1 milestone Mar 4, 2021
@williamdes
Copy link
Member

$cfg['ActionLinksMode']                        = 'icons';
$cfg['DefaultCharset']                         = 'utf-8';
$cfg['DefaultConnectionCollation']             = 'utf8_unicode_ci';
$cfg['DefaultLang']                            = 'en_GB';
$cfg['DefaultTabDatabase']                     = 'db_structure.php';
$cfg['DefaultTabServer']                       = 'server_status.php';
$cfg['DefaultTabTable']                        = 'tbl_select.php';
$cfg['ExecTimeLimit']                          = 0;
$cfg['ForceSSL']                               = false;
$cfg['HideStructureActions']                   = false;
$cfg['InitialSlidersState']                    = 'disabled';
$cfg['Lang']                                   = 'en_GB';
$cfg['LeftDisplayLogo']                        = false;
$cfg['LeftDisplayServers']                     = false;
$cfg['MaxNavigationItems']                     = PHP_INT_MAX;
$cfg['MaxRows']                                = 250;
$cfg['MaxTableList']                           = PHP_INT_MAX;
$cfg['MemoryLimit']                            = '0';
$cfg['NavigationDisplayLogo']                  = false;
$cfg['NavigationDisplayServers']               = false;
$cfg['NavigationTreeDisplayDbFilterMinimum']   = PHP_INT_MAX;
$cfg['NavigationTreeDisplayItemFilterMinimum'] = PHP_INT_MAX;
$cfg['Order']                                  = 'SMART';
$cfg['PmaNoRelation_DisableWarning']           = true;
$cfg['PropertiesIconic']                       = true;
$cfg['QueryHistoryDB']                         = true;
$cfg['QueryHistoryMax']                        = 100;
$cfg['RetainQueryBox']                         = true;
$cfg['RowActionType']                          = 'icons';
$cfg['SaveDir']                                = '';
$cfg['ServerDefault']                          = 1;
$cfg['ServerLibraryDifference_DisableWarning'] = true;
$cfg['ShowPhpInfo']                            = false;
$cfg['ShowServerInfo']                         = false;
$cfg['ShowStats']                              = true;
$cfg['SkipLockedTables']                       = true;
$cfg['SuhosinDisableWarning']                  = true;
$cfg['TableNavigationLinksMode']               = 'icons';
$cfg['TabsMode']                               = 'both';
$cfg['ThemeDefault']                           = 'original';
$cfg['UploadDir']                              = '';
$cfg['UseDbSearch']                            = false;
$cfg['SendErrorReports']                       = 'never';
$cfg['NavigationTreeEnableGrouping']           = false;

$cfg['Export']['format']                       = 'csv';
$cfg['Export']['compression']                  = 'zip';
$cfg['Export']['charset']                      = 'utf-8';
$cfg['Export']['sql_drop_database']            = true;
$cfg['Export']['sql_drop_table']               = true;
$cfg['Export']['csv_separator']                = ';';
$cfg['Export']['csv_columns']                  = true;
$cfg['Export']['excel_columns']                = true;

$cfg['Import']['csv_terminated']               = ';';

This seems linked to #16714

@IceNV
Copy link

IceNV commented Mar 5, 2021

Hi,

Same problem here , Debian 10 x64, PHP 7.3 FPM + Nginx, PhpMyAdmin version 5.1.0

As soon as I'm successfully logged into phpMyAdmin I get the same error :

PHP with Display Errors on :

Fatal error: Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Url::getFromRoute() must be of the type string, null given, called in /home/phpmyadmin/vendor/twig/twig/src/Environment.php(418) : eval()'d code on line 47 and defined in /home/phpmyadmin/libraries/classes/Url.php on line 289

TypeError: Argument 1 passed to PhpMyAdmin\Url::getFromRoute() must be of the type string, null given, called in /home/phpmyadmin/vendor/twig/twig/src/Environment.php(418) : eval()'d code on line 47 in /home/phpmyadmin/libraries/classes/Url.php on line 289

Call Stack:
    0.7027    4395592   1. PhpMyAdmin\Response->response() /home/phpmyadmin/libraries/classes/Response.php:0
    0.7027    4395592   2. PhpMyAdmin\Response->htmlResponse() /home/phpmyadmin/libraries/classes/Response.php:507
    0.7027    4395592   3. PhpMyAdmin\Response->getDisplay() /home/phpmyadmin/libraries/classes/Response.php:345
    0.7027    4395592   4. PhpMyAdmin\Header->getDisplay() /home/phpmyadmin/libraries/classes/Response.php:331
    1.3704    4895344   5. PhpMyAdmin\Menu->getDisplay() /home/phpmyadmin/libraries/classes/Header.php:444
    1.3704    4895344   6. PhpMyAdmin\Menu->getBreadcrumbs() /home/phpmyadmin/libraries/classes/Menu.php:72
    1.3704    4896096   7. PhpMyAdmin\Template->render('menu/breadcrumbs', array ('server' => array ('name' => 'localhost', 'url' => NULL), 'database' => array (), 'table' => array ())) /home/phpmyadmin/libraries/classes/Menu.php:247
    1.4495    5018080   8. Twig\TemplateWrapper->render(array ('server' => array ('name' => 'localhost', 'url' => NULL), 'database' => array (), 'table' => array ())) /home/phpmyadmin/libraries/classes/Template.php:129
    1.4495    5018080   9. __TwigTemplate_bca7df91540ab1052aa77dd2ecc2c43f39b06b4429ce97a0060d6039695a4d49->render(array ('server' => array ('name' => 'localhost', 'url' => NULL), 'database' => array (), 'table' => array ()), array ()) /home/phpmyadmin/vendor/twig/twig/src/TemplateWrapper.php:45

PHP_FPM worker error log :

[05-Mar-2021 12:22:44] WARNING: [pool www] child 58404 said into stderr: "#6 /home/phpmyad..."
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: Argument 1 passed to PhpMyAdmin\Url::getFromRoute() must be of the type string, null given, called in /home/phpmyadmin/vendor/twig/twig/src/Environment.php(418) : eval()'d code on line 47 and defined in /home/phpmyadmin/libraries/classes/Url.php:289"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "Stack trace:"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#0 /home/phpmyadmin/vendor/twig/twig/src/Environment.php(418) : eval()'d code(47): PhpMyAdmin\Url::getFromRoute(NULL)"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#1 /home/phpmyadmin/vendor/twig/twig/src/Template.php(405): __TwigTemplate_bca7df91540ab1052aa77dd2ecc2c43f39b06b4429ce97a0060d6039695a4d49->doDisplay(Array, Array)"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#2 /home/phpmyadmin/vendor/twig/twig/src/Template.php(378): Twig\Template->displayWithErrorHandling(Array, Array)"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#3 /home/phpmyadmin/vendor/twig/twig/src/Template.php(390): Twig\Template->display(Array)"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#4 /home/phpmyadmin/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array)"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#5 /home/phpmyadmin/libraries/classes/Template.php(129): Twig\TemplateWrapper->render(Array)"
[05-Mar-2021 12:22:52] WARNING: [pool www] child 58406 said into stderr: "#6 /home/phpmyad..."

config.inc.php for reference, which wasn't edited since a good while ago, is attached (pretty long file) :
config.inc.php.txt

@williamdes
Copy link
Member

Thank you @svaningelgem

// blowfish isn't used anyway

It is ;)

@svaningelgem
Copy link
Author

svaningelgem commented Mar 5, 2021

@williamdes : that's actually in @IceNV 's config, not mine. ;-)

@IceNV
Copy link

IceNV commented Mar 5, 2021

// blowfish isn't used anyway

I meant, not in my own configuration, since I use HTTP auth ? or is it even in that case ? (It's a bit off-topic, but I'm curious to know)

@williamdes
Copy link
Member

@williamdes : that's actually in @IceNV 's config, not mine. ;-)

Oh sorry :/

meant, not in my own configuration, since I use HTTP auth

it is used to generated hmac signatures for SQL links to work and be secure when you click on a foreign key link (open in new tab). And in more places I forgot about

@IceNV @svaningelgem could you please apply https://github.com/phpmyadmin/phpmyadmin/pull/16714/files and let me know if this fixes the issue please ?

@svaningelgem
Copy link
Author

This seems to fix it.
So I can deduce that because we're not using rewriting, it failed?

@williamdes
Copy link
Member

This seems to fix it.
So I can deduce that because we're not using rewriting, it failed?

No, no :)
In fact we now have a routing system and the values for this config changed. And that broke older configs that used old values that where the previous file names

@svaningelgem
Copy link
Author

No, no :)
In fact we now have a routing system and the values for this config changed. And that broke older configs that used old values that where the previous file names

To me it seems more sensible to push out a warning that people know to update their configuration files? Otherwise you'll keep on accumulating technical debt.
Like for example add a deprecation warning for let's say 6.0, and at that time you could remove it?

Just my 2ct :)

@IceNV
Copy link

IceNV commented Mar 5, 2021

Thanks for the info regarding blowfish :)

It doesn't fix it for me, I still have the same issue after replacing Util.php with the new version. Anywhere I could put a trace to see where this comes from (where it got its NULL from) ? As it's from an eval() done by twig, the PHP stack trace isn't that useful.

williamdes added a commit to csware/phpmyadmin that referenced this issue Mar 5, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit to csware/phpmyadmin that referenced this issue Mar 5, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit to csware/phpmyadmin that referenced this issue Mar 5, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
@IceNV
Copy link

IceNV commented Mar 5, 2021

The second commit (replacing Menu.php too) made it work for me. Thanks for the fix !

williamdes added a commit to csware/phpmyadmin that referenced this issue Mar 5, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

To me it seems more sensible to push out a warning that people know to update their configuration files? Otherwise you'll keep on accumulating technical debt.
Like for example add a deprecation warning for let's say 6.0, and at that time you could remove it?
Just my 2ct :)

This is true !
Seem like we should refactor our configuration handling and use some kind of validator to emit deprecation warnings

@williamdes williamdes self-assigned this Mar 5, 2021
@williamdes williamdes added the Bug A problem or regression with an existing feature label Mar 5, 2021
@williamdes williamdes added this to Needs triage in issues via automation Mar 5, 2021
@williamdes williamdes moved this from Needs triage to High priority in issues Mar 5, 2021
@williamdes williamdes pinned this issue Mar 5, 2021
williamdes added a commit that referenced this issue Mar 5, 2021
…ltTabDatabase, DefaultTabTable, NavigationTreeDefaultTabTable and NavigationTreeDefaultTabTable2

Fixes: #16698
Fixes: #16713

Pull-request: #16714

Signed-off-by: William Desportes <williamdes@wdes.fr>
williamdes added a commit that referenced this issue Mar 5, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from High priority to Closed Mar 5, 2021
@williamdes williamdes unpinned this issue Jul 13, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature
Projects
issues
  
Closed
3 participants