harden file_set_contents against symlink attacks