zendframework/zf2 — pull request #6560 by hver (2014-08-12 12:21:38+00:00)
Title:  AbstractAdapter::getItem() should return null, when the item cannot be retrieved

_(Reopened the PR against develop branch, original PR: https://github.com/zendframework/zf2/pull/6525)_

The AbstractAdapter::getItem() is specified to return *null*, if the item cannot be retrieved. Also the *$success* variable passed by reference should be set to *false* in this case.

In our setup we've encountered errors, because it was not the case. We are using Redis as cache, and have configured the ExceptionHandler Plugin to not throw exceptions ('throw_exceptions' => false), because if the cache fails, it is not breaking the application. But in this case, if the Redis server is unavailable, the getItem() function, return *false* instead of *null*, also the *$success* variable is set to *null* instead of *false*. This is not the expected behavior, and our app was broken, because we checked explicitly, if the return value is strictly not null ($value !== null)

The problem is not only in Redis, but in the AbstractAdapter generally. If there is an exception in getItem(), and this exception is ignored (which is rather ok, for the cache), the $success var is not set and the result equals to null.