zendframework / zend-cache

BSD 3-Clause "New" or "Revised" License
69 stars 53 forks source link

Redis::delete is deprecated #185

Closed gabrovex closed 5 years ago

gabrovex commented 5 years ago

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 commented 5 years ago

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

ppaulis commented 5 years ago

@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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

@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 commented 5 years ago

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

Ocramius commented 5 years ago

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.