#4440 (ok 4.2.6) Javascript error when renaming table


Go to a table, then to the Operations tab.
Type a new name in the "Rename table to" box and click Go.
A Javascript error appears (the table is renamed fine, however).
There was also an error sending the error report, so here's the details:

"exception": {
    "mode": "onerror",
    "message": "Uncaught TypeError: Cannot read property 'substring' of undefined",
    "stack": [
            "line": 151,
            "func": "refreshMain",
            "context": [
                "     * @return void",
                "     */",
                "    refreshMain: function (url, callback) {",
                "        if (! url) {",
                "            url = $('#selflink a').attr('href');",
                "            url = url.substring(0, url.indexOf('?'));",
                "        }",
                "        url += PMA_commonParams.getUrlQuery();",
                "        $('', {href: url})",
                "            .appendTo('body')",
                "            .click()"
            "filename": "common.js"
    "useragent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36",
    "name": "TypeError",
    "uri": "tbl_operations.php?target="
"script_name": "tbl_operations.php",
"pma_version": "4.2.2",
"browser_name": "CHROME",
"browser_version": "35.0.1916.114",
"user_os": "Mac",
"server_software": "Apache/2.2.26 (Unix) DAV/2 PHP/5.4.24 mod_ssl/2.2.26 OpenSSL/0.9.8y",
"user_agent_string": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.114 Safari/537.36",
"locale": "en",
"configuration_storage": "enabled",
"php_version": "5.4.24",

I'm using PMA from Github (STABLE branch).


  • I am unable to reproduce this bug with version 4.2.2. Are you getting this error every time you try to rename a table?

    • status: open --> pending
  • Strange, I am not getting a Javascript error now. Maybe there was something else that was causing the issue.

    • status: pending --> works-for-me
  • Looking at the exception it looks like the 'selflink' that appears at the bottom of each page was missing in the rename page (probably due to some other error). Exception when renaming is the side effect.

    Anyway, thanks for reporting this. Closing for now.

  • OK I checked into this further and have found the issue.

    It's the "open new phpmyadmin window" link as you said. The link disappears under these circumstances:
    1. Browse a table.
    2. Click "Edit" under the query box to open the query pop-up window.
    3. Click SQL history tab.
    4. Click any query link.

    What happens is a new tab is opened, rather than running the query in the tab from which the pop-up window was opened. That new tab for some reason doesn't have that 'selflink'.

    Incidentally, I commented about this before: https://sourceforge.net/p/phpmyadmin/bugs/4229/#7aca

    So I suppose the bug is that the link is missing when a new PMA window is opened. However, the JavaScript ought to be coded to avoid this too - if $('#selflink a').attr('href') is null, don't try to run substring on it!

  • Another instance this situation occurs: click "Import" and then import anything into a table. The selflink disappears again.

    Why exactly was this closed? It's still a bug. Even if this is a side-effect of another bug, I don't see a separate ticket for that bug (the selflink disappearing).

    Last edit: DisgruntledGoat 2014-06-14
    • status: works-for-me --> open
    • summary: Javascript error when renaming table --> (ok 4.2.6) Javascript error when renaming table
    • status: open --> resolved
    • assigned_to: Atul Pratap Singh
    • Priority: 5 --> 1
  • Marc Delisle
    Marc Delisle

    • Status: resolved --> fixed