|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Estigy Smarty Rookie
Joined: 16 Nov 2011 Posts: 5
|
Posted: Tue Feb 07, 2012 11:19 am Post subject: Two templates compile to the same function name |
|
|
Hi.
Smarty templates compile to functions named "content_" + uniqid('', false).
On our high traffic site, every now and then two different templates get compiled to the same function name, resulting in some very weird output: On the place, where the second template is to be inserted, the first template (with the same function name already in memory) shows up.
The code can be found 2x in smarty_internal_template.php and 1x in smarty_internal_compile_include.php.
I strongly encourage not only using uniqid() for generating the function name. Please add a checksum of the code or the filename to the identifier.
Thanks,
Estigy. |
|
Back to top |
|
Estigy Smarty Rookie
Joined: 16 Nov 2011 Posts: 5
|
Posted: Tue Feb 07, 2012 11:25 am Post subject: |
|
|
Hi.
I did a quickfix for this that seems to work for me. The lines now look like this:
.... = 'content_' . str_replace('.', '_', uniqid('', true));
Including the content-hash or the filename still seems a better to do this, though.
Greets, E. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Feb 07, 2012 6:55 pm Post subject: |
|
|
This has been fixed in the SVN trunk and will be include in 3.1.8 |
|
Back to top |
|
Estigy Smarty Rookie
Joined: 16 Nov 2011 Posts: 5
|
Posted: Thu Feb 09, 2012 8:34 am Post subject: |
|
|
Thanks! |
|
Back to top |
|
|
|
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
|