-
Bug
-
Resolution: Fixed
-
Major
-
3.0.5, 3.1.1, 3.2
-
MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_32_STABLE
-
MOODLE_30_STABLE, MOODLE_31_STABLE
-
MDL-55237_master -
The method \core_component::get_component_classes_in_namespace() uses a regular expression to find classes in a given namespace.
But it uses the given namespace just as part of a namespace and not as the namespace itself.
example:
You have a plugin named "local_my_plugin". In this plugin you have a class "\local_my_plugin\search_form".
If you call $result = \core_component::get_component_classes_in_namespace('local_my_plugin', 'search');
It gets you the result:
Array
(
[local_my_plugin\search_form] => Array
(
[0] => local_my_plugin\search
)
)
That is obviously wrong.
In my case it broke a pluginin which uses a class like that.
The regex is built like that:
$regex = '/^' . $component . '\\\\' . $namespace . '/';
So the given namespace is just the first part of a namespace.
Mayby it should look like that:
$regex = '/^' . $component . '\\\\' . $namespace . '\\\\/';
But I don't know if the RegexIterator is working correctly after that.
Best regards Andreas