TranVanSinh / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

File permission #417

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
        if(flock($fh, LOCK_EX)){
            @unlink($this->cachefile); //rename generally overwrites, but doing this in case of platform specific quirks. File might not exist yet.
            rename($tempfile4, $this->cachefile);
            flock($fh, LOCK_UN);
            fclose($fh);
            @unlink($lockFile);
        }

Should be changed to:
        if(flock($fh, LOCK_EX)){
            @unlink($this->cachefile); //rename generally overwrites, but doing this in case of platform specific quirks. File might not exist yet.
            rename($tempfile4, $this->cachefile);
            chmod($this->cachefile, 0644);
            flock($fh, LOCK_UN);
            fclose($fh);
            @unlink($lockFile);
        }

+) Add chmod($this->cachefile, 0644);
because in some hosting setting, without this setting, file permission will be 
600, and it can not readable by user.

Original issue reported on code.google.com by qvs...@gmail.com on 18 Dec 2012 at 5:01

GoogleCodeExporter commented 9 years ago
I can confirm that the file permissions were not functioning correctly; this 
prevented thumbnails from being visible in a Joomla module that uses this 
library. Details below:

Amazon EC2 m1.Small server (aws.amazon.com)
Bitnami Linux LAMP stack (bitnami.org/stack/lamp)
Joomla 2.5.8 installation (www.joomla.org)
Module: RAXO All-Mode (www.raxo.org)

Toolie Garner

Original comment by too...@toolie.com on 4 Jan 2013 at 11:24