Someone knows a trick to have a PHP script self-restrict access to the file system (fopen
, file_get_contents
etc.)?
Such calls should be blocked except for a handful of selected file names (log file, access to /tmp
and similar).
This is not a security thing, but rather a means of forcing the development team not to access the file system directly (and detect spots in existing code, where this is already the case). We want to see an exception in that case (which gets caught and reported), as the content of such files must be accessed by other means.
I was thinking about implementing my own streamWrapper for the file://
protocol, but apparently there is no way to extend the built-in filewrapper class.