Cphalcon: [BUG]: Session Redis Adapter Wrong number of parameters

Created on 17 Jan 2020  路  4Comments  路  Source: phalcon/cphalcon

Describe the bug
Session Redis Wrong number of parameters

Steps to reproduce the behavior:

<?php

use Phalcon\Session\Manager;
use Phalcon\Storage\AdapterFactory;
use Phalcon\Session\Adapter\Redis;

$options = [
    'host'  => '127.0.0.1',
    'port'  => 6379,
    'index' => '1',
];

$session = new Manager();
$factory = new AdapterFactory();
$redis   = new Redis($factory, $options);

$session
    ->setAdapter($redis)
    ->start();

Provide minimal script to reproduce the issue

Error : Wrong number of parameters

Details

  • Phalcon version: 4.0.2
  • PHP Version: 7.3.7
  • Operating System: Mac Os catalina
  • Server: Nginx
  • Redis: 4.1.1
not a bug

All 4 comments

You're missing your serializer. https://docs.phalcon.io/4.0/en/api/phalcon_storage#methods-7

<?php


use Phalcon\Session\Manager;
use Phalcon\Storage\AdapterFactory;
use Phalcon\Session\Adapter\Redis;
use Phalcon\Storage\SerializerFactory;

$options = [
    'host' => '127.0.0.1',
    'port' => 6379,
    'index' => '1',
];

$session = new Manager();
$serializer = new SerializerFactory();
$factory = new AdapterFactory($serializer);
$redis = new Redis($factory, $options);

$session
    ->setAdapter($redis)
    ->start();

@duongkhoangiam Can you please test this and close the bug if this works for you?

Yes working , so need edit document in phalcon.io
https://docs.phalcon.io/4.0/en/session#redis

@duongkhoangiam I would recommend you to use https://github.com/phalcon/ide-stubs, as it will save you quite a lot of time regarding reading docs.

I added the relevant section in the docs. Thanks @duongkhoangiam for pointing this out.

Was this page helpful?
0 / 5 - 0 ratings