Download & Extend

Call to undefined function xmlsitemap_link_frontpage_settings()

Project:XML sitemap
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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?

Comments

#1

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.

#2

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.

#3

Status:active» postponed (maintainer needs more info)

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

#4

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

AttachmentSizeStatusTest resultOperations
patch_1392710.patch478 bytesIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch patch_1392710.patch. Unable to apply patch. See the log in the details link for more information.View details

#5

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.

#6

#2 works for D7 as well

#7

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

Then lets get a patch for D7.

#8

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.

AttachmentSizeStatusTest resultOperations
include_inc_file-1392710.patch531 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 525 pass(es).View details

#9

Status:needs work» needs review

Oh, testbot, please check the patch.

#10

Status:needs review» reviewed & tested by the community

include_inc_file-1392710.patch worked for me.

#11

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

#12

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

Committed the same to 6.x-2.x.
http://drupalcode.org/project/xmlsitemap.git/commit/366b29f

#13

Status:fixed» closed (fixed)

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

#14

Status:closed (fixed)» needs work

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

<?php
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_load_include/7

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.

AttachmentSizeStatusTest resultOperations
xmlsitemap.code_.1392710-14.patch6.73 KBIgnored: Check issue status.NoneNone

#15

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.

#16

#17

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

#18

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.

nobody click here