function FileNameMungingTest::testMungeNullByte

Tests munging with a null byte in the filename.

File

modules/simpletest/tests/file.test, line 2814

Class

FileNameMungingTest
Tests for file_munge_filename() and file_unmunge_filename().

Code

function testMungeNullByte() {
    $prefix = $this->randomName();
    $filename = $prefix . '.' . $this->bad_extension . "\x00.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.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.