I used views_php to create some fields in view. The view was created for Indexed Content. I tried to enable cache and after it failed with error PHP Fatal error: Call to a member function preExecute() a non-object in path/plugin_cache.inc on line 89.
I found that views_php creates new view with own query handler. And this handler is not extending views cache plugin and it has no preExecute method. views_php adds old view to $view->old_view. The patch below adds code which look for SearchApiViewsQuery object in $view->old_view too.

Comments

drunken monkey’s picture

Title: PHP Fatal error: Call to a member function preExecute() a non-object in path/plugin_cache.inc on line 89 » Make caching compatible with Views PHP
Version: 7.x-1.8 » 7.x-1.x-dev
Category: bug » task
Status: Active » Needs work

Thanks for reporting this issue, and providing a patch!
It seems to me Views PHP works in a rather hacky way, but on the other hand there doesn't seem to be any harm in the adaption you suggest – and if Search API Views then works with that module, why not?

In any case, please re-roll the patch according to this handbook page, so that it can be cleanly applied with Git, and then set the issue's status to "needs review".

sergei_brill’s picture

Status: Needs work » Needs review

On one of my projects the patch fixed problems with views_php. But now I tested on a clean drupal installation and the patch didn't fix the bug. Property old_view is empty. It looks like it is better to create issue for views_php. May be it is possible to find a better way to run php code from fields.

Status: Needs review » Needs work

The last submitted patch, cache_plugin_fix_conflict_with_views_php.patch, failed testing.

rcodina’s picture

rcodina’s picture

Patch on #0 doesn't work for me. Also, patch on related issue doesn't work too.

legolasbo’s picture

Status: Needs work » Closed (outdated)

This issue has not seen activity in over 2,5 years. I am therefore closing this issue to clean up the issue queue. Feel free to re-open and update this issue if you feel this issue is still relevant and of importance.