Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 298730

Fatal error "getCacheTags() on null" on admin/content Views page

$
0
0

Problem/Motivation

/admin/content view is not working - fatal error.

Dblog reports 3 different errors:
Error: Call to a member function getCacheTags() on null in Drupal\views\Plugin\views\query\Sql->getCacheTags() (Line 1677 in /app/web/core/modules/views/src/Plugin/views/query/Sql.php)

Error: Call to a member function getCacheMaxAge() on null in Drupal\views\Plugin\views\query\Sql->getCacheMaxAge() (Line 1694 in /app/web/core/modules/views/src/Plugin/views/query/Sql.php)

Error: Call to a member function getCacheTags() on null in Drupal\views\Plugin\views\cache\CachePluginBase->getRowCacheTags() (Zeile 320 in /app/web/core/modules/views/src/Plugin/views/cache/CachePluginBase.php)

The issue lies in web/core/modules/views/src/Plugin/views/query/Sql.php in getAllEntities(line 1707) method, where $row->_relationship_entities can be NULL but are not checked if emtyp (as $row->_entity is).

Steps to reproduce

It is related to our content so I'm not sure how exactly to reproduce. On some of our migrated nodes an entity reference field is missing.

Proposed resolution

I would actually put a check into the 3 methods that are throwing php errors to check if the entity is not empty and then perform caching operations (merging tags or getRowCacheTags).


Viewing all articles
Browse latest Browse all 298730

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>