Skip to content

Commit 161f8ca

Browse files
Override method to fix PHP 7.2 compatibility.
1 parent bde1185 commit 161f8ca

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

File.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,32 @@ public function __construct(array $options = array())
107107
$this->_options['cache_file_umask'] = $this->_options['file_mode'];
108108
}
109109

110+
/**
111+
* OVERRIDDEN to remove use of each() which is deprecated in PHP 7.2
112+
*
113+
* Set the frontend directives
114+
*
115+
* @param array $directives Assoc of directives
116+
* @throws Zend_Cache_Exception
117+
* @return void
118+
*/
119+
public function setDirectives($directives)
120+
{
121+
if (!is_array($directives)) Zend_Cache::throwException('Directives parameter must be an array');
122+
foreach ($directives as $name => $value) {
123+
if (!is_string($name)) {
124+
Zend_Cache::throwException("Incorrect option name : $name");
125+
}
126+
$name = strtolower($name);
127+
if (array_key_exists($name, $this->_directives)) {
128+
$this->_directives[$name] = $value;
129+
}
130+
131+
}
132+
133+
$this->_loggerSanity();
134+
}
135+
110136
/**
111137
* Test if a cache is available for the given id and (if yes) return it (false else)
112138
*

0 commit comments

Comments
 (0)