Hi
Not sure if this is a bug, or if I'm just using Views wrong. I couldn't find any issues on this, why I'm assuming the latter.
If enabling time based caching for a View, and one of the nodes in this view is deleted, the pages displaying the views dies with the following error:
• Notice: Undefined index: 4 in views_plugin_row_node_view->render() (line 102 of/www/drupal7/sites/all/modules/views/modules/node/views_plugin_row_node_view.inc).
• Notice: Undefined property: stdClass::$type in _node_extract_type() (line 370 of/www/drupal7/modules/node/node.module).
• Notice: Undefined property: stdClass::$nid in node_build_content() (line 1359 of/www/drupal7/modules/node/node.module).
• EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids()(line 7501 of /www/drupal7/includes/common.inc).
Steps to reproduce:
1.) Enable the "Front page" view.
2.) Edit it and add time-based caching 1hour/0sec under the advanced section.
3.) Create a node (e.g. Article) and check "Promote to frontpage"
4.) Goto /frontpage to see that view.
5.) Delete the node
6.) Goto /frontpage and observe the error.
It makes sense of course, that views is unable to find the deleted node. But that it results in an exception is not very neat. It may be argued where the bug lies, views or core. Clearing the cache makes the problem go away, but if this is necessary it should somehow happen automatically (although I suspect that could prevent the cache on certain sites from ever getting properly "warm").
Then again, I might just be using it wrong.
Any suggestions?
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | node-row-render.patch | 461 bytes | gielfeldt |
| #3 | views_caching_error.png | 30.5 KB | denny84 |
| #2 | views_caching_error.png | 30.5 KB | denny84 |
Comments
Comment #1
denny84 commentedConfirmed, "Rendered Output" option when set to "Never Cache" creates this error.
Comment #2
denny84 commentedAttachment
Comment #3
denny84 commentedAttachment
Comment #4
gielfeldt commentedThe file: modules/node/views_plugin_row_node_rss.inc has this code (in views_plugin_row_node_rss->render()):
Whereas the file: modules/node/views_plugin_row_node_view.inc does not.
This means the rss style (e.g. on /rss.xml) is immune to this error, but regular node view is not.
The attached patch implements the check in modules/node/views_plugin_row_node_view.inc. If the node is deleted, it will output an empty div, so this is probably not the best solution (e.g. messes up odd/even rows, etc). However, it's better than the current way it works.
I'm thinking the best solution would be to weed out invalid entries in the pre_render() method? But this requires $values to passed by reference all the way through.
Comment #5
brayo4 commentedHad similar issue trying to use views accordion on a view. when i changed the format to something else....error gone. Don't know what to make of it. using views and views accordion -dev.
Comment #6
brayo4 commentedHad similar issue trying to use views accordion on a view. when i changed the format to something else....error gone. Don't know what to make of it. using views and views accordion -dev.
Comment #7
johnvThe following 2 issues may solve the problem:
#1930324: Time-based caching does not work properly when it is set to 'Never cache'
#652610: Time-based output caching is writing cache when it is set to "never cache"
Comment #8
gielfeldt commentedThose tickets do not address the same issue. However, this issue has been fixed by #1484336: Undefined index in views_plugin_row_node_view.inc