Re: File Perms

messju mohr <[email protected]> Thu, 16 Nov 2006 16:35:07 +0100
Newsgroups gmane.comp.php.smarty.devel
Message-ID <[email protected]>
Hi,

On Thu, Nov 16, 2006 at 04:10:28PM +0100, Bas Kamer wrote:
> Hi,
> 
> i have a quick improvement for smarty for people using the  
> _file_perms property.
> 
> in file
> 
> smarty-2.6.14/libs/internals/core.write_file.php:47
> 
> -    @chmod($params['filename'], $smarty->_file_perms);
> +    @chmod($params['filename'], octdec($smarty->_file_perms));
> 
> This improves file chmod behavior...

Erm, actually it breaks it, IMHO.
 
> on my installation a setting of (string) "0666" yields very  
> unexpected results unless i use the octdec method...

You should sanitize this value outside of smarty, then.

greetings
messju

> please note that in my case this string is not hardcoded into the  
> smart class, but dynamically written at some point (eventough it is  
> designated as 'private', which is why????)
> 
> thanks... good luck, it a very nice product.
> 
> Just like to contribute something here...
> ps. If this is not the correct place for this please let me know...

It is the right place. I'm just strongly against what you propose. ;-)

> references: http://www.php.net/octdec
> and the comment on
> http://nl3.php.net/manual/en/function.chmod.php#56077
> 
> again
> 
> thanks a lot...
> 
> Bas Kamer

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php