Export & Import does not work for the first DB

Issue #195 resolved
Christopher Kramer created an issue

Originally reported on Google Code with ID 195

This bug has been sent to me by Lonnie (via mail because Lonnie does not have a google
account). Thanks, Lonnie!

What steps will reproduce the problem?
1. Open the first DB in the list
2. Click "Export"
3. "Export" (e.g. as SQL)

What is the expected output? What do you see instead?
Expected: DB Dump
Actual output (in the export-file):
<div class='confirm' style='margin:20px;'>The database, '', does not exist and cannot
be created because the containing directory, '', is not writable. The application is
unusable until you make it writable.<form action='phpliteadmin.php' method='post'><input
type='submit' value='Log Out' name='Logout' class='btn'/></form></div><br/>

Lonnie also found the problem ("After much hair-pulling") and sent a solution:
The problem is that isManagedDB can return a key value of 0, so an exact match of ===
false is needed.

His patch:
--
@@ -1864,7 +1864,7 @@
        sort($databases);
    }
    // we now have the $databases array set. Check whethet currentDB is a managed Db
(is in this array)
-   if(isset($_SESSION[COOKIENAME.'currentDB']) && !isManagedDB($_SESSION[COOKIENAME.'currentDB']['path']))
+   if(isset($_SESSION[COOKIENAME.'currentDB']) && isManagedDB($_SESSION[COOKIENAME.'currentDB']['path'])===false)
        unset($_SESSION[COOKIENAME.'currentDB']);

    //user is deleting a database
--

I can reproduce the problem and confirm that the problem found is correct and the patch
is good.

This bug has been introduced in 1.9.4 with r350 while fixing issue #188.

As this breaks a feature that is quite important, I am considering a regression update.
Especially because we plan major changes for 1.9.5 and therefore the work on 1.9.5
might take some time.
But maybe let's wait a couple of days to see if more bugs come up.

Reported by crazy4chrissi on 2013-03-19 21:30:50

Comments (4)

  1. Christopher Kramer reporter
    I just applied this patch to what is currently in svn as 1.9.5.
    I consider releasing this as 1.9.4.1 as a regression update.  
    

    Reported by crazy4chrissi on 2013-03-19 21:37:00 - Status changed: Started

  2. Christopher Kramer reporter
    btw: as this bug only affects the first db in the list, you can create a new empty db
    in front of the first db as a quick workaround.
    

    Reported by crazy4chrissi on 2013-03-19 22:03:38

  3. Christopher Kramer reporter

    Reported by crazy4chrissi on 2013-03-20 19:26:46 - Labels added: Target-1.9.4.1

  4. Christopher Kramer reporter
    This is fixed in what is in svn under "1.9.4.1" and "1.9.5".
    

    Reported by crazy4chrissi on 2013-03-22 17:12:09 - Status changed: Fixed

  5. Log in to comment