I'm currently working on Views 6.x-2.16. I very frequently get the following fatal error when clearing caches:

PHP Fatal error:  view::destroy() [<a href='view.destroy'>view.destroy</a>]: The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition &quot;views_plugin_display_default&quot; of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in obfuscated/views/includes/view.inc on line 1611

I suspect that this is due to an incompatibility with autoload. Some how, views attempts to destroy a view object that has an incomplete handler. A simple change to the destroy() method prevents this. Patch forthcoming.

Files: 
CommentFileSizeAuthor
#3 views-destroy_autoload-D7-2040281-3.patch566 bytesznerol
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]
#1 views-destroy_autoload-2040281-1.patch1.01 KBgrasmash
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Comments

grasmash’s picture

Status:Active» Needs review
StatusFileSize
new1.01 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Attaching patch rolled against 6.x-2.x-dev

TravisCarden’s picture

Title:Views PHP Fatal error: view::destroy() on cache clear when autoload enabled» Views PHP Fatal error: view::destroy() on cache clear when autoload enabled
Component:Miscellaneous» Code
Status:Needs review» Reviewed & tested by the community

This makes sense and seems to solve the problem without any potential for adverse side effects that I perceive.

znerol’s picture

Issue summary:View changes
StatusFileSize
new566 bytes
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

This is #1 but without the first hunk removed. This makes the patch also apply to views 7.x-3.x. I hope this will help people suffering from #2171301: Get an error about "authcache_views_plugin_display_extender" after authcache_views is disabled (which I believe, I cannot really resolve cleanly over in Authcache).

Steven T Habel’s picture

This did not resolve the problem. Still had to rely on truncate views cache in mysql to clear things up.

dawehner’s picture

@znerol
Did you had the change to reproduce the bug?

@cthshabel
Given that we might need to set the status to needs work? I'm not sure whether the problem of you is maybe something else.

znerol’s picture

No, I never hit that one. This seems to happen when people disable (or maybe simply remove) a module which provides a views extension and the views cache is not cleared properly for some reason. Perhaps this happens in combination with third-party cache implementations or some other combination of modules and settings.

In my opinion @grasmash fix makes a lot of sense. The views cache could get stale for any reason and protecting against incomplete objects on cleanup seems sensible.

DamienMcKenna’s picture

Version:6.x-2.x-dev» 6.x-3.x-dev
Parent issue:» #2507839: Plan for Views v6.x-3.3 release

The patch should be added to 6.x-3.x first.

DamienMcKenna’s picture

The patch in #1 should be added to 6.x-2.x too.

  • dawehner committed 7fb3fd6 on 6.x-3.x authored by znerol
    Issue #2040281 by grasmash, znerol: Views PHP Fatal error: view::destroy...

  • dawehner committed 8c7e365 on authored by znerol
    Issue #2040281 by grasmash, znerol: Views PHP Fatal error: view::destroy...
dawehner’s picture

Status:Reviewed & tested by the community» Fixed

Committed to both versions. Thank you! Thank you @DamienMcKenna

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.