tags:

views:

76

answers:

1

This might be tough to read, but essential is does this over and over again (Repeats 14 times):

  1. Select session id
  2. Count session
  3. Update session

16 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 1

17 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

18 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

19 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1

20 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 1

21 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

22 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

23 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

24 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 1

25 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

26 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

27 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

28 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

29 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

30 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

31 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

32 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

33 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

34 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

35 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

36 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

37 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

38 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

39 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

40 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

41 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

42 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

43 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

44 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

45 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

46 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

47 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 2

48 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

49 DELETE Session FROM cake_sessions AS Session WHERE Session.expires < 1440 0 1

50 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

51 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

52 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

53 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 1

54 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

55 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

56 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

57 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

58 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

59 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

60 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

61 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 1

62 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

63 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

64 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

65 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

66 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

67 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

68 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

69 DELETE Session FROM cake_sessions AS Session WHERE Session.expires < 1281974807 0 1

70 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

71 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 1

72 SELECT COUNT(*) AS count FROM cake_sessions AS Session WHERE Session.id = '80f5f4f43334a7bc1446d06d143e6330' 1 1 0

73 UPDATE cake_sessions SET id = '80f5f4f43334a7bc1446d06d143e6330', data = '', expires = 1282010807 WHERE cake_sessions.id = '80f5f4f43334a7bc1446d06d143e6330' 0 1

74 SELECT Session.id, Session.data, Session.expires FROM cake_sessions AS Session WHERE id = '80f5f4f43334a7bc1446d06d143e6330' LIMIT 1 1 1 0

A: 

There seems to be a bug in the cake core for this that has not been merged. The _read and _write methods for the cake_session are not correctly checking whether or not anything is in the _SESSION.

This patch corrects the issue:

http://github.com/dogmatic69/cakephp1x/commit/1940f80016ff136698e0e49f3097f8b6b29e9659

Thanks to dogmatic69

zmonteca