Bug #18158: sybase session storage causing data corruption
| From: | g dot hort at unsw dot edu dot au | Date: | Thu, 04 Jul 2002 08:35:29 +0000 |
| Subject: | Bug #18158: sybase session storage causing data corruption | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13090@lists.php.net to get a copy of this message | ||
From: g.hort@unsw.edu.au
Operating system: Solaris 8
PHP version: 4.2.1
PHP Bug Type: Session related
Bug description: sybase session storage causing data corruption
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 bug report at http://bugs.php.net/?id=18158&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18158&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18158&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18158&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18158&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18158&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18158&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18158&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18158&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18158&r=globals