Development

#10022 (Class sfPDOSessionStorage does not work with Oracle Database)

You must first sign up to be able to contribute.

Ticket #10022 (closed defect: fixed)

Opened 1 year ago

Last modified 8 months ago

Class sfPDOSessionStorage does not work with Oracle Database

Reported by: Stasy Assigned to: fabien
Priority: minor Milestone: 1.4.19
Component: storage Version: 1.4.x DEV
Keywords: session storage Cc:
Qualification: Unreviewed

Description

Hi,

I tried to enable session storage in an Oracle Database in a test project as follows:

all:
  storage:
    class: sfPDOSessionStorage
    param:
      session_name: oraclesessiontest
      db_table: t_session
      database: doctrine
      db_id_col: id
      db_data_col: session_data
      db_time_col: time

Database connection is configured correctly and works. Table for session data is defined as follows:

T_SESSION:
  connection: doctrine
  tableName: T_SESSION
  columns:
    id:
      type: string(32)
      fixed: false
      unsigned: false
      primary: true
    session_data:
      notnull: false
      type: clob(4000)
      fixed: false
      unsigned: false
      primary: false
    time:
      notnull: true
      type: integer(8)
      fixed: false
      unsigned: false
      primary: false

After saving the settings I deleted all items from the cache directory. Now, when I tried to use session data, it did not work. Using Oracle SQL Developer, I can see there is data stored in table T_SESSION, but reading out session data did not work. The exact same application works fine when I define a MySQL connection instead of an oci connection in databases.yml.

I debbuged a while and found a solution:

Replace line 118 of sfPDOSessionStorage.class.php

        return $sessionRows[0][0];

with

        if (!is_string($sessionRows[0][0]))
        {
          return fgets($sessionRows[0][0]); // works for Oracle
        }
        else
        {
          return $sessionRows[0][0]; // works for MySQL
        }

Change History

05/30/12 09:57:06 changed by fabien

  • milestone changed from 1.4.18 to 1.4.19.

10/05/12 12:49:45 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [33545]) [1.4] fixed sfPDOSessionStorage for Oracle (closes #10022)