Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can null be an array key? (File class)
  • I'm getting "Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in COREPATH/classes/file.php @ line 78" when null is passed into array_key_exists on line 78. I see that the null key is supposed to be an instance of the default \File_Area object in the init:
    static::$areas[null] = \File_Area::forge(\Config::get('file.base_config', array()));
    

    Maybe this isn't the case in a later version of php, but this is causing an error on 5.3.1 right now. Either way, there could probably be a better way of setting the default than using a null key... this might also be related to my other issue http://fuelphp.com/forums/topics/view/7221 To replicate:
     $assets = \File_Handler_Directory::forge('your/directory');
     $assets->delete();
    
  • The handlers were never meant to be used directly, but only through File::get($path) or $area->get_handler($path). File::get() ensures there's a File area object to call upon and the File_Area::get_handler() method (note: it's dynamic, never call static) does some other pre-work that's essential.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion