diff --git a/lib/pluginlib.php b/lib/pluginlib.php
index <HASH>..<HASH> 100644
--- a/lib/pluginlib.php
+++ b/lib/pluginlib.php
@@ -221,12 +221,18 @@ class plugin_manager {
     /**
      * Returns a localized name of a given plugin
      *
-     * @param string $plugin name of the plugin, eg mod_workshop or auth_ldap
+     * @param string $component name of the plugin, eg mod_workshop or auth_ldap
      * @return string
      */
-    public function plugin_name($plugin) {
-        list($type, $name) = normalize_component($plugin);
-        return $this->pluginsinfo[$type][$name]->displayname;
+    public function plugin_name($component) {
+
+        $pluginfo = $this->get_plugin_info($component);
+
+        if (is_null($pluginfo)) {
+            throw new moodle_exception('err_unknown_plugin', 'core_plugin', '', array('plugin' => $component));
+        }
+
+        return $pluginfo->displayname;
     }
 
     /**
MDL-<I> Fix plugin_manager::plugin_name() implementation

This is not directly related to the issue. However, it turned out that
if this method was called on plugin_manager without loaded plugins, it
would throw an error. This new implementation uses cleaner access to the
plugininfo subclass.