Hello,

Again, I used for one project the sfPDOSessionStorage with a MySQL
database. I read the documentation [1], so I create a timestamp field
for the db_time_col as the documentation state 'timestamp'. Well no
luck, the documentation is not correct or a least the database mapping
is wrong, as I get '0000-00-00 00:00:00'. I changed the db_time_col to
be a integer, and now everything is working fine.

my 2c

[1] 
http://www.symfony-project.org/book/1_1/06-Inside-the-Controller-Layer#Session%20Management

On Tue, Sep 2, 2008 at 7:40 PM, Benjamin Meynell <[EMAIL PROTECTED]> wrote:
>
> [SOLVED]
>
> Fabian Lange and I worked through this today on IRC. Here's my NEW
> config, which works. The difference is that sessions now require a
> SEPARATE datasource.
>
> # databases.yml
> all:
>  propel:
>    class:             sfPropelDatabase
>    param:
>      classname:  PropelPDO
>      dsn:              mysql:dbname=db;host=localhost
>      phptype:       mysql
>      username:    username
>      password:     password
>      encoding:      utf8
>      persistent:    false
>      pooling:         false
>  sessions:
>    class:        sfPDODatabase
>    param:
>      classname:  PropelPDO
>      dsn:        mysql:dbname=db;host=localhost
>      phptype:    mysql
>      username:   username
>      password:   password
>      encoding:   utf8
>      persistent: false
>      pooling:    false
>
> # factories.yml
> all:
>  storage:
>    class:          sfPDOSessionStorage
>    param:
>      session_name: symfony
>      db_table:     sessions
>      database:     sessions
>      db_id_col:    sess_id
>      db_data_col:  data
>      db_time_col:  time
>
> That's it!
>
> Ben
>
> On Aug 30, 9:42 am, Benjamin Meynell <[EMAIL PROTECTED]> wrote:
>> I'm having a different issue with sfMySQLSessionStorage and/or
>> sfPDOSessionStorage in 1.2-DEV
>>
>> Using sfPDOSessionStorage the error is:
>>
>> Fatal error: Call to a member function prepare() on a non-object in /
>> usr/local/lib/sf/1.2.0-DEV/lib/storage/sfPDOSessionStorage.class.php
>> on line 109
>>
>> Using sfMySQLSessionStorage the error is:
>>
>> Warning: mysql_real_escape_string() expects parameter 2 to be
>> resource, null given in /usr/local/lib/sf/1.2.0-DEV/lib/storage/
>> sfMySQLSessionStorage.class.php on line 182
>>
>> These errors occur with the following configuration, and sessions are
>> being stored in the same database as the application:
>>
>> # config/databases.yml
>> dev:
>>   propel:
>>     param:
>>       classname:  DebugPDO
>> all:
>>   propel:
>>     class:        sfPropelDatabase
>>     param:
>>       classname:  PropelPDO
>>       dsn:        mysql:dbname=db;host=localhost
>>       phptype:    mysql
>>       username:   username
>>       password:   password
>>       encoding:   utf8
>>       persistent: false
>>       pooling:    false
>>
>> # apps/frontend/config/factories.yml
>> all:
>>   storage:
>>     class: sfPDOSessionStorage (or sfMySQLSessionStorage)
>>     param:
>>       session_name: symfony
>>       db_table:     sessions
>>       database:     propel
>>       db_id_col:    sess_id
>>       db_data_col:  data
>>       db_time_col:  time
>>
>> Any pointers are greatly appreciated!
>>
>> Ben
>>
>> On Aug 29, 11:14 am, "Thomas Rabaix" <[EMAIL PROTECTED]> wrote:
>>
>> > Hello,
>>
>> > I just found out a bug in sfMySQLSessionStorage [1] , the session_time
>> > use the mysql  'NOW()' function and before it was using php time().
>>
>> > Now the problem is most of snippets ( [2], [3]) found on the web to
>> > used sfMySQLSessionStorage, use bigint to store the sess_time and not
>> > a date field.
>>
>> > So instead of saving '2008-05-06', it saved '2008'. and before the
>> > revision it was '1206893684' (unix timestamp)
>>
>> > So websites using bigint for sess_time fields will not have their
>> > sessions deleted
>>
>> > [1]http://trac.symfony-project.org/changeset/8664
>> > [2]http://www.symfony-project.org/snippets/snippet/26
>> > [3]http://www.symfony-project.org/forum/index.php/m/20549/
>>
>> > --
>> > Thomas Rabaix
>> > Internet Consultant
> >
>



-- 
Thomas Rabaix
Internet Consultant

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to