check for correct array in ApsInstaller, fixes #1098

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-03-10 09:11:05 +01:00
parent a76b064a56
commit 4b872399ac

View File

@@ -393,39 +393,31 @@ class ApsInstaller extends ApsParser
//check for special PHP permissions //check for special PHP permissions
//must be done with xpath otherwise check not possible (XML parser problem with attributes) //must be done with xpath otherwise check not possible (XML parser problem with attributes)
if($ParentMapping && $ParentMapping !== null) if ($ParentMapping && $ParentMapping !== null) {
{
$ParentMapping->registerXPathNamespace('p', 'http://apstandard.com/ns/1/php'); $ParentMapping->registerXPathNamespace('p', 'http://apstandard.com/ns/1/php');
$Result = $ParentMapping->xpath('p:permissions'); $Result = $ParentMapping->xpath('p:permissions');
if($Result[0]['writable'] == 'true') if (is_array($Result) && isset($Result[0]) && is_array($Result[0])) {
{ if (isset($Result[0]['writable']) && $Result[0]['writable'] == 'true') {
// fixing file permissions to writeable // fixing file permissions to writeable
if (is_dir($Path)) {
if(is_dir($Path))
{
chmod($Path, 0775); chmod($Path, 0775);
} } else {
else
{
chmod($Path, 0664); chmod($Path, 0664);
} }
} }
if($Result[0]['readable'] == 'false') if (isset($Result[0]['readable']) && $Result[0]['readable'] == 'false') {
{
//fixing file permissions to non readable //fixing file permissions to non readable
if (is_dir($Path)) {
if(is_dir($Path))
{
chmod($Path, 0333); chmod($Path, 0333);
} } else {
else
{
chmod($Path, 0222); chmod($Path, 0222);
} }
} }
} }
}
//set environment variables //set environment variables