I have just installed Drupal 8 alpha 12 on a wamserver (Apache 2.4, php 5.5, Windows 7, sqlite). After carrying out a standard install and attempting to create an article (normal text, 1 taxonomy term), I get the following error:

Fatal error: Call to a member function getCacheTag() on a non-object in C:\wamp\www\drupal-8.0-alpha12\core\modules\image\src\Plugin\Field\FieldFormatter\ImageFormatter.php on line 121

Call Stack
# Time Memory Function Location
1 0.0010 244928 {main}( ) ..\index.php:0
2 0.0100 952992 drupal_handle_request( ) ..\index.php:17
3 0.1970 13492816 Drupal\Core\DrupalKernel->handle( ) ..\bootstrap.inc:1388
4 0.2230 14262224 Drupal\Core\HttpKernel->handle( ) ..\DrupalKernel.php:306
5 0.2240 14263720 Symfony\Component\HttpKernel\HttpKernel->handle( ) ..\HttpKernel.php:44
6 0.2240 14264216 Symfony\Component\HttpKernel\HttpKernel->handleRaw( ) ..\HttpKernel.php:66
7 0.4110 19503872 call_user_func_array:{C:\wamp\www\drupal-8.0-alpha12\core\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php:126} ( ) ..\HttpKernel.php:126
8 0.4110 19504320 Drupal\Core\Controller\HtmlPageController->content( ) ..\HttpKernel.php:126
9 0.8510 32146496 Drupal\Core\Controller\HtmlControllerBase->createHtmlFragment( ) ..\HtmlPageController.php:54
10 0.8510 32147096 Drupal\Core\Controller\HtmlControllerBase->drupalRender( ) ..\HtmlControllerBase.php:75
11 0.8510 32147144 drupal_render( ) ..\HtmlControllerBase.php:105
12 0.8550 32228752 _theme( ) ..\common.inc:3371
13 0.8630 32686368 template_preprocess_views_view( ) ..\theme.inc:573
14 0.8630 32686528 Drupal\views\Plugin\views\style\StylePluginBase->render( ) ..\views.theme.inc:27
15 0.8630 32688184 Drupal\views\Plugin\views\style\StylePluginBase->renderGroupingSets( ) ..\StylePluginBase.php:428
16 0.8640 32691664 drupal_render( ) ..\StylePluginBase.php:468
17 0.8640 32693056 call_user_func:{C:\wamp\www\drupal-8.0-alpha12\core\includes\common.inc:3334} ( ) ..\common.inc:3334
18 0.8640 32693120 Drupal\Core\Entity\EntityViewBuilder->build( ) ..\common.inc:3334
19 0.8640 32693760 Drupal\Core\Entity\EntityViewBuilder->buildMultiple( ) ..\EntityViewBuilder.php:212
20 0.8710 32705368 Drupal\node\NodeViewBuilder->buildComponents( ) ..\EntityViewBuilder.php:256
21 1.0521 36338360 Drupal\Core\Entity\EntityViewBuilder->buildComponents( ) ..\NodeViewBuilder.php:31
22 1.0751 36380040 Drupal\entity\Entity\EntityViewDisplay->buildMultiple( ) ..\EntityViewBuilder.php:313
23 1.1251 37156248 Drupal\Core\Field\FormatterBase->view( ) ..\EntityViewDisplay.php:233
24 1.1251 37156624 Drupal\image\Plugin\Field\FieldFormatter\ImageFormatter->viewElements( ) ..\FormatterBase.php:74

Comments

naheemsays’s picture

Issue summary: View changes
rsharkey’s picture

I am receiving this same issue with drupal-8.0-alpha12 with Wampserver "wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b."

There must be an apache mod or PHP issue within Wampserver 2.5 that this version of Drupal 8 does not play nicely with.

anne-pierre’s picture

Simlilar issue and situation.

I am able to create a taxonomy, a user profile and a node. They can be edited. But viewing drives the error:

( ! ) Fatal error: Call to a member function getCacheTag() on a non-object in C:\wamp\www\domain\core\modules\image\src\Plugin\Field\FieldFormatter\ImageFormatter.php on line 121

This is true as admin, as user with a role, and as anonymous.

berdir’s picture

Hi @nbz ;)

That looks like the image style is missing...

Check the image style configuration of the formatter of that field and what image styles are available on the system. I guess we're not checking if that exists, which we should do, but this shouldn't happen in a default installation?

anne-pierre’s picture

Hy Berdir,
Thanks for the pointer, indeed the image style was absent. I am able to create the image style, but unable to edit the style. I tried a new install of D8. All I get is a error message saying "server over load." But then I am building the site locally.

naheemsays’s picture

Hey Berdir.

Tested today with Alpha 13.

It seems no image styles were created by default (I assume that some image styles are still meant to be created upon install - default, medium, small etc).

As mentioned by Anne-Pierre, it is possible to create image styles, but the management pages that you are rediredted to after creation do not work - "The connection was reset".

There are no log messages.

naheemsays’s picture

Title: Fatal error: Call to a member function getCacheTag() on a non-object in ...\core\modules\image\src\Plugin\Field\FieldFormatter\ImageFormatter.php on line 121 » Cannot create image styles on Wamp server (Apache/windows)
Version: 8.0-alpha12 » 8.x-dev

