logic error in elgg_load_library
|Reported by:||coldtrick||Owned by:|
Description (last modified by ewinslow)
The function elgg_load_library should load a single library just once.
This is only the case if the path to a library is the same, which is not always the case. This could cause duplicate loads of the same library file and therefore cause fatal redeclaration errors.
The following is a real life situation of the above issue.
Having the HTMLawed plugin enabled i would like to have my own plugin provide a newer version of the htmlawed library. Therefore in the init of my plugin i would register a library.
If between the load of the htmlawed plugin and my plugin a get_input is triggered (this could certainly happen) that would have loaded the library registered in the html_lawed plugin (because of the filter tags hook). If after my plugin a new get_input is executed this will again try to load the htmlawed library (in the filter tags hook). As now my path to the library is registered for the htmlawed library it will be included again. That cause a redeclaration and thus an error.
This needs fixing.
Or we do not allow an override of an already registered library or we register if it is already loaded and won't load it again.