|
| 1 | +diff -Naur a/vendor/magento/framework/Cache/Core.php b/vendor/magento/framework/Cache/Core.php |
| 2 | +--- a/vendor/magento/framework/Cache/Core.php 2023-02-23 14:11:04 |
| 3 | ++++ b/vendor/magento/framework/Cache/Core.php 2023-04-14 11:54:58 |
| 4 | +@@ -5,6 +5,10 @@ namespace Magento\Framework\Cache; |
| 5 | + */ |
| 6 | + namespace Magento\Framework\Cache; |
| 7 | + |
| 8 | ++use Magento\Framework\Cache\Backend\Redis; |
| 9 | ++use Zend_Cache; |
| 10 | ++use Zend_Cache_Exception; |
| 11 | ++ |
| 12 | + class Core extends \Zend_Cache_Core |
| 13 | + { |
| 14 | + /** |
| 15 | +@@ -124,6 +128,34 @@ class Core extends \Zend_Cache_Core |
| 16 | + { |
| 17 | + $tags = $this->_tags($tags); |
| 18 | + return parent::getIdsNotMatchingTags($tags); |
| 19 | ++ } |
| 20 | ++ |
| 21 | ++ /** |
| 22 | ++ * Validate a cache id or a tag (security, reliable filenames, reserved prefixes...) |
| 23 | ++ * |
| 24 | ++ * Throw an exception if a problem is found |
| 25 | ++ * |
| 26 | ++ * @param string $string Cache id or tag |
| 27 | ++ * @throws Zend_Cache_Exception |
| 28 | ++ * @return void |
| 29 | ++ */ |
| 30 | ++ protected function _validateIdOrTag($string) |
| 31 | ++ { |
| 32 | ++ if ($this->_backend instanceof Redis) { |
| 33 | ++ if (!is_string($string)) { |
| 34 | ++ Zend_Cache::throwException('Invalid id or tag : must be a string'); |
| 35 | ++ } |
| 36 | ++ if (substr($string, 0, 9) == 'internal-') { |
| 37 | ++ Zend_Cache::throwException('"internal-*" ids or tags are reserved'); |
| 38 | ++ } |
| 39 | ++ if (!preg_match('~^[a-zA-Z0-9_{}]+$~D', $string)) { |
| 40 | ++ Zend_Cache::throwException("Invalid id or tag '$string' : must use only [a-zA-Z0-9_{}]"); |
| 41 | ++ } |
| 42 | ++ |
| 43 | ++ return; |
| 44 | ++ } |
| 45 | ++ |
| 46 | ++ parent::_validateIdOrTag($string); |
| 47 | + } |
| 48 | + |
| 49 | + /** |
0 commit comments