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.
When I try to enable the XML SiteMap module, I get the following nasty error screen. The module seems to enable after visiting the the Extend and Configuration pages but does not provide a positive user experience.
Comment | File | Size | Author |
---|---|---|---|
#10 | fatal-error-fix-2505903-10.patch | 1.74 KB | benelori |
#8 | fatal-error-fix-2505903-8.patch | 1.84 KB | benelori |
| |||
#1 | xmlsitemap-enablecrash-2505903-1.patch | 1.97 KB | deaconblues |
Screen Shot 2015-06-14 at 11.00.30 AM.png | 399.3 KB | deaconblues |
Comments
Comment #1
deaconblues CreditAttribution: deaconblues commentedSee the attached patch for the fixed that worked for me. Adding a null value check for the $this variable in the affected area. I'm not getting the crash at this point.
Comment #2
deaconblues CreditAttribution: deaconblues commentedComment #3
deaconblues CreditAttribution: deaconblues commentedComment #4
deaconblues CreditAttribution: deaconblues commentedThis patch is ready for review. Can someone check it out and let me know if it works?
Comment #5
paulmckibbenHi deaconblues,
Thanks for your patch. I'm trying to reproduce your original issue by enabling the xmlsitemap module on Drupal 8.0.0 beta12, and I don't experience your issue. Can you tell me the exact steps you took to encounter the issue?
That said, looking at the code, there is indeed a problem: $this will always be null, because the function _xmlsitemap_get_blurb() is not a method in an object. So your patch does not actually go far enough. Replace each instance of:
with:
And that should do the trick!
Comment #6
deaconblues CreditAttribution: deaconblues commentedI was able to reproduce this using Drupal core 8.0.0-beta11 and XML sitemap 8.x-1.x-dev (2015-May-15). When enabling the XML Sitemap module, I received the screenshot above but everything seemed to be OK if I just navigated to the rest of the configuration pages.
I noticed that $this was always null but just added the null check as I assumed that there would be additional functionality coming that would use the variable in later releases. If this has been corrected in beta12 and the 2015-Jun-30 release of XML Sitemap then we can close this ticket out as fixed.
Comment #7
afoster CreditAttribution: afoster commentedConfirming This error with beta-15 and latest dev (Downloaded Oct 1) via $drush dl xmlsitemap-8.x-1.x--dev
When visiting - http://dww.dev/admin/config/search/xmlsitemap
"Fatal error: Using $this when not in object context in /XXXXXX/modules/xmlsitemap/xmlsitemap.module on line 2272"
I'm on PHP 5.6.10
Comment #8
benelori CreditAttribution: benelori commentedThe problem is as described #5. Uploaded a patch mirroring that.
Comment #9
benelori CreditAttribution: benelori commentedI uploaded a patch with the wrong path, so it won't apply for sure. I'll be back shortly with a fixed patch.
Comment #10
benelori CreditAttribution: benelori commentedComment #11
swentel CreditAttribution: swentel commentedThat would probably work out well, however, xmlsitemap_help() is out of sync completely, so we'd better fix that along the way too.
Comment #12
deaconblues CreditAttribution: deaconblues commentedI tried the patch that benelori uploaded on version 8.05 and it seems to have cleared the immediate crash in that part of the module. Can we pass this patch and get it applied to the Dev branch?
Comment #13
pguillard CreditAttribution: pguillard commentedWhat is the plan to get xmlsitemap_help() in sync ?
If I can be helpful... Because it would be good to commit this one !
Comment #14
pguillard CreditAttribution: pguillard commentedComment #15
juampynr CreditAttribution: juampynr at Lullabot commentedThis got fixed at #2459595: Rebuild has error when Language enabled. Marking as duplicate and closing.
Comment #18
amateescu CreditAttribution: amateescu for Chapter Three commented