Development

#3394 ([storage] fixed some SQL mistakes in sfMySQLSessionStorage and Created sfMySQLiSessionStorage)

You must first sign up to be able to contribute.

Ticket #3394 (closed defect: fixed)

Opened 7 months ago

Last modified 5 months ago

[storage] fixed some SQL mistakes in sfMySQLSessionStorage and Created sfMySQLiSessionStorage

Reported by: jug Assigned to: FabianLange
Priority: major Milestone: 1.1.0 RC1
Component: other Version: 1.1.0 DEV
Keywords: sfMySQLiSessionStorage sfMySQLSessionStorage session storage MySQL Cc:
Qualification: Accepted

Description

SQL mistakes in sfMySQLSessionStorage

Time handling was not correctly written, and not working in my environment (at least).

Here is an example of what I mean :

$sql = 'INSERT INTO '.$db_table.' ('.$db_id_col.', ' .
           $db_data_col.', '.$db_time_col.') VALUES (' .
           '\''.$id.'\', \'\', '.time().')';

It's bad, cause type of $db_time_col is datetime... time() returns an integer (unix timestamp) !

$sql = "INSERT INTO $db_table ($db_id_col, $db_data_col, $db_time_col) VALUES ('$id', '', NOW())";

NOW() is the perect MySQL function for what we need (and it's a bit more readable like that)

sfMySQLiSessionStorage

As sfMySQLSessionStorage doesn't support mysqli connection, I have created the sfMySQLiSessionStorage class.

Note: sfMySQLiSessionStorage simply extends sfMySQLSessionStorage

Attachments

sfMySQLiSessionStorage.class.php (2.3 kB) - added by jug on 04/23/08 14:00:26.
sfMySQLSessionStorage.class.php.diff (6.2 kB) - added by jug on 04/23/08 14:04:17.

Change History

04/23/08 14:00:26 changed by jug

  • attachment sfMySQLiSessionStorage.class.php added.

04/23/08 14:04:17 changed by jug

  • attachment sfMySQLSessionStorage.class.php.diff added.

04/28/08 09:35:23 changed by fabien

  • milestone set to 1.1.0 beta5.

04/28/08 22:17:01 changed by FabianLange

  • owner changed from fabien to FabianLange.
  • status changed from new to assigned.

04/28/08 23:15:14 changed by FabianLange

  • status changed from assigned to closed.
  • version changed from 1.0.13 to 1.1.0 DEV.
  • resolution set to fixed.
  • qualification changed from Unreviewed to Accepted.

implemented in r8665. The patch for 1.0 is in r8664

05/15/08 13:16:53 changed by jug

As Symfony 1.1 is still a Beta version, I exclude to use it for production...

As session can be stored in DB and we can use mysqli to interface the DB, the fact that using both abilities is bugging, is a bug...

As Symfony 1.0 is the stable version, you have to fix bug in it...

As your released 3 bugfix version of Symfony 1.0 in less than one month...

As I supplied a patch to fix this bug, that I use and have to set up manually each time a new bugfix version of Symfony 1.0 is released...

I don't see why my fix is not in 1.0 branch.

Why?

Give me an access to the SVN repository branch 1.0/trunk and I apply my patch. It will then be applied in the next 1.0...bugfix.

05/15/08 16:35:04 changed by fabien

The patch for the time bug has been applied to 1.0 in r8664.

We won't add the MySQLi support as we don't add new features to the 1.0 branch. We only fix bugs.

06/26/08 15:41:57 changed by staelche

Someone should change the PHPDoc Tag in sfMySQLSessionStorage and the snippet, for the database table layout too, because NOW() in a string context (as in bugfix) will produce a datetime and not a timestamp. I was updating from an older sf to 1.0.16 and I saw accidentally that sf wrote 2008 in the sess_time column and no timestamp and I saw no new Documentation anywhere for the db layout!