Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit a2ac014

Browse files
committed
Allow overriding cache id and tag validation in Zend_Cache
Closes zendframework#317
1 parent 6a53a89 commit a2ac014

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

library/Zend/Cache/Core.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public function load($id, $doNotTestCacheValidity = false, $doNotUnserialize = f
300300
}
301301
$id = $this->_id($id); // cache id may need prefix
302302
$this->_lastId = $id;
303-
self::_validateIdOrTag($id);
303+
$this->_validateIdOrTag($id);
304304

305305
$this->_log("Zend_Cache_Core: load item '{$id}'", 7);
306306
$data = $this->_backend->load($id, $doNotTestCacheValidity);
@@ -327,7 +327,7 @@ public function test($id)
327327
return false;
328328
}
329329
$id = $this->_id($id); // cache id may need prefix
330-
self::_validateIdOrTag($id);
330+
$this->_validateIdOrTag($id);
331331
$this->_lastId = $id;
332332

333333
$this->_log("Zend_Cache_Core: test item '{$id}'", 7);
@@ -355,8 +355,8 @@ public function save($data, $id = null, $tags = array(), $specificLifetime = fal
355355
} else {
356356
$id = $this->_id($id);
357357
}
358-
self::_validateIdOrTag($id);
359-
self::_validateTagsArray($tags);
358+
$this->_validateIdOrTag($id);
359+
$this->_validateTagsArray($tags);
360360
if ($this->_options['automatic_serialization']) {
361361
// we need to serialize datas before storing them
362362
$data = serialize($data);
@@ -424,7 +424,7 @@ public function remove($id)
424424
return true;
425425
}
426426
$id = $this->_id($id); // cache id may need prefix
427-
self::_validateIdOrTag($id);
427+
$this->_validateIdOrTag($id);
428428

429429
$this->_log("Zend_Cache_Core: remove item '{$id}'", 7);
430430
return $this->_backend->remove($id);
@@ -460,7 +460,7 @@ public function clean($mode = 'all', $tags = array())
460460
Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG))) {
461461
Zend_Cache::throwException('Invalid cleaning mode');
462462
}
463-
self::_validateTagsArray($tags);
463+
$this->_validateTagsArray($tags);
464464

465465
return $this->_backend->clean($mode, $tags);
466466
}
@@ -667,7 +667,7 @@ public function touch($id, $extraLifetime)
667667
* @throws Zend_Cache_Exception
668668
* @return void
669669
*/
670-
protected static function _validateIdOrTag($string)
670+
protected function _validateIdOrTag($string)
671671
{
672672
if (!is_string($string)) {
673673
Zend_Cache::throwException('Invalid id or tag : must be a string');
@@ -689,13 +689,13 @@ protected static function _validateIdOrTag($string)
689689
* @throws Zend_Cache_Exception
690690
* @return void
691691
*/
692-
protected static function _validateTagsArray($tags)
692+
protected function _validateTagsArray($tags)
693693
{
694694
if (!is_array($tags)) {
695695
Zend_Cache::throwException('Invalid tags array : must be an array');
696696
}
697697
foreach($tags as $tag) {
698-
self::_validateIdOrTag($tag);
698+
$this->_validateIdOrTag($tag);
699699
}
700700
reset($tags);
701701
}

0 commit comments

Comments
 (0)