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 a86a8d3a3b46da815015b6e1b1e819b0aa4edd98..08ac7811baaa310d45bedf7766af82d52c3e6df5 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);
                }