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.
Fatal error: Call to a member function getGranularity() on boolean in /Users/serenity/Sites/d8.local/modules/calendar/src/CalendarHelper.php on line 850
Steps to reproduce
- Create a view using the
calendar_config_field.yml
template - Add a new content type
- Add a new field (any field)
The issue is resolved after doing a cache rebuild.
Comment | File | Size | Author |
---|---|---|---|
#10 | fatal_error_using-2785771-10.patch | 1.92 KB | geertvd |
#3 | calendar-2785771-getGranularity_non_object-3.patch | 3.72 KB | kerby70 |
#2 | calendar-2785771-getGranularity_non_object-2.patch | 579 bytes | kerby70 |
Comments
Comment #2
kerby70 CreditAttribution: kerby70 at FFW commentedComment #3
kerby70 CreditAttribution: kerby70 at FFW commentedAfter running into another error related to the related object not existing, here is another patch to consider.
Comment #4
esteinborn CreditAttribution: esteinborn commentedI was getting an error whenever I added or removed a new content type, and could only clear the error after a cache clear.
my error was this:
[Mon Aug 29 10:53:20.786644 2016] [:error] [pid 22454] [client 172.20.6.62:62045] PHP Fatal error: Call to a member function getGranularity() on boolean in /var/www/html/modules/calendar/src/CalendarHelper.php on line 853
The patch in #3 fixed this issue for me.
Thanks for the patch.
Comment #5
natanaugusto CreditAttribution: natanaugusto as a volunteer and commentedComment #6
paddy.doyle CreditAttribution: paddy.doyle commentedThe patch in #3 fixed this issue for me too. Thanks!
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedSo it seems like you are missing an argument plugin, but I'm not able to reproduce this with the usage of the suggested views template.
Could you specify what the exact steps to reproduce this are?
Comment #8
paddy.doyle CreditAttribution: paddy.doyle commentedFor what it's worth, the latest 8.x-1.x-dev (2016-11-26) exhibits the bug again (the patch in #3 above wasn't applied I guess).
The bug is intermittent; as a guess it might occur after creating an instance of a new content type, but am not sure. Without applying the patch, doing a
drush cache-rebuild
fixes the problem temporarily; but it does eventually occur again.Comment #9
bobemoe CreditAttribution: bobemoe commentedConfirming this issue with the latest 8.x-dev as of today. I haven't applied any patches.
It seems quite repeatable to me, its appears to be after adding a new content type, however I think its actually after adding a new field to an existing content type; just adding a new empty content type (with default body field) doesn't trigger the bug, returning to the content type and adding an additional field then triggers the bug. Even non date related fields on unused content types seem to trigger it.
Clearing the cache always fixes the problem.
Comment #10
geertvd CreditAttribution: geertvd at XIO commentedSo I was able to reproduce this issue after doing the steps to reproduce mentioned in #9.
The patch in #3 just masks the real issue though, that the argument is missing. Let's try to figure out why that happens.
After some debugging I noticed that the only argument handler which seems to be broken is the week argument handler (which is also the only one we are providing).
Looking at the
hook_field_views_data_alter
incalendar.views.inc
we can actually see that is is incorrectly prefixed withcalendar_datetime
.Fixing the hook prefix fixed the issue for me, I guess the incorrect hook was only being called after a cache rebuild and not after a field was added, which resulted in the missing argument handler.
Besides the prefix fix I did some minor changes in the custom views argument handers to improve readability and fix some coding standards.
Comment #11
bobemoe CreditAttribution: bobemoe commentedI've applied the patch from #10 and done a quick test (added a field) and it appears to have fixed the issue.
I will report back if I find the error occurs again. Thanks.
Comment #12
AlejandroSalinas9294 CreditAttribution: AlejandroSalinas9294 commentedCan confirm #10 fix the issue for me.
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous at XIO commentedLooks good to me. Great catch.
Pushed to 8.x-1.x. Thanks all!