Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Smarty-3.1.5 - smarty_internal_write_file.php - Damaged File

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
voxel
Smarty n00b


Joined: 29 Dec 2011
Posts: 3

PostPosted: Thu Dec 29, 2011 12:37 pm    Post subject: Smarty-3.1.5 - smarty_internal_write_file.php - Damaged File Reply with quote

Hello,

In some cases we had a problem when we have a lot of traffic and many Templates have to be compiled at the same time. They where partly overwitten. Instead of the following(Line 41):
Code:

 $_tmp_file = $_dirpath . DS . uniqid('wrt');

You should do something like this:
Code:

 $_tmp_file = $_dirpath . DS . uniqid('wrt', true);

Or even better:
Code:

$_tmp_file = $_dirpath . DS . uniqid('wrt', true).md5($_filepath);

Or just lock the File.

Thanks
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 698
Location: Germany, border to Switzerland

PostPosted: Thu Dec 29, 2011 1:31 pm    Post subject: Reply with quote

I added the more_entropy argument, seeing that this is required for cygwin anyways. (wonder who's using php via cygwin, though…)

It will be included in Smarty 3.1.8

File Locking is not possible, as smarty could be writing to FS that don't support file locking at all (NFS for example).
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 698
Location: Germany, border to Switzerland

PostPosted: Thu Dec 29, 2011 1:55 pm    Post subject: Reply with quote

You might also be interested in $compile_locking and $cache_locking

they should prevent smarty from doing the exact same job in multiple processes (even accross multiple servers).
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
voxel
Smarty n00b


Joined: 29 Dec 2011
Posts: 3

PostPosted: Thu Dec 29, 2011 2:05 pm    Post subject: Reply with quote

compile_locking is active.
cache_locking is NOT active as we dont use the cache.

Still we sometimes had the Problem of corrupt files.

(we added the more Entropy to fix that Problem)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP