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

manishmore’s picture

Issue summary: View changes
cilefen’s picture

Issue tags: -Drupal 8.x

I cannot reproduce the error. Did you select a responsive image style for display?

manishmore’s picture

yes . I have selected the responsive image for format from manage display.

mbaynton’s picture

Status: Active » Closed (duplicate)
mbaynton’s picture

Status: Closed (duplicate) » Active

I'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'] in template_preprocess_responsive_image was the empty string.

sutharsan’s picture

Title: Fatal error: Call to a member function getBreakpointGroup() on a non-object in /home/dxgx/www/core/modules/responsive_image/responsive_image.module on line 142 » Call getBreakpointGroup() on a non-object in responsive_image.module
Issue summary: View changes

I was able to reproduce this error. Updated the issue summary with it.

attiks’s picture

Issue tags: +Needs tests
attiks’s picture

Error 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_image is logging it.

attiks’s picture

Status: Active » Needs review
StatusFileSize
new627 bytes

Logger added

jelle_s’s picture

#9 is RTBC for me if/when the testbot comes back green.

Status: Needs review » Needs work

The last submitted patch, 9: i2536812-9.patch, failed testing.

attiks’s picture

Status: Needs work » Reviewed & tested by the community
alexpott’s picture

Category: Bug report » Task
Status: Reviewed & tested by the community » Postponed
Issue tags: +D8 patch release target

This is a task now there is no bug and therefore is not eligible for inclusion in beta at this point.

alexpott’s picture

It would be good to confirm that there are tests and add tests for the log message.

attiks’s picture

There is a test as part of #2489162: Can configure responsive image formatter to cause fatal error, but is it necessary to test the Logger?

attiks’s picture

Status: Postponed » Needs review
attiks’s picture

Quoting myself from #15

but is it necessary to test the Logger?

If so we'll add a test

wim leers’s picture

Priority: Normal » Minor
Status: Needs review » Needs work

This 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.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

rainbowarray’s picture

Let's get this going again:

  1. Check if patch applies.
  2. If not, reroll.
  3. If it applies, then work on adding a test for this. Check the related issue for an example.
rainbowarray’s picture

Version: 8.1.x-dev » 8.2.x-dev
jamesdixon’s picture

Assigned: Unassigned » jamesdixon

I'm working on this.

jamesdixon’s picture

The 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.

jamesdixon’s picture

Issue tags: +neworleans2016, +#nola2016
jamesdixon’s picture

StatusFileSize
new2.12 KB

Testing a patch which tests that the first part of the log message exists on admin/reports/dblog.

jamesdixon’s picture

Status: Needs work » Needs review
neclimdul’s picture

I'm not sure how the patch fixes the Fatal in the IS but I can review the test.

+++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php
@@ -214,6 +215,10 @@ protected function doTestResponsiveImageFieldFormatters($scheme, $empty_styles =
+    // The test field was not configured. This should be logged.
+    $this->drupalGet('admin/reports/dblog');
+    $this->assertText('No responsive image style defined');
+

Page fetches are pretty expensive and slow. You could just query the database.

jamesdixon’s picture

Assigned: jamesdixon » Unassigned
Status: Needs review » Needs work

alexpott 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.

The last submitted patch, 25: log_field_no_config-2536812-25.patch, failed testing.

neclimdul’s picture

Skimming 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.

$this->assertNotEqual([], $this->getDatabaseConnection()
  ->query("SELECT wid FROM {watchdog} WHERE message = 'No responsive image style defined'")
  ->fetchAll());

// or
$results = $this->getDatabaseConnection()
  ->query("SELECT wid FROM {watchdog} WHERE message = 'No responsive image style defined'")
  ->fetchAll();
$this->assertTrue(count($results) > 0);

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.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

jhedstrom’s picture

Status: Needs work » Postponed (maintainer needs more info)
Issue tags: +Needs issue summary update

Following 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.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andypost’s picture

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)
Issue tags: +triaged-tasks

Since 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!