There are cases in which a plugin or theme needs to create a php file somewhere that can later include it. For example a captcha plugin, or some kind of a templating system like twig/smarty (In my situation it's simple template engine for a collection of widgets).
Where should be this file created?
The only place I can think of is
wp-content/uploads/, but that just doesn't sound right :)
So is there a safe place where you can create files, and not worry about them being deleted on WordPress/plugin/theme update ?
One solution could be to create a child theme / directory in the themes / plugins directory...