mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-05 14:11:52 +00:00
Cache: handle specific group permission
This commit is contained in:
parent
b81690c17e
commit
b4dcd64462
@ -264,7 +264,7 @@ class HTMLPurifier_DefinitionCache_Serializer extends HTMLPurifier_DefinitionCac
|
|||||||
private function _testPermissions($dir, $chmod)
|
private function _testPermissions($dir, $chmod)
|
||||||
{
|
{
|
||||||
// early abort, if it is writable, everything is hunky-dory
|
// early abort, if it is writable, everything is hunky-dory
|
||||||
if (is_writable($dir)) {
|
if ($chmod === (0777 & fileperms($dir))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!is_dir($dir)) {
|
if (!is_dir($dir)) {
|
||||||
|
@ -225,6 +225,28 @@ class HTMLPurifier_DefinitionCache_SerializerTest extends HTMLPurifier_Definitio
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAlternateGroupPermissions()
|
||||||
|
{
|
||||||
|
$cache = new HTMLPurifier_DefinitionCache_Serializer('Test');
|
||||||
|
$config = $this->generateConfigMock('serial');
|
||||||
|
$config->version = '1.0.0';
|
||||||
|
$config->returns('get', 1, array('Test.DefinitionRev'));
|
||||||
|
$dir = dirname(__FILE__) . '/SerializerTest';
|
||||||
|
$config->returns('get', $dir, array('Cache.SerializerPath'));
|
||||||
|
$config->returns('get', 0770, array('Cache.SerializerPermissions'));
|
||||||
|
|
||||||
|
$def_original = $this->generateDefinition();
|
||||||
|
$cache->add($def_original, $config);
|
||||||
|
$this->assertFileExist($dir . '/Test/1.0.0,serial,1.ser');
|
||||||
|
|
||||||
|
$this->assertEqual(0660, 0777 & fileperms($dir . '/Test/1.0.0,serial,1.ser'));
|
||||||
|
$this->assertEqual(0770, 0777 & fileperms($dir . '/Test'));
|
||||||
|
|
||||||
|
unlink($dir . '/Test/1.0.0,serial,1.ser');
|
||||||
|
rmdir( $dir . '/Test');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function testNoInfiniteLoop()
|
public function testNoInfiniteLoop()
|
||||||
{
|
{
|
||||||
$cache = new HTMLPurifier_DefinitionCache_Serializer('Test');
|
$cache = new HTMLPurifier_DefinitionCache_Serializer('Test');
|
||||||
|
Loading…
Reference in New Issue
Block a user