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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grasmash’s picture

Status: Active » Needs review
FileSize
1.01 KB

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
FileSize
566 bytes

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).

cthshabel’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.10 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.

vadym.kononenko’s picture

Version: 6.x-3.x-dev » 7.x-3.x-dev
Status: Closed (fixed) » Reviewed & tested by the community

I think D7 branches must to be updated as well.

jpwester’s picture

Agreed. I believe I'm running into something similar with a custom views plugin display extender and I see the is_object() check hasn't been added to the includes/view.inc file in D7. I can confirm that the patch in #3 does in fact fix my issue.

zalak.addweb’s picture

Issue tags: +views
DamienMcKenna’s picture

Issue tags: -views

@prafull.panchori: Please stop adding the "views" tag to issues in the Views issue queue, it's redundant. Thanks.

DamienMcKenna’s picture

  • DamienMcKenna committed 0c8e375 on 7.x-3.x authored by znerol
    Issue #2040281 by grasmash, znerol: Views PHP Fatal error: view::destroy...
DamienMcKenna’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks all.

Status: Fixed » Closed (fixed)

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

Michael Dajewski’s picture

Did encounter the issue again.
Thanks to #6.
I did some testing and found out the issue was happening when I had enabled Administration menu
in: admin_menu/admin_menu.map.inc LN: 139 where they call views_get_enabled_views().

I do attach the views_plugin_display_extender_destroy_fix_D7-2040281-1.patch which is almost a copy of views-destroy_autoload-D7-2040281-3.patch.