Problem/Motivation
To reproduce the error:
On a vanilla drupal, with the Responsive image module enabled
- Create a responsive image style
- Breakpoint group: Bartik
- 1x wide > Type: select a single image > Image style: Large
- 1x narrow > Type: Do not use this breakpoint
- 1x mobile > Type: Do not use this breakpoint
- Fallback image style: - empty image -
- Modify the Article display to use format Responsive image for the image field. Do NOT select a responsive image style.
- Create an Article node with 1 image
- Display the image
Now this error is displayed:
Fatal error: Call to a member function getBreakpointGroup() on a non-object in /.../core/modules/responsive_image/responsive_image.module on line 156
Two ways to get rid of the error : Select a responsive image style in Structure > Content types > Article > Manage display. Or, select a different Fallback image style (other than - empty image -) in Configuration > Responsive image styles > your style > edit
Proposed resolution
Set a default Responsible image style when selecting Responsible image as field format.
Remaining tasks
to be determined
User interface changes
none
API changes
none
Data model changes
none
Comments
Comment #1
manishmore commentedComment #2
cilefen commentedI cannot reproduce the error. Did you select a responsive image style for display?
Comment #3
manishmore commentedyes . I have selected the responsive image for format from manage display.
Comment #4
mbayntonDuplicate of #2489162: Can configure responsive image formatter to cause fatal error
Comment #5
mbayntonI'm going to reopen this. 2489162 has the same symptoms but presumes user error. I encountered this after selecting a responsive image style, as @manishmore claims to have done as well. I was able to get it to stop by changing the selected responsive image style and saving the config again a few times. While it was occurring,
$variables['responsive_image_style_id']intemplate_preprocess_responsive_imagewas the empty string.Comment #6
sutharsan commentedI was able to reproduce this error. Updated the issue summary with it.
Comment #7
attiks commentedComment #8
attiks commentedError does not happen again, when you don't select a responsive image style, the output is changed to a regular image. Was added as part of #2489162: Can configure responsive image formatter to cause fatal error, but I guess we need to log this as well, the same as
template_preprocess_responsive_imageis logging it.Comment #9
attiks commentedLogger added
Comment #10
jelle_s#9 is RTBC for me if/when the testbot comes back green.
Comment #12
attiks commentedComment #13
alexpottThis is a task now there is no bug and therefore is not eligible for inclusion in beta at this point.
Comment #14
alexpottIt would be good to confirm that there are tests and add tests for the log message.
Comment #15
attiks commentedThere is a test as part of #2489162: Can configure responsive image formatter to cause fatal error, but is it necessary to test the Logger?
Comment #16
attiks commentedComment #17
attiks commentedQuoting myself from #15
If so we'll add a test
Comment #18
wim leersThis still needs a test.
Also, I think at this point, this won't be committed to 8.0 anymore, since 8.0.6 was the final release.
Comment #20
rainbowarrayLet's get this going again:
Comment #21
rainbowarrayComment #22
jamesdixon commentedI'm working on this.
Comment #23
jamesdixon commentedThe patch applied, and I was able generate the log message using the steps described in the issue description. Attached are screenshots of the log messages appearing. I'll start working on that test using the related issue as an example.
Comment #24
jamesdixon commentedComment #25
jamesdixon commentedTesting a patch which tests that the first part of the log message exists on admin/reports/dblog.
Comment #26
jamesdixon commentedComment #27
neclimdulI'm not sure how the patch fixes the Fatal in the IS but I can review the test.
Page fetches are pretty expensive and slow. You could just query the database.
Comment #28
jamesdixon commentedalexpott in #14 mentioned we should test the log message exists.
We had a discussion and were wondering if it's necessary to test whether the log message exists after it is logged.
In SimpleTest we couldn't find a way to assert a log message exists in a reliable way.
Comment #30
neclimdulSkimming some of the discussion it looks like the fatal was fixed elsewhere. We should probably update the Issue Summary so the commitor knows what's up.
For the test, something like this should work.
If you do that you can also drop the permission addition from the user create. From the failure it looks like it didn't work.
Comment #38
jhedstromFollowing the steps in the IS I could not reproduce this. So it's either been fixed, or the IS needs an update at this point.
Comment #45
andypostComment #47
smustgrave commentedSince this was tagged for updated IS and steps 4 years ago going to close out for now.
If still a valid task though please reopen updating the issue summary.
Thanks all!