Closed younes0 closed 9 years ago
Well the file already exists but it's no writable
You could add the following lines
public function __construct($filePath, $validatePathNotUnderDocRoot = true) {
if(!file_exists($filePath)) {
if(file_put_contents($filePath, '') === false) {
throw new \Exception('Unable to write file ' . $filePath);
}
} else if (!is_writable($filePath)) {
throw new \Exception('Unable to write file ' . $filePath);
}
$this->filePath = realpath($filePath);
if($validatePathNotUnderDocRoot && $this->isPathUnderDocRoot()) {
throw new \Exception('Path ' . $this->filePath . ' is under DOCUMENT_ROOT. It\'s insecure!');
}
}
This is a bug encountered in Laravel though I'm not sure if it's specific to Laravel. One workaround is to warn the user to make that file writable, by throwing an Exception or a warning in the Chrome console