public function SecurityFileUploadEventSubscriberTest::provideFilenamesNoMunge in Drupal 10
Same name and namespace in other branches
- 9 core/modules/system/tests/src/Unit/Event/SecurityFileUploadEventSubscriberTest.php \Drupal\Tests\system\Unit\Event\SecurityFileUploadEventSubscriberTest::provideFilenamesNoMunge()
Provides data for testSanitizeNameNoMunge().
Return value
array Arrays with original name and allowed extensions.
File
- core/
modules/ system/ tests/ src/ Unit/ Event/ SecurityFileUploadEventSubscriberTest.php, line 140
Class
- SecurityFileUploadEventSubscriberTest
- SecurityFileUploadEventSubscriber tests.
Namespace
Drupal\Tests\system\Unit\EventCode
public function provideFilenamesNoMunge() {
return [
// The following filename would be rejected by file_validate_extension()
// and therefore remains unchanged.
'.php is not munged when it would be rejected' => [
'foo.php.php',
'jpg',
],
'.php is not munged when it would be rejected and filename contains null byte character' => [
'foo.' . chr(0) . 'php.php',
'jpg',
],
'extension less files are not munged when they would be rejected' => [
'foo',
'jpg',
],
'dot files are not munged when they would be rejected' => [
'.htaccess',
'jpg png',
],
];
}