Sort of.
If you obey the intents of the Magento system designers, you can't see what's in the registry. That's because Magento's core engineers have declared the array that stores the registry values on the Mage
class as private
static private $_registry = array();
Also, there's no method in Mage
for fetching the raw registry or all its keys. This means under normal operating conditions, the only methods allowed to access $_registry
are in the class Mage
. Since you can't rewrite anything in Mage
, you're out of luck.
If you're willing to use reflection (and have PHP 5.3+ installed), you can use the following to grab the array
$class = new ReflectionClass('Mage');
$prop = $class->getProperty('_registry');
$prop->setAccessible(true);
$registry = $prop->getValue();
var_dump(
array_keys($registry)
);
This instantiates a ReflectionClass
class, passing in Mage
to tell PHP it's the defined Mage
class we wish to reflect into.
Then we grab a ReflectionProperty object with getProperty
, passing in _registry
which tells PHP we want to reflect into the _registry
property on the Mage
class.
Then we use the setAccessible
method to change the property from private
to public, and then grab its value with getValue
.