Menu

#381 Wrong variable name in minified version

4.0.3
closed-works-for-me
nobody
None
5
2017-02-21
2014-02-07
Nick Proto
No

Version 4.0.3 contains a wrong variable name in the compacted version in line 45.
instead of $l it should be $g in the English version and $h in the general.
The error is:
Fatal error: Call to a member function quote() on a non-object in D:...\Adminer\adminer-en.php on line 45
and happens when I click on a table.
When I change it manually it works fine.

Discussion

  • Jakub Vrána

    Jakub Vrána - 2014-02-08
    • status: open --> pending-works-for-me
     
  • Nick Proto

    Nick Proto - 2014-02-08

    I can't locate the problem. I override the functions schemas, databases, database, credentials, loginForm, name, databasesPrint, tableName, tablesPrint, navigation but I don't call quote in any of them.
    I use the variable $driver locally in the function navigation but how can it have side effects with global $driver since I don't declare it as global?
    I see that you have declared global $driver inside function q but then in the minified code in line 45 it is converted to $l instead of $g why?

     
  • Jakub Vrána

    Jakub Vrána - 2014-02-08

    Can you share code of your customization?

     
  • Nick Proto

    Nick Proto - 2014-02-08

    I have sent you a message with my customization

     
  • Jakub Vrána

    Jakub Vrána - 2014-02-19
    • status: pending-works-for-me --> closed-fixed
     
  • Jakub Vrána

    Jakub Vrána - 2014-02-19

    It should be fixed in the GitHub version. Please let me know if it works for you.

     
  • Nick Proto

    Nick Proto - 2014-02-22

    Thanks. I'll let you know.

     
  • Gustaf Mossakowski

    This bug is still there in adminer-4.1.0-mysql-de.php, causing Adminer to abort when trying to show a table.

    Line 47

    q($Ff){global$i;return$i->quote($Ff);}function
    

    should be

    q($Ff){global$e;return$e->quote($Ff);}function
    

    Did not test other languages.

     
  • Jakub Vrána

    Jakub Vrána - 2014-04-21
    • status: closed-fixed --> pending-works-for-me
     
  • Jakub Vrána

    Jakub Vrána - 2014-04-21

    The variable name is correct and it shouldn't cause any issues. Please put debug_print_backtrace(); on that place and send the output. It might be easier to do that with the source codes available at http://www.adminer.org/#download.

     
  • Gustaf Mossakowski

    Looks like it only happens if you use adminer inside a function.

    <?php
    
    function some_function($path) {
        require $path;
    }
    
    some_function('adminer-4.1.0-mysql-de.php');
    ?>
    

    results in

    Fatal error:  Call to a member function quote() on a non-object in /path/adminer-4.1.0-mysql-de.php on line 47
    

    line 47 changed to

    q($Ff){global$i;echo '<pre>'; debug_print_backtrace();return$i->quote($Ff);}function
    

    prints this out:

    #0  q(fdr_bestellungen_publikationen) called at [/path/adminer-4.1.0-mysql-de.php:265]
    #1  table_status(fdr_bestellungen_publikationen, 1) called at [/path/adminer-4.1.0-mysql-de.php:102]
    #2  table_status1(fdr_bestellungen_publikationen, 1) called at [/path/adminer-4.1.0-mysql-de.php:579]
    #3  require(/path/adminer-4.1.0-mysql-de.php) called at [/path/adminer.php:6]
    #4  some_function(adminer-4.1.0-mysql-de.php) called at [/path/adminer.php:9]
    
     
  • Patrick Li

    Patrick Li - 2014-04-29

    I have encountered the same problem since 4.0.

    Indeed it only happens when adminer is required in another file.

    To workaround it you can do

    global $i;
    require 'adminer.php';
    

    But that simply means there is a missing global variable declaration somewhere.

     
  • Jakub Vrána

    Jakub Vrána - 2017-02-21
    • status: pending-works-for-me --> closed-works-for-me
     
  • Jakub Vrána

    Jakub Vrána - 2017-02-21

    I've tried including compiled Adminer from inside a function and it works correctly.

     

Log in to post a comment.