Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After submit the form, I've got following error:
Fatal error: require_once() [function.require]: Failed opening required 'sites/all/modules/contributions/pathauto/pathauto.inc' (include_path='.;D:\wamp\bin\php\php5.2.6\pear') in D:\bro\workspace\Websites\XComKids\trunk\sites\all\modules\contributions\pathauto\pathauto.module on line 74
http://drupal.org/node/114774#module_load_include
Changed:
function _pathauto_include() {
$pathauto_path = drupal_get_path('module', 'pathauto');
require_once("$pathauto_path/pathauto.inc");
require_once("$pathauto_path/pathauto_node.inc");
require_once("$pathauto_path/pathauto_taxonomy.inc");
require_once("$pathauto_path/pathauto_user.inc");
to:
function _pathauto_include() {
module_load_include('inc', 'pathauto', 'pathauto');
module_load_include('inc', 'pathauto', 'pathauto_node');
module_load_include('inc', 'pathauto', 'pathauto_taxonomy');
module_load_include('inc', 'pathauto', 'pathauto_user');
The same issue on 5.x: #337615: require_once failure on cron with modules that have a register_shutdown_function
Comments
Comment #1
apadernoI rather prefer to use
module_load_include()
in cases like this.The original code doesn't work because it looks for the files in the wrong directory. The correct code should be
That is what
module_load_include()
does.The paths passed to
require
,require_once
,include
, andinclude_once
should always start with ./.Comment #2
gregglesWe don't create multiple issues if the problem is present in multiple branches. We fix it in them all in the same issue.
Marking this a duplicate of #337615: require_once failure on cron with modules that have a register_shutdown_function.
Comment #3
kenorb CreditAttribution: kenorb commentedYes, that's true, but we can still use module_load_include, what's for this function was created?
greggles:
thanks, but many people say to create different issues for different branches, so I'm confused now,
but it's ok.
This one: http://drupal.org/files/issues/pathauto_include_optimization.patch seems to be good solution.
In my case it was called from shutdown as well.