Skip to content

Commit 9dcfd9a

Browse files
authored
Use standard temporary file for internal use of HTMLPurifier (#2383)
1 parent a2be574 commit 9dcfd9a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
99

1010
### Added
1111

12-
- Nothing
12+
- Use tmp dir in HTMLPurifier config
1313

1414
### Changed
1515

src/PhpSpreadsheet/Writer/Html.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,6 +1769,10 @@ private function writeComment(Worksheet $worksheet, $coordinate)
17691769
$result = '';
17701770
if (!$this->isPdf && isset($worksheet->getComments()[$coordinate])) {
17711771
$sanitizer = new HTMLPurifier();
1772+
$cachePath = File::sysGetTempDir() . '/phpsppur';
1773+
if (is_dir($cachePath) || mkdir($cachePath)) {
1774+
$sanitizer->config->set('Cache.SerializerPath', $cachePath);
1775+
}
17721776
$sanitizedString = $sanitizer->purify($worksheet->getComment($coordinate)->getText()->getPlainText());
17731777
if ($sanitizedString !== '') {
17741778
$result .= '<a class="comment-indicator"></a>';

0 commit comments

Comments
 (0)