I am using K2 v2.6.3 with Joomla v2.5.8
The K2 Tools module with Custom Code functionality using the Parse PHP option causes a folder-related Joomla error. When the Parse PHP setting is used, the Joomla page on which the module appears generates the Joomla error "JFolder:create:Infinite loop detected", which occurs when a folder is not accessible (because it doesn't exist or has the wrong permissions).
When I look at the helper.php file, I can see that a temp file is written to a folder called mod_k2_tools in the Joomla cache folder, the contents are then output and the temp file is then deleted.
If I manually create an empty folder called mod_k2_tools in the Joomla cache folder, the Joomla error disappears (because it can find the folder referred to in the helper file).
However, if I open the module again and make a change to the custom code, when I save it, the whole mod_k2_tools folder disappears from the cache folder and the Joomla error returns because the folder is missing again.
How can I stop the helper file from deleting the folder, not just the temp file so that Joomla does not generate the Infinite loop error?