Cookies from old version cause error in new

Issue #145 resolved
Former user created an issue

Originally reported on Google Code with ID 145

See video: http://www.youtube.com/watch?v=CPXUb554BGQ


Cookies aren't set correctly if never did a POST database_switch or a GET switchdb

Reported by Paroxsitic on 2012-11-16 20:50:03

Comments (6)

  1. Former user Account Deleted
    Error seems to be caused by 1.9.2 having:
    
    if(!isset($_SESSION[COOKIENAME.'currentDB']))
        $_SESSION[COOKIENAME.'currentDB'] = 0;
    
    Therefore, 1.9.4 should have:
    
    if(isset($_SESSION[COOKIENAME.'currentDB'])) && is_object($_SESSION[COOKIENAME.'currentDB']))
        $currentDB = $_SESSION[COOKIENAME.'currentDB'];
    
    or at least 
    
    if(isset($_SESSION[COOKIENAME.'currentDB'])) && $_SESSION[COOKIENAME.'currentDB'] !=
    0)
        $currentDB = $_SESSION[COOKIENAME.'currentDB'];
    

    Reported by Paroxsitic on 2012-11-16 20:52:53

  2. Christopher Kramer
    Okay. Yeah, you should logout before updating a software, right? I mean, other software
    says you should restart your computer, so it's not much asked for to logout before
    you update ;-)
    But anyway, it is worth to check whether the session-data is valid, so I'll fix this
    anyway. But then I'd say we shouldn't only check whether it's an object, we should
    check whether it's a valid database-object.
    
    Maybe we should add our version number to COOKIENAME so users updating without logging
    out do not run into issues like this in the future.
    

    Reported by crazy4chrissi on 2012-11-16 21:16:11 - Status changed: Accepted - Labels added: Priority-Low - Labels removed: Priority-Medium

  3. Christopher Kramer
    This issue was closed by revision r290.
    

    Reported by crazy4chrissi on 2012-11-16 21:30:11 - Status changed: Fixed

  4. Christopher Kramer
    Okay. fixed it.
    - added version number to COOKIENAME
    - check whether $_SESSION[COOKIENAME.'currentDB'] is a valid DB
    
    Note: There is no problem with real cookies being set wrong. This is session data.
    Session data is stored on the server (not in a cookie), only the session-id is stored
    in a cookie. And session-data is only kept for a short amount of time, especially deleted
    if you logout or wait for about an hour (depending on server settings).
    

    Reported by crazy4chrissi on 2012-11-16 21:33:00

  5. Christopher Kramer
    P.S: If you want to try this, you can get the latest version from svn here:
    
    http://phpliteadmin.googlecode.com/svn/source/1.9.4/phpliteadmin.php
    
    I guess this fix does not really help anybody, but well.
    

    Reported by crazy4chrissi on 2012-11-16 21:34:52

  6. Log in to comment