file_put_contents() doesn't create a file, if $data is null or its length is 0
From manual page: https://php.net/function.file-put-contents
That would rather be an implementation bug, but it works for me:
php > var_dump(file_exists("foo"));
bool(false)
php > var_dump(file_put_contents("foo", ""));
int(0)
php > var_dump(file_exists("foo"));
bool(true)
Can you please detail in which environment/circumstances that doesn't work for you?
I've tried the same above thing as @cmb69 did, and I get the same result. I'm running on PHP v7.4.24 (so considering it must be working on above versions) I hope this will be helpful feedback.
No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.