Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Redis::delete is deprecated #185

Closed
2 tasks done
gabrovex opened this issue Jul 22, 2019 · 9 comments
Closed
2 tasks done

Redis::delete is deprecated #185

gabrovex opened this issue Jul 22, 2019 · 9 comments
Milestone

Comments

@gabrovex
Copy link

  • I was not able to find an open or closed issue matching what I'm seeing.
  • This is not a question. (Questions should be asked on chat (Signup here) or our forums.)

Provide a narrative description of what you are trying to accomplish.

Code to reproduce the issue

every call of $redis->delete() in here:
https://github.com/zendframework/zend-cache/blob/master/src/Storage/Adapter/Redis.php

Expected results

not throwing deprecation errors
redis delete is deprecated. should be replaced with del https://redis.io/commands/del
(using redis 3.2 on my server)

Actual results

ErrorException
File
/app/vendor/zendframework/zend-cache/src/Storage/Adapter/Redis.php:359

Message
Function Redis::delete() is deprecated

Stack trace
#0 /app/vendor/sentry/sentry/lib/Raven/Breadcrumbs/ErrorHandler.php(34): Bootstrap\Bootstrap->exceptionErrorHandler(8192, 'Function Redis:...', '/app/vendor/zen...', 359, Array)
#1 /app/vendor/sentry/sentry/lib/Raven/ErrorHandler.php(127): Raven_Breadcrumbs_ErrorHandler->handleError(8192, 'Function Redis:...', '/app/vendor/zen...', 359, Array)
#2 /app/vendor/sentry/sentry/lib/Raven/Breadcrumbs/ErrorHandler.php(34): Raven_ErrorHandler->handleError(8192, 'Function Redis:...', '/app/vendor/zen...', 359, Array)
#3 /app/vendor/sentry/sentry/lib/Raven/Breadcrumbs/ErrorHandler.php(34): Raven_Breadcrumbs_ErrorHandler->handleError(8192, 'Function Redis:...', '/app/vendor/zen...', 359, Array)
#4 /app/vendor/zendframework/zend-cache/src/Storage/Adapter/Redis.php(359): Raven_Breadcrumbs_ErrorHandler->handleError(8192, 'Function Redis:...', '/app/vendor/zen...', 359, Array)
#5 /app/vendor/zendframework/zend-cache/src/Storage/Adapter/AbstractAdapter.php(1174): Zend\Cache\Storage\Adapter\Redis->internalRemoveItem('64fd5d37681d43d...')
#6 /app/vendor/zendframework/zend-session/src/SaveHandler/Cache.php(112): Zend\Cache\Storage\Adapter\AbstractAdapter->removeItem('64fd5d37681d43d...')
#7 [internal function]: Zend\Session\SaveHandler\Cache->destroy('64fd5d37681d43d...')
#8 /app/vendor/zendframework/zend-session/src/SessionManager.php(333): session_regenerate_id(true)
@michalbundyra
Copy link
Member

@gabrovex Would you like provide PR with this change? Thanks!

@ppaulis
Copy link
Contributor

ppaulis commented Jul 31, 2019

@gabrovex @webimpress This happens since redis extension v5.0.0. As a workaround, you can downgrade to 4.3.0. My PR should fix that behaviour.

@ppaulis
Copy link
Contributor

ppaulis commented Jul 31, 2019

https://travis-ci.org/zendframework/zend-cache/jobs/565853773#L1058
Build on PHP 5.6 fails because of this. I'll try to find some time to check this out.

@michalbundyra
Copy link
Member

@ppaulis

This happens since redis extension v5.0.0. As a workaround, you can downgrade to 4.3.0.

This is actually very good point. Now just wonder if by this change we are not introducing BC Break. We do not have any requirements on Redis version so I guess we should add. Probably also we would need update tests to run with previous version of Redis (4.x, maybe even 3.x?)

@ppaulis
Copy link
Contributor

ppaulis commented Jul 31, 2019

@ppaulis

This happens since redis extension v5.0.0. As a workaround, you can downgrade to 4.3.0.

This is actually very good point. Now just wonder if by this change we are not introducing BC Break. We do not have any requirements on Redis version so I guess we should add. Probably also we would need update tests to run with previous version of Redis (4.x, maybe even 3.x?)

@webimpress That's a very good point too. If the tests on all redis-server versions pass (no BC break), a new bugfix release could be made.
If, however, that's not the case, we would need to create a new major version (3.0.0 ?) with a requirement on the redis-server version? I don't see any alternative there, because the redis extension is already released.

@ppaulis
Copy link
Contributor

ppaulis commented Jul 31, 2019

@webimpress What I currently don't get, is, why the build fails on memcache for PHP 5.6 when I change a few calls in the Redis adapter.

@michalbundyra
Copy link
Member

@ppaulis

why the build fails on memcache for PHP 5.6 when I change a few calls in the Redis adapter

I think because other version of service/extension is now installed. I've checked latest passing build on master and for example I see there Redis 4.0.6, your build uses Redis 5.0.4 (but I guess there could be similar reason?)

@pimjansen
Copy link

Any update on this? Its stopping us for using Zend\Cache at this point with the latest PHP version

@Ocramius
Copy link
Member

I'd suggest adding a "conflict": {"ext-redis": ">=5.0.0"} for existing versions, and fixing this (by adding "conflict": {"ext-redis": "<4.0.0"} in a new minor.

@michalbundyra michalbundyra removed the bug label Aug 29, 2019
michalbundyra added a commit that referenced this issue Aug 29, 2019
Issue #185 : replacing deprecated delete() calls with del()
michalbundyra added a commit that referenced this issue Aug 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants