I'm using F3 (Fat-Free Framework) for a project at work and have stumbled across a problem I can't seem to find any information about. Neither Google nor official F3 documentation has given me anything. Maybe I'm simply asking the wrong question. Here's the problem.
I have an array that looks something like this: ( city => type => building )
$places = array(
'City A' => array(
'special' => array(),
'standard' => array('Campus', ),
),
'City B' => array(
'special' => array(
'collect',
'exam',
'Brännässlan',
),
'standard' => array(
'Building A',
'Building B',
'Building C',
'Building D (Library)',
'Capitol',
'Flair',
),
),
),
What I want to do is to check each building in the array to see if a corresponding dictionary variable has been set for it. I use $f3->exists('dict_select_hus_arrayValue')
to check and it works fine until the function encounters a building with the letter 'ä' in it. If it does, it throws a 500 error with the text Invalid hive key 'dict_select_hus_Brännässlan'
.
I assume it has to do with the encoding of the string, but I work in a purely UTF-8 environment and F3 should be able to handle it. Has anyone else encountered this and, more importantly, found a solution to the problem?
F3 doesn't allow language specific characters to be used as keys in hive. I'm not sure if this was intended or accidental, but the root cause of this problem lies in &ref
method of Base
class. You will find somewhere around line 244 a preg_match('/^\w+$/',$parts[0])
. This will return false
in your case as language specific characters are not within \w
.
My advice would be to either change this expression to include chars like the ones you use (you will need to remember about this modification in case you will later upgrade F3 or reset it for some reason) or strip the string of them before checking with F3.