Bug #18158 Updated: sybase session storage causing data corruption
| From: | g dot hort at unsw dot edu dot au | Date: | Fri, 19 Jul 2002 09:38:29 +0000 |
| Subject: | Bug #18158 Updated: sybase session storage causing data corruption | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-14616@lists.php.net to get a copy of this message | ||
ID: 18158
Updated by: g.hort@unsw.edu.au
Reported By: g.hort@unsw.edu.au
-Status: Bogus
+Status: Open
Bug Type: Session related
Operating System: Solaris 8
PHP Version: 4.2.1
New Comment:
I think this is a different problem. This is related to sybase
returning an error like already exists when doing an insert and it
doesn't occur with mysql and has nothing to do with the size of the
session. The corruption occurs in a non-session variable and there
doesn't appear to be anything wrong with the session data itself.
In 18404, as far as I can see, the database doesn't give an error, the
problem occurs with both sybase and mysql and it seems to depend on the
size of the session and the session variable becomes undefined. It
still occurs with the workaround for this bug in place.
However if you still think its the same bug then of course I accept
that.
Previous Comments:
------------------------------------------------------------------------
[2002-07-19 04:57:50] sniper@php.net
In the other report (#18404) you said mysql does NOT work..
please, only ONE report per bug.
------------------------------------------------------------------------
[2002-07-19 04:06:02] g.hort@unsw.edu.au
As workaround I modified the read routine of the session handler to set
a global variable to say whether the session exists. The write routine
tests this var to tell whether to do an insert or an update, no errors
are returned and everything works fine. see
http://sporty.nun.unsw.edu.au/pear_session2.phps.
------------------------------------------------------------------------
[2002-07-04 09:29:24] g.hort@unsw.edu.au
The session handler I'm using is from sourceforge, slightly modified,
see http://www.library.unsw.edu.au/pear_session.phps
------------------------------------------------------------------------
[2002-07-04 04:35:29] g.hort@unsw.edu.au
php for Apache 1.3.26 with mod_ssl
configure --with-apxs=/usr/local/apache/bin/apxs
--with-gettext
--with-xml
--with-zlib
--with-mysql=/usr/local/mysql
--with-sybase-ct=/usr/local/sybase12.5/OCS-12.5
--with-imap=../imap-2001a
I'm using user defined session storage. mysql works fine. Both sybase
and sybase-ct can save a new session but not update it.
The routine that writes session data is:
function pear_session_write($session_id, $data)
{
global $pear_session_db;
$updated = time();
$sql = "INSERT INTO " . PEAR_SESSION_TABLE
. "(session_id, last_updated, data) "
. "VALUES('" . addslashes($session_id) . "', $updated, '"
. addslashes($data) . "')";
user_error("pear_session0: $sql ($session_id)\n");
$rs = $pear_session_db->query($sql);
user_error("pear_session1: $sql ($session_id)\n");
if (DB::isError($rs)) // probably a duplicate error: update existing
value
{
$sql = "UPDATE " . PEAR_SESSION_TABLE
. " SET last_updated = $updated, data = '"
. addslashes($data) . "' WHERE session_id = '"
. addslashes($session_id) . "'";
$rs = $pear_session_db->query($sql);
}
return !(DB::isError($rs));
}
The reason the update doesn't occur is that the variable $session_id
gets corrupted while the failing insert is executed and so the update
fails. The sybase interface seems to work fine in other (non-session)
situations.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18158&edit=1