|
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 |
bobdoll Smarty n00b
Joined: 09 Nov 2011 Posts: 1
|
Posted: Wed Nov 09, 2011 1:53 pm Post subject: usage of uniqid() to define function name (content_) |
|
|
Hi,
PHP uniqid() can include a '.' (dot) in some case which. Uniqid is use to defune 'unifunc' which is then used as a function name if the '.' gets in there it become a PHP error.
sysplugins/smarty_internal_template.php :
BUG : $this->properties['unifunc'] = 'content_' . uniqid();
BETTER : $this->properties['unifunc'] = 'content_' . str_replace('.', '_',uniqid());
Reproduce : i get this on cygwin PHP 5.3.8
I changed my file, hope to see this uniqid usage fixed in the next version.
Best,
Bob. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Nov 09, 2011 3:14 pm Post subject: |
|
|
I just found this:
https://bugs.php.net/bug.php?id=34908
So cygwin does use a different default value for $more_entropy parameter of uniqid() and this is not documented.
Anyway we will update our code with the next release. |
|
Back to top |
|
kowach Smarty Rookie
Joined: 26 Jan 2011 Posts: 13
|
Posted: Mon Feb 17, 2014 1:42 pm Post subject: |
|
|
Same bug rises again when executing PHP on HHVM (Hip Hop 2.4).
On hhvm uniqid('', true) returns "," instead "."
So you should replace
'content_' . str_replace('.', '_',uniqid());
to
'content_' . str_replace(array('.',','), '_',uniqid());
best regards,
Kowach |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Feb 17, 2014 6:26 pm Post subject: |
|
|
Thanks for your input.
The fix is now in the SVN trunk and will later be included in 3.1.17 |
|
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
|