array_key_exists works properly when method is called direct, but not when through another method
<p>I'm having some trouble in finding out why the code extract below does not do what I expect. When passing a setting string immediately to <code>settingIsProtected</code> the function returns correctly if a setting is protected (has leading underscore in the data array). But when the method is called through <code>getAll</code> if never gets past the first if statement.</p>

<p>Thoughts much appreciated, thanks!</p>

<pre><code>&lt;?php
class Config
{

    private static $data = array(
        'foo' =&gt; 'bar',
        '_baz' =&gt; 'qux'
    );

    public static function getAll($filterProtected = TRUE)
    {
        if ($filterProtected == TRUE) {
            $filtered = array();
            foreach (self::$data as $key =&gt; $value) {
                if (self::settingIsProtected($key) == TRUE) {
                    $filtered[$key] = $value;
                }
            }
            return $filtered;
        } else {
            return self::$data;
        }
    }

    public static function settingIsProtected($key)
    {
        if (array_key_exists($key, self::$data)) {
            return FALSE;
        } else if (array_key_exists('_' . $key, self::$data)) {
            return TRUE;
        } else {
            return NULL;
        }
    }

}

var_dump(Config::settingIsProtected('foo'));    // prints false
var_dump(Config::settingIsProtected('baz'));    // prints true
var_dump(Config::getAll(FALSE));                // prints an array with foo and _baz
var_dump(Config::getAll(TRUE));                 // prints empty array
?&gt;
</code></pre>