Updating title.

But even without a formatter should the page be causing a fatal error? the display settings page states that no formatter would be used.

dcam’s picture

StatusFileSize
new66.62 KB

I also have all of these same issues: can't view articles, getCacheTag() error, can't view a custom image style, no image styles created by the default profile. I've attached an image of my stack trace.

I don't want to jump to conclusions, but this might be the same issue as #2275499: Unable to install Drupal on Windows. I get the same crash report in the Event Viewer about httpd.exe when any of these errors occur, including on installation. If you look at the other issue, you'll see a list of modules that were correctly installed. Image is not one of them. I think the crash on installation may be happening when Image is being installed, maybe when it tries to create the default styles.

swentel’s picture

Component: field system » image system
arla’s picture

Status: Active » Needs review
StatusFileSize
new757 bytes

I get the same error in a different case. Not sure about the steps needed to reproduce but I'm on Mac and this is not during install. Either way the fatal error should probably be avoided.

tonku’s picture

Status: Needs review » Reviewed & tested by the community

After applying the patch I didn't get the previously mentioned fatal error anymore. I don't know if this solved the initial problem but because of the check in the patch, at least I'm able to view content now, thanks!

Environment:
Windows 7
WampServer Version 2.5
Apache 2.4.9 (Win64) PHP 5.5.12
MySQL 5.6.17
Drupal 8.0.0-beta2

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: image_style_cache_tags-2276705-10.patch, failed testing.

daconrilcy’s picture

I'had same error "Fatal error: Call to a member function getCacheTag() on a non-object in C:\wamp\www\drupal-8.0-alpha12\core\modules\image\src\Plugin\Field\FieldFormatter\ImageFormatter.php on line 121"

I Resolve the problem with 2 corrections :
1 - I'd replace getCacheTag() with getCacheTags() in every file where getCacheTag is present (in \Core)
2 - In : "C:\wamp\www\drupal-8.0-alpha12\core\modules\image\src\Plugin\Field\FieldFormatter\ImageFormatter.php" I'd Replace on line 121 :
"$cache_tags = $image_style->getCacheTag();"
with
"
if (isset($image_style)) {
$cache_tags = $image_style->getCacheTags();
}
"
And all work well !

dcam’s picture

Issue tags: +Needs reroll
rpayanm’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new759 bytes

@daconrilcy

1 - I'd replace getCacheTag() with getCacheTags() in every file where getCacheTag is present (in \Core)

Fixed #2351847: Rename getCacheTag() to getCacheTags() CR => https://www.drupal.org/node/2360567

2 - In : "C:\wamp\www\drupal-8.0-alpha12\core\modules\image\src\Plugin\Field\FieldFormatter\ImageFormatter.php" I'd Replace on line 121 :
"$cache_tags = $image_style->getCacheTag();"
with
"
if (isset($image_style)) {
$cache_tags = $image_style->getCacheTags();
}
"

Fixed in the patch.

Please use the lastest dev (drupal 8 beta 3) ;)

mgifford queued 15: 2276705-15.patch for re-testing.

Status: Needs review » Needs work

The last submitted patch, 15: 2276705-15.patch, failed testing.

dcam’s picture

Issue tags: +Needs reroll

#15 no longer applies.

dcam’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new759 bytes

Rerolled #15.

Marvine’s picture

Same issue here and the patch provided by dcam (#19) works fine.

lalit774’s picture

#19 Patch does not work for me.
WAMP 2.5
PHP 5.5.12
Apache 2.4.9
mysql 5.6.17

legolasbo’s picture

StatusFileSize
new878 bytes

Patch failed to apply on HEAD.

Rerolled patch with a small change. See attached patch.

The last submitted patch, 19: 2276705-19-image-styles.patch, failed testing.

giancarlosotelo’s picture

Status: Needs review » Reviewed & tested by the community

Applied locally and looks good.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Part of this is a duplicate of https://www.drupal.org/node/2479487. You get this error if you delete an image style. But this issue seems to suggest that when installing the standard profile image styles are not created. I can not reproduce that.

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.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should 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.

tessa bakker’s picture

StatusFileSize
new926 bytes

Re-roll, based on #23.

tessa bakker’s picture

Status: Needs work » Needs review

Testing..

Status: Needs review » Needs work

The last submitted patch, 29: cannot_create_image-2276705-29.patch, failed testing.

tessa bakker’s picture

Status: Needs work » Needs review
StatusFileSize
new783 bytes

Re-roll again.. now with ';' at the end.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.

tessa bakker’s picture

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

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.

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.

quietone’s picture

Status: Needs review » Closed (outdated)
Issue tags: +Bug Smash Initiative

This issue was filed against Drupal 8 alpha 2. #15 suggests this was fixed in Drupal 8 beta 3 and in #26 there is a report that this root cause is not reproducible. Because of that and the lack of activity here, as in no comments confirming that the problem still exists, I am closing this as outdated.

If this is incorrect reopen the issue, by setting the status to 'Active', and add a comment explaining what still needs to be done.

Thanks!