cancel
Showing results for 
Search instead for 
Did you mean: 

include_once no longer supported?

include_once no longer supported?

I have an extension that has been working for a couple years now, but my latest submission fails code review because of an "include_once" statement. The error thrown is: 

 

"include_once" statement detected. File manipulations are discouraged.

 

I have tried different variations of the above including "require_once" and "eval()" but still get similar errors.

 

The use case is that we give users the ability to extend the functionality of our plugin by including a secondary php file that will add additional data to the output of the plugin. There is a configuration field in the admin panel that allows users the option to include a path to a file, which will be loaded in from the extension. This has been supported and worked for several versions until this latest submission. The code doing this is: 

 

include_once $this->scopeConfig->getValue(
'tealium_tags/general/udo',
\Magento\Store\Model\ScopeInterface:Smiley FrustratedCOPE_STORE,
$store->getId()
);

 

The sniffer doesn't like the dynamic reference to the file, but even when I change this to a direct reference to a file it still errors. 

 

Is there a way to load a file using a dynamic file path configured in the admin panel? Is include_once and require_once no longer supported?

 

Thanks