Skip to content

Commit fa657fd

Browse files
committed
More Tests
1 parent ec0d4af commit fa657fd

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

tests/PhpSpreadsheetTests/Reader/Security/XmlScannerTest.php

+16
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,20 @@ public function testEncodingAllowsMixedCase(): void
166166
$output = $scanner->scan($input = '<?xml version="1.0" encoding="utf-8"?><foo>bar</foo>');
167167
self::assertSame($input, $output);
168168
}
169+
170+
public function testUtf7Whitespace(): void
171+
{
172+
$this->expectException(ReaderException::class);
173+
$this->expectExceptionMessage('Double-encoded');
174+
$reader = new Xlsx();
175+
$reader->load('tests/data/Reader/XLSX/utf7white.dontuse');
176+
}
177+
178+
public function testUtf8Entity(): void
179+
{
180+
$this->expectException(ReaderException::class);
181+
$this->expectExceptionMessage('Detected use of ENTITY');
182+
$reader = new Xlsx();
183+
$reader->load('tests/data/Reader/XLSX/utf8entity.dontuse');
184+
}
169185
}
8.75 KB
Binary file not shown.
8.67 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding ='UTF-7' standalone="yes"?>
2+
+ADw-+ACE-DOCTYPE+ACA-foo+ACA-+AFs-+ADw-+ACE-ENTITY+ACA-toreplace+ACA-+ACI-xxe+AF8-test+ACI-+AD4-+ACA-+AF0-+AD4-+AAo-+ADw-sst+ACA-xmlns+AD0-+ACI-http://schemas.openxmlformats.org/spreadsheetml/2006/main+ACI-+ACA-count+AD0-+ACI-2+ACI-+ACA-uniqueCount+AD0-+ACI-1+ACI-+AD4-+ADw-si+AD4-+ADw-t+AD4-+ACY-toreplace+ADs-+ADw-/t+AD4-+ADw-/si+AD4-+ADw-/sst+AD4-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version='1.0' encoding = "UTF-8" standalone='yes'?>
2+
<root>
3+
test: Valid
4+
</root>

0 commit comments

Comments
 (0)