When hitting admin/settings/xmlsitemap/settings, I get the following error:

Fatal error: Call to undefined function xmlsitemap_link_frontpage_settings() in /srv/drupal/sites/example.com/modules/xmlsitemap/xmlsitemap.admin.inc on line 387

It seems that the function definitions in xmlsitemap.xmlsitemap.inc are not being picked up by Drupal 6. It is also bad form to mix several class and function definitions in the same file.

Moving the function definitions (including xmlsitemap_link_frontpage_settings() ) to the .module file seems to fix things at first glance.

Does anyone the exact cause of the problem, and whether that is a valid fix?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mshick’s picture

I'm having the same problem. On one site things are working fine, on two others I get a whitescreen. In a different environment the same code for those sites is fine.

Very odd issue.

mshick’s picture

I added the following to line 281, just after "function xmlsitemap_settings_form()":

module_load_include('inc', 'xmlsitemap', 'xmlsitemap.xmlsitemap');

And it solved the problem.

I suspect that files included in the info file are perhaps not reliably included... Really not sure about that one.

Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)

You should check the 2.x-dev version to see if the issue is still present.

antoniogr’s picture

FileSize
478 bytes

Thanks mshick!. Find attached a patch with the solution of comment #2

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Needs work

Does this only affect 6.x or do we need a patch for 7.x? The patch file name isn't formatted correctly is the reason I flagged it as needs work. See http://drupal.org/node/707484 which explains how to create a patch.

AlexanderPop’s picture

#2 works for D7 as well

Anonymous’s picture

Version: 6.x-2.0-rc1 » 7.x-2.x-dev

Then lets get a patch for D7.

johan.gant’s picture

FileSize
531 bytes

The patch listed above didn't apply on 7.x-2.x or 7.x-2.0-rc1. Attaching a new patch file that should.

Anonymous’s picture

Status: Needs work » Needs review

Oh, testbot, please check the patch.

Jonathan Webb’s picture

Status: Needs review » Reviewed & tested by the community
Dave Reid’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

I committed a similar patch that uses module_load_all_includes('inc', 'xmlsitemap') so that it works for any other modules that implement hook_xmlsitemap_link_info(). http://drupalcode.org/project/xmlsitemap.git/commit/031bae4

Dave Reid’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

helmo’s picture

Status: Closed (fixed) » Needs work
FileSize
6.73 KB

Sorry to re-open this, but the fix from #11 is not sufficient.

module_load_include('inc', 'xmlsitemap', 'xmlsitemap.xmlsitemap');

This code will look for a file called xmlsitemap.inc in the directory of every module.
ref: http://api.drupal.org/api/drupal/includes%21module.inc/function/module_l...

But instead the function we're seeking is in xmlsitemap.xmlsitemap.inc.

So I think the title in #1316822: Move xmlsitemap.xmlsitemap.inc functions() to correct location was a good one, I think the patch in http://drupal.org/node/1316822#comment-6765530 would do the job.

That patch no-longer applied, and I think moving the funcitons to xmlsitemap.inc would be slightly better then to xmlsitemap.module

Please review.

Dave Reid’s picture

Status: Needs work » Closed (fixed)

This code will look for a file called xmlsitemap.inc in the directory of every module.
ref: http://api.drupal.org/api/drupal/includes%21module.inc/function/module_l...
But instead the function we're seeking is in xmlsitemap.xmlsitemap.inc.

No, you misunderstand that function. It's loading a file with the extension .inc, from the module 'xmlsitemap', and with the name 'xmlsitemap.xmlsitemap'. So in result it will load sites/all/modules/xmlsitemap/xmlsitemap.xmlsitemap.inc as designed.

Please file a new follow-up issue rather than re-opening a closed issue if you do not think this is correct.

helmo’s picture

saitanay’s picture

Status: Closed (fixed) » Needs work

Using version 7.x-2.0-rc2 , which seems to have the fix for this issue included.

But still seeing the error when settings for the module are saved:
[xx-xxx-2013 xx:xx:xx] PHP Fatal error: Call to undefined function xmlsitemap_link_frontpage_settings() in /xxx/xxx/xxxx/xxxx/xxx/sites/all/modules/xmlsitemap/xmlsitemap.admin.inc on line 375

Anonymous’s picture

Status: Needs work » Closed (fixed)

See Dave's comment in #15 and helmo's comment in #16. You'll need to test with the -dev version to determine if it is fixed or not.

Exploratus’s picture

include_inc_file-1392710.patch also worked for me. I was getting an error page using 7, RC2.

cmseasy’s picture

Issue summary: View changes

I had the same issue with version 7.x-2.0 and current dev: ONLY(!) in a multisite drupal, not in a single site environment
Patch #14 solved it.
I use current dev with patch #14 in my multisite drupal.

cmseasy’s picture

Status: Closed (fixed) » Active

Reopen because off #20

Fatal error: Call to undefined function xmlsitemap_link_frontpage_settings() in /home/public_html/drupal-7/sites/all/modules/xmlsitemap/xmlsitemap.admin.inc on line 375

  • Dave Reid committed 031bae4 on 8.x-1.x
    Issue #1392710 by Dave Reid, antoniogr, johan gant: Ensure all...
mrmikedewolf’s picture

There is a file missing. That is the problem.

Dave Reid’s picture

Status: Active » Closed (fixed)

That file is already listed below in the .info file, so now you're duplicating it.