[dev] what did I missed? -- an issue in Registry.php

Vitor Horewicz vitor at inf.ufsc.br
Thu Jun 3 09:12:06 PDT 2004


 Hi Jan,
 ok, I really messed things up a little in the last message. But the question
is, I didn't understand why this code works as it is expected (it was taken
from config/Registry.php, lines 124-130):

foreach (array_keys($this->applications) as $appName) {
            // Simply discard applications marked as inactive.
            if (array_key_exists('active', $this->applications[$appName]) &&
                !$this->applications[$appName]['active']) {
                unset($this->applications[$appName]);
                continue;
            } 

 As you can see, the parameter passed to array_key_exists() is 'active', but in
the file config/registry.php the actual key is 'status'... so how it is
working? It should work just if the key passed were 'status'.

 The intention is to verify if the 'status' is 'active' or 'inactive'.

 Should'nt it be something like this? 

foreach (array_keys($this->applications) as $appName) {
            // Simply discard applications marked as inactive.
            if (array_key_exists('status', $this->applications[$appName]) &&
                $this->applications[$appName]['status']!= 'active') {
                unset($this->applications[$appName]);
                continue;
            }

 thanks in advance,
  vitor





More information about the dev mailing list