Also check on existence.
authorRoland Haeder <roland@mxchange.org>
Sat, 4 Jul 2015 04:11:30 +0000 (06:11 +0200)
committerRoland Haeder <roland@mxchange.org>
Sat, 4 Jul 2015 04:11:30 +0000 (06:11 +0200)
Signed-off-by: Roland H├Ąder <roland@mxchange.org>
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);
                }