Hello,
   (Using both 4.0.4pl1 and latest CVS as of today.)  I have been having
similar problems with defining my own session handling routings and
register_globals.  If register_globals is off, a new session doesn't seem to
call the "write" handler, thus the session never gets stored.  With
register_globals=on, the session gets stored correctly.

   I've done some testing and found out a fix to the problems which ends up
being better than keeping register_globals on.  Here's my code for my "read"
handler (PostgreSQL-based).


------------------
function sess_read($sid) {
        global $SESS_DBH;

        $qry = "SELECT value FROM sessions WHERE sid = '$sid'";
        $qid = pg_exec($SESS_DBH, $qry);

        if (pg_numrows($qid) > 0) {
                list($value) = pg_fetch_row($qid, 0);
                return $value;
        }

        return "";
}
-------------------

   Originally (last line in function above)[EMAIL PROTECTED], I was
returning a FALSE instead of a blank string.  When I switched over to
returning a blank string (when there wasn't any data in the session
database), my "write" handler gets called correctly.


   I'm not sure if this will fix anybody else's problems, but if you change
your read handler to return a blank string instead of a FALSE condition, it
may start working for you as well!  (If it DOES help you out, please let me
know.)


Jaime Bozza


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to