Codeigniter: loading helper not case sensitive

Created on 9 Nov 2016  路  6Comments  路  Source: bcit-ci/CodeIgniter

I try to load a helper module which lives in a camelcased path

$this->load->helper('foo/FooBar/Reporting/reporting');

And it can't be found. On my case insensitive system it works, on my case sensitive it doesn't. The shown error reads:

Unable to load the requested file: helpers/foo/foobar/reporting/reporting_helper.php

Is there any preprocessing of the path, which breaks case? What can I do to get proper case sensitivity?

thanks

Bug

Most helpful comment

Please test with the commit above.

All 6 comments

Update: I found that the Loader class explicitly transforms paths to lower case (core/Loader.php@_ci_prep_filename). Is there any good reason for that?
I would argue, that the developer has to be responsible for the correct case in loading (via Load) and saving on the filesystem.

Yes, there is a reason for that - we try to enforce our naming conventions where it is appropriate.

You do have a point though. _ci_prep_filename() is only supposed to be applied to _file_ names, directories in the path excluded.

But I have to ask - why do you want to have those subdirs? I can't imagine anyone needing tens of helpers, which would be the only reason to organize them in such a way IMO.

We have something like 30+ helpers. We tend to create many small helpers for special use cases.

Excluding the directory parts from _ci_prep_filesname() would be perfect for me 馃憤

Thanks!

Well, that's what I'll do because that's how it is supposed to work in the first place.

But I have to say, having 30+ helpers is a sign of MAJOR flaws in your design.

Please test with the commit above.

Works like a charm,
thanks for the hint regarding "too many helpers". I will think about this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

erikk1986 picture erikk1986  路  3Comments

al-ramadhan picture al-ramadhan  路  6Comments

Tjoosten picture Tjoosten  路  6Comments

rjdjohnston picture rjdjohnston  路  4Comments

it-can picture it-can  路  5Comments