Also check on existence.
[core.git] / inc / classes / main / file_directories / io / class_FrameworkFileInputOutputPointer.php
index a86a8d3..08ac781 100644 (file)
@@ -54,7 +54,7 @@ class FrameworkFileInputOutputPointer extends BaseFileIo implements InputOutputP
                } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) {
                        // File exists but cannot be read
                        throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
                } elseif ((!BaseFrameworkSystem::isReadableFile($fileName)) && (file_exists($fileName))) {
                        // File exists but cannot be read
                        throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
-               } elseif (!is_writable($fileName)) {
+               } elseif ((file_exists($fileName)) && (!is_writable($fileName))) {
                        // File exists but cannot be written
                        throw new FileWriteProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_WRITTEN);
                }
                        // File exists but cannot be written
                        throw new FileWriteProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_WRITTEN);
                }