1.20.x file.test FileNameMungingTest::testMungeNullByte()

Tests munging with a null byte in the filename.

File

modules/simpletest/tests/file.test, line 2713
This provides SimpleTests for the core file handling functionality. These include FileValidateTest and FileSaveTest.

Class

FileNameMungingTest
Tests for file_munge_filename() and file_unmunge_filename().

Code

function testMungeNullByte() {
  $prefix = $this->randomName();
  $filename = $prefix . '.' . $this->bad_extension . "\0.txt";
  $this->assertEqual(file_munge_filename($filename, ''), $prefix . '.' . $this->bad_extension . '_.txt', 'A filename with a null byte is correctly munged to remove the null byte.');
}