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.
I am getting the following error when trying to go to the settings admin page (admin/config/search/xmlsitemap/settings) while memcache is enabled. Disable it and it works fine.
Fatal error: Call to undefined function xmlsitemap_link_frontpage_settings() in /vagrant/repos/dennis_distro_7/profiles/dennis_distro/modules/contrib/xmlsitemap/xmlsitemap.admin.inc on line 378
Comment | File | Size | Author |
---|---|---|---|
#6 | xmlsitemap-moved-functions-1316822-3.patch | 7.37 KB | makangus |
#1 | settings_page_memcache_fix_1316822_1.patch | 404 bytes | jarrodirwin |
Comments
Comment #1
jarrodirwin CreditAttribution: jarrodirwin commentedDue to time constraints and lack of knowledge of this module I have put in a temp fix that simply includes the xmlsitemap.xmlsitemap.inc file in the xmlsitemap.admin.inc file so that the function is always available.
This is less then ideal and the bigger issue should really be address and a proper fix added.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedSo the issue then becomes a Drupal core issue or perhaps a memcache user issue. In either case this issue does not belong to xmlsitemap.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedNo, I disagree. This is an issue with XML Sitemap code.
The xmlsitemap.xmlsitemap.inc file is only mentioned in xmlsitemap.info
files[] = xmlsitemap.xmlsitemap.inc
This only works for including Classes and Interfaces, *not* functions:
See: http://drupal.org/node/542202
But the function
xmlsitemap_link_frontpage_settings()
is not a class or interface, just a stand-alone function. This is why Drupal cannot "find" it in case of caching/Memcached or anything.The real fix is to move the stand-alone functions() in xmlsitemap.xmlsitemap.inc to xmlsitemap.module or xmlsitemap.admin.inc
Comment #4
Anonymous (not verified) CreditAttribution: Anonymous commentedImproved title
Comment #5
shrikeh CreditAttribution: shrikeh commentedVerified that the patch posted by jarrodirwin is effective: I no longer suffer fatal error with settings tab. I too have memcache module.
Comment #6
makangus CreditAttribution: makangus commentedMoved the public functions from xmlsitemap.xmlsitemap.inc to xmlsitemap.module. Memcache guys please check if this works for you.
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedWhy are we moving these functions?
I don't know that the title is improved. I set this to "won't fix" once already. Give me good reason to leave it open.
Comment #8
makangus CreditAttribution: makangus commentedDon't shoot the messenger, I am just helping out to create some patches, heehee.
@morningtime please correct me if I am wrong, I think the issue is memcache not taking the public functions into memory for the inc files, unless you do a include before you need to call the functions in the inc file.
Anyway, @earnie it's totally your call as a maintainer of what is and is not an issue worth fixing.
Comment #9
Anonymous (not verified) CreditAttribution: Anonymous commentedSo can http://drupal.org/project/memcache help here? We will not be moving functions from xmlsitemap.xmlsitemap.inc to xmlsitemap.module unless there is a good reason which I don't see yet.
Comment #10
Anonymous (not verified) CreditAttribution: Anonymous commented@makangus
No it's not memcached doing anything wrong. You must either do a include_once/require_once, or move the functions to the .module file (like #6). Because the .module file is always loaded. Drupal .inc files for clases that are included only through the .info file, only read the classes, not the functions. So if you never do a include_once/require_once, then obviously those functions are never read unless Drupal loads the class file, which you can't depend on in this case.
So #6 is the fix.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commented@#9 You definitely need to roll patch #6.
Let me explain again:
You load xmlsitemap.sitemap.inc file ONLY through the module.info file. Which only loads if the specified Class is required (lazy loading).
Since the Class is not called, the file is not read, and the funtions are not in memory.
Solution: move functions to .module file (patch #6) OR do a specific require_once/include_once where needed.
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedLong story short: you can't mix regular functions with Drupal Class files (they are lazy-loaded). You need to move them to .module, or use module_load_include() to deliberately load the .inc file.
Comment #13
Dave ReidWhy in the heck do we have hook_hook_info() then?
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedAnd why does the module work without memcache in the way? To say it isn't a memcache issue when the module works just fine without memcache is a bogus answer unless you can explain the differences of with and without memcache.
Comment #15
girishmuraly CreditAttribution: girishmuraly commentedDuplicate of #1392710: Call to undefined function xmlsitemap_link_frontpage_settings(). Turns out it was a problem with XML Sitemap itself.