When the tmp directory is full, file_put_contents returns FALSE but the file is created with size of 0. file_put_contents should either complete the creation of the file or have no effect at all. For example:

$data = 'somedata'; $temp_name = '/tmp/myfile'; if (file_put_contents($temp_name, $data) === FALSE) { // the message print that the file could not be created. print 'The file could not be created.'; }

But when I go to the tmp directory, I can find the file "myfile" created in the directory with size 0. This makes it difficult to maintain. The file should not be created and I would like to see a message or warning the the tmp directory is full. Am I missing anything? And is this normal behaviors?