0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-05 06:01:52 +00:00

Bug with tempnam("/tmp", "");

Some hostings have a different temporary path than "/tmp".
This commit is contained in:
Chimpzee 2016-01-11 15:43:41 +01:00
parent 913ac6955b
commit c1121fb749

View File

@ -81,7 +81,11 @@ class HTMLPurifier_URIScheme_data extends HTMLPurifier_URIScheme
} }
// XXX probably want to refactor this into a general mechanism // XXX probably want to refactor this into a general mechanism
// for filtering arbitrary content types // for filtering arbitrary content types
if (function_exists('sys_get_temp_dir')) {
$file = tempnam(sys_get_temp_dir(), "");
} else {
$file = tempnam("/tmp", ""); $file = tempnam("/tmp", "");
}
file_put_contents($file, $raw_data); file_put_contents($file, $raw_data);
if (function_exists('exif_imagetype')) { if (function_exists('exif_imagetype')) {
$image_code = exif_imagetype($file); $image_code = exif_imagetype($file);