[phplib] Possible BUG? ( key-violation on insert in active_sessions ) From: Massimo Santoli (saint <email protected>)
Date: 04/30/00

Hi,

I've been using the phplib 7.2b for about 2 weeks and I have spotted a
bug.
In the ac_store function ( ct_sql.inc ) where the session data is
updated in the Database,
I have seen that the function first does an update query with the new
session data, then
if the number of updated rows is 0 a new row is inserted.

I've spotted a problem because every know and then my site gave
key-violation
on inserts in the active_sessions table.

The problem is this:
- the update query ( under MySQL ) returns 0 rows updated, because no
session data has changed, even if a session row is present in the DB
table.
The function tries therefore to insert a new row, but there is a row for

that session, and here
comes the key-violation error

I have patched the code by adding a select before the update to check if

a session row is present
in the DB, thus if a row is present I make the update if not I make the
insert.

I hope this helps anybody which had a similar problem.

Regards,
Massimo Santoli
Zero Computing S.r.l.

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>