EllisLab/CodeIgniter — Issue #777: Loading extended helper from package
Author: waldmeister
Created: 2011-12-13 15:50:16+00:00
State: open

I'm running 2 apps on the same server and they share the system folder and a folder called "common" where I put custom/new libraries they share and I did not want to put in both app folders. I can do this using the packages autoload option and it works just fine. Now I got a extended helper that they both share as well and that's where it all fails :)

According to the user guide if I want to extend a helper I should just create a new file in my application/helper folder with the same name as the original file and then just prepend it with the subclass suffix, in my case the god old 'MY_'. I did exactly this but instead of putting it in my application/helpers folder, I put the file in common/helpers (my shared package folder for both apps), but the helper just wasn't loaded.

So I had a look at the code and in the system/core/Loader.php on line 502-523 it only checks the application folder for a file with the subclass prefix but not the package folder(s). It's the same for libraries, the Loader only checks for extended libraries in the application folder and only loads new libraries (those that don't exist in the system folder or overwrite those) from the package folder.

So loading extended anything from a package is not possible, only libraries/helpers that overwrite existing ones or are completely new can be loaded from packages. I guess that's because the subclass prefix can be changed to whatever you want and if you prefix your packaged files with 'YOUR_' and then someone tries to use your package but has their prefix set to 'MY_' it won't work at all.

Do you see a way of solving this?