1 | <?php |
||
22 | trait DriverBaseTrait |
||
23 | { |
||
24 | /** |
||
25 | * @var array |
||
26 | */ |
||
27 | public $extension_dir = '_extensions'; |
||
28 | |||
29 | /** |
||
30 | * @var array |
||
31 | */ |
||
32 | public $tmp = []; |
||
33 | |||
34 | /** |
||
35 | * @var array default options, this will be merge to Driver's Options |
||
36 | */ |
||
37 | public $config = []; |
||
38 | |||
39 | /** |
||
40 | * @var bool |
||
41 | */ |
||
42 | public $fallback = false; |
||
43 | |||
44 | /** |
||
45 | * @var mixed Instance of driver service |
||
46 | */ |
||
47 | public $instance; |
||
48 | |||
49 | /** |
||
50 | * @param $keyword |
||
51 | * @return string |
||
52 | */ |
||
53 | protected function encodeFilename($keyword) |
||
57 | |||
58 | /** |
||
59 | * @param $config_name |
||
60 | * @param string $value |
||
61 | */ |
||
62 | public function setup($config_name, $value = '') |
||
73 | |||
74 | |||
75 | /** |
||
76 | * @param $file |
||
77 | * @return string |
||
78 | * @throws \Exception |
||
79 | */ |
||
80 | protected function readfile($file) |
||
101 | |||
102 | /** |
||
103 | * Encode data types such as object/array |
||
104 | * for driver that does not support |
||
105 | * non-scalar value |
||
106 | * @param $data |
||
107 | * @return string |
||
108 | */ |
||
109 | protected function encode($data) |
||
113 | |||
114 | /** |
||
115 | * Decode data types such as object/array |
||
116 | * for driver that does not support |
||
117 | * non-scalar value |
||
118 | * @param $value |
||
119 | * @return mixed |
||
120 | */ |
||
121 | protected function decode($value) |
||
130 | |||
131 | /** |
||
132 | * Check phpModules or CGI |
||
133 | * @return bool |
||
134 | */ |
||
135 | protected function isPHPModule() |
||
147 | |||
148 | |||
149 | /** |
||
150 | * @param $class |
||
151 | * @return bool |
||
152 | */ |
||
153 | protected function isExistingDriver($class) |
||
157 | |||
158 | |||
159 | /** |
||
160 | * @param $tag |
||
161 | * @return string |
||
162 | */ |
||
163 | protected function _getTagName($tag) |
||
167 | |||
168 | /** |
||
169 | * @param \phpFastCache\Cache\ExtendedCacheItemInterface $item |
||
170 | * @return array |
||
171 | */ |
||
172 | public function driverPreWrap(ExtendedCacheItemInterface $item) |
||
180 | |||
181 | /** |
||
182 | * @param array $wrapper |
||
183 | * @return mixed |
||
184 | */ |
||
185 | public function driverUnwrapData(array $wrapper) |
||
189 | |||
190 | /** |
||
191 | * @param array $wrapper |
||
192 | * @return mixed |
||
193 | */ |
||
194 | public function driverUnwrapTags(array $wrapper) |
||
198 | |||
199 | |||
200 | /** |
||
201 | * @param array $wrapper |
||
202 | * @return \DateTime |
||
203 | */ |
||
204 | public function driverUnwrapTime(array $wrapper) |
||
208 | |||
209 | /** |
||
210 | * @return string |
||
211 | */ |
||
212 | public function getDriverName() |
||
218 | |||
219 | /** |
||
220 | * @param \phpFastCache\Cache\ExtendedCacheItemInterface $item |
||
221 | * @return bool |
||
222 | */ |
||
223 | public function driverWriteTags(ExtendedCacheItemInterface $item) |
||
280 | |||
281 | /** |
||
282 | * @param $key |
||
283 | * @return string |
||
284 | */ |
||
285 | public function getTagKey($key) |
||
289 | |||
290 | /** |
||
291 | * @param $key |
||
292 | * @return string |
||
293 | */ |
||
294 | public function getTagKeys(array $keys) |
||
302 | } |
$file
can contain request data and is used in file inclusion context(s) leading to a potential security vulnerability.General Strategies to prevent injection
In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:
For numeric data, we recommend to explicitly cast the data: