Problem/Motivation
Hi,
thank you for your work. However, using views_php 7.x-1.0 a problem occurs using the php-cache.
It didn't appear in 7.x-1.0-alpha3 and I've tested on PHP 7.3.27.
The problem:
Enter any php-code in the php-field ("Caching options") like "return true". You will see that the views-cache will be updated on each reload instead of "never" (what "return true" means).
Steps to reproduce
Create any view. Under advanced => cache select "PHP"
In Result cache code and Output cache code enter return true
Using devel you can see that for each reload the cached data is updated.
OR
in file views_php/plugins/views/views_php_plugin_cache.inc on line 74
add
drupal_set_message('in '.__FUNCTION__.' for '.$type . ' FRESH IS: '.var_export($fresh,1))
You will see that $fresh is always NULL. Which means: "refresh the cache".
Proposed resolution
A simple solution would be to add a "return" before each "eval" in the function cache_get($type).
Or maybe stick with the old $function = create_function('$view, $plugin, $cache', $this->options['php_cache_results'] . ';');
I don't know, which is better. But eval sounds more evil ;-)
Remaining tasks
fix php-cache
User interface changes
none
API changes
none
Data model changes
none