Menu

#4781 (ok 4.4.1) "Requery" bookmark from console does not work

4.3.10
fixed
None
Normal
2015-04-07
2015-02-26
No

When trying to requery a bookmark from console, I get the following error:

PHP Fatal error: Call to a member function getTables() on a non-object in /…/phpMyAdmin-4.3.10-english/libraries/relation.lib.php on line 1889

phpMyAdmin shows a "Error in Processing Request" then (500).

Steps to reproduce the issue:

  • have a bookmark in phpMyAdmin
  • open "Console" at the bottom
  • open "Bookmarks"
  • select "Requery" on a bookmark - a JavaScript confirmation message is shown
  • accept - see the error message

Discussion

  • Smita Kumari

    Smita Kumari - 2015-02-27

    Hey

    I am not able to reproduce it. Is it happening for all the bookmarks queries you have ? or is it specific to some particular query ?

    Thanks.

     
    • Alexander Schuch

      It happens for all (5) bookmarks - 1 shared, 4 private.

      Navigating to the database, using the "SQL" tab and then issuing the bookmarks there by the way works.

       
  • tapanhalani

    tapanhalani - 2015-03-02

    Well,

    I am also not able to reproduce it in any way. What error message is generating?

     
    • Alexander Schuch

      I just updated to phpMyAdmin 4.3.11 and I still have the problem.

      The reproduction steps still are the same as mentioned initially. The error I see in phpMyAdmin is:

      Error in Processing Request
      Error code: 500
      Error text: Internal Server Error

      The error I see on the webserver is:

      PHP Fatal error: Call to a member function getTables() on a non-object in /…/phpMyAdmin-4.3.11-english/libraries/relation.lib.php on line 1889

       
  • Alexander Schuch

    Refreshing bookmarks does not work either:

    Console → Bookmarks → Refresh

    I get in phpMyAdmin:

    Error in Processing Request
    Error code: 500
    Error text: Internal Server Error

    And on the server I see:

    PHP Fatal error: Call to a member function isSuperuser() on a non-object in /…/phpMyAdmin-4.3.11-english/libraries/check_user_privileges.lib.php on line 15

     
  • Alexander Schuch

    Maybe this issue is related to [#4700] and my configuration using "$cfg['ServerDefault'] = 0;"?

     

    Related

    Bugs: #4700

  • Dharani Manne

    Dharani Manne - 2015-03-08

    I am not able to recreate the bug. Can you please post the error?

     
    • Alexander Schuch

      Can you please elaborate? What additional error message do you expect? Where can I get that possibly expected error message from?

      I posted the error message I get in phpMyAdmin and the one I see on the server. Which one am I missing?

       
      • Marc Delisle

        Marc Delisle - 2015-03-08

        Alexander,
        you correctly reported the error message.

         
  • Alexander Schuch

    I tried on the demo server, but I am not able to reproduce the issue there. I noticed that one uses PHP 5.4, while I still use 5.3.

    I did a quick check on my server using the code below:

    $s = var_export(array_key_exists('dbi', $GLOBALS), TRUE) . "\n" . var_export($GLOBALS['dbi'], TRUE);
    file_put_contents('/tmp/pmadbg', $s);
    unset($s);

    The result is "false" and "NULL" - more or less expected. I haven't dug any further, but with some help of where the "interesting" parts are, I can do some debugging on my own.

    Okay, I dug a bit deeper. Line numbers might be off slightly due to some printf debugging.

    libraries/common.inc.php:822:
    empty($cfg['Server']) is TRUE, so $GLOBALS['dbi'] doesn't get set.

    libraries/common.inc.php:1148:
    $GLOBALS['is_superuser']
    = isset($GLOBALS['dbi']) && $GLOBALS['dbi']->isSuperuser();

    Some code seems to exist to handle this situation. But no idea what this one is good for. I just do not know the architecture at all.

    By the way, I followed the execution path of "Bookmarks → Refresh".

     
    • Alexander Schuch

      At libraries/common.inc.php:674, $cfg['Servers'] still contains the configured array. And still at line 800.

      Okay, there is a difference between $cfg['Servers'] and $cfg['Server'].

      Around line 780:

      if (isset($_REQUEST['server'])
          && (is_string($_REQUEST['server']) || is_numeric($_REQUEST['server']))
          && ! empty($_REQUEST['server'])
          && ! empty($cfg['Servers'][$_REQUEST['server']])
      ) {
      

      The request has no "server" set:

      https://…/import.php?console_bookmark_refresh=refresh&token=…&ajax_request=true&_nocache=…

      if (!empty($cfg['Servers'][$cfg['ServerDefault']])) {

      "ServerDefault" is 0, so this item does not exist. This ends up with an empty $cfg['Server'].

      So maybe the request from JavaScript should include a "server"?

      Though, I have no idea why it works without "server" on the demo server but not for me. There is a difference somewhere …

       

      Last edit: Alexander Schuch 2015-03-08
  • Madhura Jayaratne

    • assigned_to: Madhura Jayaratne
     
  • Madhura Jayaratne

    Alexander,
    You have identified the cause of the problem correctly. However, the issue has beeb fixed on QA_4_4 and master branches. So the if you tried out demo.phpmyadmin.net/QA_4_4 or demo.phpmyadmin.net/master it's no wonder you were not able to reproduce it. Moreover, you need to be on a server which is not the default server, unless default server is 0, like in your case.

     
  • Madhura Jayaratne

    • summary: "Requery" bookmark from console does not work --> (ok 4.4.1) "Requery" bookmark from console does not work
    • status: open --> resolved
     
  • Marc Delisle

    Marc Delisle - 2015-04-07
    • Status: resolved --> fixed
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.