i've been using Mage::registry('current_category'); but i only found about that from a template done by someone else, so i am wondering if there is an easy way to get a list of all the registry keys/values currently being used in magento

while i'm not fussed if a link is provided with a list of magento ones i would like to get a list of any registry keys/values used in 3rd party modules

4 Answers 4


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');
$registry = $prop->getValue();

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.

  • Plus one because Reflection. Reflect all the things.
    – philwinkle
    Aug 13, 2013 at 2:25
  • ...and because Commercebug uses its fair share of reflection
    – philwinkle
    Aug 13, 2013 at 2:26
  • 1
    @philwinkle Less than you'd think — just for the new events reporting in Commerce Bug 2, and only because there was no other way (if you want to see some real crimes against computer science, checkout Model/Events.php for my pre PHP 5.3 setAccessible support)
    – Alan Storm
    Aug 13, 2013 at 4:33
  • Great! ReflectionClass is pretty neat. May 17, 2017 at 11:27

If you're using Unix you could do something like:

grep -rni 'Mage::registry' app

..to see all the occurrences of a registry value being set by anything in the app folder. Or you could be more specific and search in a specific module: grep -rni 'Mage::registry' app/code/community/modulex


If you just want to check or debug something. To do this easly on main Mage class (app/Mage.php) change

static private $_registry = array();


static public $_registry = array();

And then you can access it anywhere.

foreach (Mage::$_registry as $key => $value) {

I tried following: in app/Mage.php looking on function public static function register()



And check file - system.log

  • Wrong. editing Mage.php is not encouraged. Also putting that log in that location will give you lot of headaches since the system.log will grow fast with registry log !! Apr 20, 2016 at 8:24
  • Yes, but this only for debug, not production
    – Alex
    Apr 20, 2016 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.