File tree Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Expand file tree Collapse file tree 2 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -304,15 +304,22 @@ function config_item($item)
304
304
*/
305
305
function &get_mimes ()
306
306
{
307
- static $ _mimes = array () ;
307
+ static $ _mimes ;
308
308
309
- if (file_exists ( APPPATH . ' config/ ' . ENVIRONMENT . ' /mimes.php ' ))
309
+ if (empty ( $ _mimes ))
310
310
{
311
- $ _mimes = include (APPPATH .'config/ ' .ENVIRONMENT .'/mimes.php ' );
312
- }
313
- elseif (file_exists (APPPATH .'config/mimes.php ' ))
314
- {
315
- $ _mimes = include (APPPATH .'config/mimes.php ' );
311
+ if (file_exists (APPPATH .'config/ ' .ENVIRONMENT .'/mimes.php ' ))
312
+ {
313
+ $ _mimes = include (APPPATH .'config/ ' .ENVIRONMENT .'/mimes.php ' );
314
+ }
315
+ elseif (file_exists (APPPATH .'config/mimes.php ' ))
316
+ {
317
+ $ _mimes = include (APPPATH .'config/mimes.php ' );
318
+ }
319
+ else
320
+ {
321
+ $ _mimes = array ();
322
+ }
316
323
}
317
324
318
325
return $ _mimes ;
Original file line number Diff line number Diff line change @@ -2234,15 +2234,18 @@ protected function _set_error_message($msg, $val = '')
2234
2234
*/
2235
2235
protected function _mime_types ($ ext = '' )
2236
2236
{
2237
- static $ mimes ;
2237
+ static $ _mimes ;
2238
2238
2239
2239
$ ext = strtolower ($ ext );
2240
2240
2241
- if ( ! is_array ( $ mimes ))
2241
+ if (empty ( $ _mimes ))
2242
2242
{
2243
- $ mimes =& get_mimes ();
2243
+ // references cannot be directly assigned to static variables, so we use an array
2244
+ $ _mimes [0 ] =& get_mimes ();
2244
2245
}
2245
2246
2247
+ $ mimes =& $ _mimes [0 ];
2248
+
2246
2249
if (isset ($ mimes [$ ext ]))
2247
2250
{
2248
2251
return is_array ($ mimes [$ ext ])
You can’t perform that action at this time.
0 commit comments