0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-01-03 13:21:51 +00:00

Merge pull request #91 from apsdsm/fix-permissions-bug

changed chmod behaviour in Serializer
This commit is contained in:
Edward Z. Yang 2016-07-29 03:25:41 -07:00 committed by GitHub
commit 1ce2fde400

View File

@ -198,11 +198,8 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac
if ($result !== false) { if ($result !== false) {
// set permissions of the new file (no execute) // set permissions of the new file (no execute)
$chmod = $config->get('Cache.SerializerPermissions'); $chmod = $config->get('Cache.SerializerPermissions');
if ($chmod === null) { if ($chmod !== null) {
// don't do anything chmod($file, $chmod & 0666);
} else {
$chmod = $chmod & 0666;
chmod($file, $chmod);
} }
} }
return $result; return $result;
@ -229,14 +226,6 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac
} elseif (!$this->_testPermissions($base, $chmod)) { } elseif (!$this->_testPermissions($base, $chmod)) {
return false; return false;
} }
if ($chmod === null) {
trigger_error(
'Base directory ' . $base . ' does not exist,
please create or change using %Cache.SerializerPath',
E_USER_WARNING
);
return false;
}
if ($chmod !== null) { if ($chmod !== null) {
mkdir($directory, $chmod); mkdir($directory, $chmod);
} else { } else {