We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Function Redis::setTimeout() is deprecated, Function Redis::delete() is deprecated

My session adapter is Redis. Nowadays I'm getting a weird error and pages don't work. It was working well until yesterday. I think I accepted a system update, but not sure...

0 [internal function]: {closure}(8192, 'Function Redis:...', '/eysis/apache/h...', 11, Array)

1 [internal function]: Phalcon\Cache\Backend\Redis->delete('tf6pbuoikfr0aod...')

2 /eysis/apache/htdocs/eysiswa/app/controllers/ExitController.php(11): Phalcon\Session\Adapter\Redis->destroy()

3 [internal function]: ExitController->indexAction()

4 [internal function]: Phalcon\Dispatcher->callActionMethod(Object(ExitController), 'indexAction', Array)

5 [internal function]: Phalcon\Dispatcher->dispatch()

6 /eysis/apache/htdocs/eysiswa/public/index.php(66): Phalcon\Mvc\Application->handle()

7 {main}

ExitController.php line 11 is only: $this->session->destroy();

Wasted 10 hours, then I've installed redis-server and php again. But no luck. I'm stuck here. Do you guys have any idea?

  • PHP Version 7.3.8-1+ubuntu18.04.1+deb.sury.org+1
  • Apache/2.4.29 (Ubuntu 18.04.2 LTS)
  • Redis Version 5.0.2
  • Phalcon Version 3.4.4
  • Build Date Aug 8 2019 07:01:51
  • Powered by Zephir Version 0.10.16-6826149172

Phalcon Version 3.4.3 worked fine before? Is there a bug for 3.4.4?

You'll need to downgrade your PHP Redis extension to 4.3.0 for now, your system probably upgraded it to 5 which doesn't support the setTimeout Phalcon uses. I had to manually download it and configure/make from the github https://github.com/phpredis/phpredis/releases/tag/4.3.0



165
Accepted
answer

Same here, I updated my debian. Redis is now 5+ and many deprecations are there.

You can download/compile from source as @jetski423 said, or just use pecl install redis-4.3.0. It will overwrite the lib installed by your system.

You can add a restriction temporarly in your composer.json to avoid being trapped while phalcon dependency is solved :

{
    "require": {
        "ext-phalcon": "~3.4",
        "ext-redis": "~4.3"
    }
}