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
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | cannot_create_image-2276705-32.patch | 783 bytes | tessa bakker |
| #8 | before.png | 66.62 KB | dcam |
Comments
Comment #1
naheemsays commentedComment #2
rsharkey commentedI 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.
Comment #3
anne-pierre commentedSimlilar 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.
Comment #4
berdirHi @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?
Comment #5
anne-pierre commentedHy 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.
Comment #6
naheemsays commentedHey 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.
Comment #7
naheemsays commentedUpdating 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.
Comment #8
dcam commentedI 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.
Comment #9
swentel commentedComment #10
arla commentedI 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.
Comment #11
tonku commentedAfter 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
Comment #13
daconrilcy commentedI'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 !
Comment #14
dcam commentedComment #15
rpayanm@daconrilcy
Fixed #2351847: Rename getCacheTag() to getCacheTags() CR => https://www.drupal.org/node/2360567
Fixed in the patch.
Please use the lastest dev (drupal 8 beta 3) ;)
Comment #18
dcam commented#15 no longer applies.
Comment #19
dcam commentedRerolled #15.
Comment #20
Marvine commentedSame issue here and the patch provided by dcam (#19) works fine.
Comment #21
lalit774 commented#19 Patch does not work for me.
WAMP 2.5
PHP 5.5.12
Apache 2.4.9
mysql 5.6.17
Comment #23
legolasboPatch failed to apply on HEAD.
Rerolled patch with a small change. See attached patch.
Comment #25
giancarlosotelo commentedApplied locally and looks good.
Comment #26
alexpottPart 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.
Comment #29
tessa bakkerRe-roll, based on #23.
Comment #30
tessa bakkerTesting..
Comment #32
tessa bakkerRe-roll again.. now with ';' at the end.
Comment #34
tessa bakkerComment #44
quietone commentedThis 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!