Currently it seems that the include_once statement in a feature's *.module file is generated as

include_once 'MYFEATURE.features.inc';

My IDE (EA Extended plugin for PhpStorm) complains that this is bad practice ("Untrusted files inclusion") - and I agree.
Why depend on include path, if we can instead use __DIR__ or dirname(__FILE__) to be more reliable and transparent?

include_once __DIR__ . '/MYFEATURE.features.inc';

or if we want to support PHP < 5.3 (no idea if we care):

include_once dirname(__FILE__) . '/MYFEATURE.features.inc';

Comments

donquixote created an issue.

donquixote’s picture

And, just saying (for random visitors):
If anyone considers module_load_include() for this: Don't.
This function is only useful for inclusion of *other* modules. If we are already within the same module, __DIR__ is faster and more reliable and transparent.