Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix zend server cache #5597

Closed
wants to merge 3 commits into from

3 participants

André VIGNAUD Nicolas Eeckeloo Matthew Weier O'Phinney
André VIGNAUD

Fix problem retrieving data from cache when using Zend Server Adapter when data is not present.

Nicolas Eeckeloo

To provide additional information, the function zend_shm_cache_fetch called by \Zend\Cache\Storage\Adapter\AbstractZendServer::zdcFetch returns null instead of false if cache storage adapter does not retreive data.

http://files.zend.com/help/Zend-Platform/zend_cache_functions.htm

Matthew Weier O'Phinney weierophinney added this to the 2.2.6 milestone
Matthew Weier O'Phinney weierophinney self-assigned this
Matthew Weier O'Phinney weierophinney referenced this pull request from a commit
Matthew Weier O'Phinney weierophinney Merge branch 'hotfix/5597' into develop
Forward port #5597
fb78f89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
3  library/Zend/Cache/Storage/Adapter/AbstractZendServer.php
View
@@ -39,9 +39,8 @@ protected function internalGetItem(& $normalizedKey, & $success = null, & $casTo
$prefix = ($namespace === '') ? '' : $namespace . self::NAMESPACE_SEPARATOR;
$result = $this->zdcFetch($prefix . $normalizedKey);
- if ($result === false) {
+ if ($result === null) {
$success = false;
- $result = null;
} else {
$success = true;
$casToken = $result;
2  library/Zend/Cache/Storage/Adapter/ZendServerDisk.php
View
@@ -149,7 +149,7 @@ protected function zdcStore($internalKey, $value, $ttl)
* Fetch a single item from Zend Data Disk Cache
*
* @param string $internalKey
- * @return mixed The stored value or FALSE if item wasn't found
+ * @return mixed The stored value or NULL if item wasn't found
* @throws Exception\RuntimeException
*/
protected function zdcFetch($internalKey)
2  library/Zend/Cache/Storage/Adapter/ZendServerShm.php
View
@@ -104,7 +104,7 @@ protected function zdcStore($internalKey, $value, $ttl)
* Fetch a single item from Zend Data SHM Cache
*
* @param string $internalKey
- * @return mixed The stored value or FALSE if item wasn't found
+ * @return mixed The stored value or NULL if item wasn't found
* @throws Exception\RuntimeException
*/
protected function zdcFetch($internalKey)
14 tests/ZendTest/Cache/Storage/Adapter/AbstractZendServerTest.php
View
@@ -51,6 +51,20 @@ public function testGetItem()
$this->assertEquals('value', $this->_storage->getItem('key'));
}
+ public function testGetItemFailed()
+ {
+ $success = null;
+ $this->_options->setNamespace('ns');
+
+ $this->_storage->expects($this->once())
+ ->method('zdcFetch')
+ ->with($this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'))
+ ->will($this->returnValue(null));
+
+ $this->assertNull($this->_storage->getItem('key', $success));
+ $this->assertFalse($success);
+ }
+
public function testGetMetadata()
{
$this->_options->setNamespace('ns');
Something went wrong with that request. Please try again.