Smarty 3.1 RC1 Released

134 views
Skip to first unread message

Monte Ohrt

unread,
Jun 27, 2011, 12:11:18 PM6/27/11
to smarty-d...@googlegroups.com, smarty-...@googlegroups.com, smarty-d...@googlegroups.com
Smarty 3.1 Release Candidate 1 has been released. There are many changes to this release, please see the notes file with the distribution. 

Notes file: 

http://smarty-php.googlecode.com/svn/branches/Smarty_3_1_DEV/README_3_1_DEV 


Change Log: 

http://smarty-php.googlecode.com/svn/branches/Smarty_3_1_DEV/distribution/change_log.txt 


Download: 

http://www.smarty.net/download

MH

unread,
Jun 27, 2011, 8:14:24 PM6/27/11
to Smarty Developers

Is auto-recompile based on version number enabled by default?

When I dropped this onto one test site, I got an error message about
updateParentVariables, but this disappeared after manually clearing
the smarty cache.

- mph


On Jun 27, 9:11 am, Monte Ohrt <mo...@ohrt.com> wrote:
> Smarty 3.1 Release Candidate 1 has been released. There are many changes to this release, please see the notes file with the distribution.
>
> Notes file:
>
> http://smarty-php.googlecode.com/svn/branches/Smarty_3_1_DEV/README_3...
>
> Change Log:
>
> http://smarty-php.googlecode.com/svn/branches/Smarty_3_1_DEV/distribu...
>
> Download:
>
> http://www.smarty.net/download

uwe.tews

unread,
Jun 28, 2011, 1:01:20 PM6/28/11
to Smarty Developers

Yes, recompile on version change is always enabled and is independend
of compile_check setting etc.

I tried it also with old version 3.0 cache and compiled files and
could not reproduce this sort of problem.

Currently I have no idea what could have happend.

Uwe

uwe.tews

unread,
Jun 28, 2011, 1:48:29 PM6/28/11
to Smarty Developers
One thing I found is a possible undefined index "version" notice
during the automatic recompilation of older 3.0 cache files.

This bug is fixed in the SVN Smarty_3_1_DEV branch.

But this does not explain your problem.

Uwe

MH

unread,
Jun 28, 2011, 3:30:08 PM6/28/11
to Smarty Developers

Hey Uwe,

I setup the following two files and displayed test.tpl in 3.0.7 and
then today's 3.1-DEV:

test.tpl:
Hi
{include file="test2.tpl" inline}

test2.tpl:
X


Doing so gave me the following message:


Notice: Undefined index: unifunc in .../Smarty-3.1rc1/libs/sysplugins/
smarty_internal_template.php on line 410
Hi
X
Fatal error: Uncaught exception 'SmartyException' with message 'Call
of unknown function 'updateParentVariables'.' in .../Smarty-3.1rc1/
libs/sysplugins/smarty_internal_templatebase.php:634
Stack trace:
#0 /tmp/
d06765369c1c2fb9c6e6b19ef2fe7b84b936d7ef.file.test.tpl.php(32):
Smarty_Internal_TemplateBase->__call('updateParentVar...', Array)
#1 /tmp/
d06765369c1c2fb9c6e6b19ef2fe7b84b936d7ef.file.test.tpl.php(32):
Smarty_Internal_Template->updateParentVariables(0)
#2 .../Smarty-3.1rc1/libs/sysplugins/
smarty_internal_templatebase.php(140): include('/tmp/d0...')
#3 .../Smarty-3.1rc1/libs/sysplugins/
smarty_internal_templatebase.php(306): Smarty_Internal_TemplateBase-
>fetch('test.tpl', NULL, NULL, NULL, true)
#4 .../index.php(8): Smarty_Internal_TemplateBase->display('test.tpl')
#5 {main}
thrown in .../Smarty-3.1rc1/libs/sysplugins/
smarty_internal_templatebase.php on line 634


Also, if I remove the include (leaving test.tpl with just "Hi"),
compile it in 3.0.7 and then run it with Smarty 3.1-DEV, I get "Hi"
repeated twice. Is this expected?


Thanks,
- mph

uwe.tews

unread,
Jun 28, 2011, 4:50:38 PM6/28/11
to Smarty Developers
Yes, you are right.

I did not test with templates which did use inline subtemplates.

The problem is that the compiled templates of 3.0 and 3.1 are
different in structure and the 3.0 files are not really prepared for
the new version checking. In 3.0 the template code is executed
directly when the compiled template included by the include itself. In
3.1 the template code is inside a function which is called at a later
time. 3.0 inline code does now run into an exception before 3.1 can
detect that the file was compiled with the older version.

There no fix for this.

So the upgrade from 3.0 to 3.1 does still require manuel deletion of
the old cache and compiled files.
The version checking will work correctly >=3.1.

3.0 files not containing inline code should recompile, but with the
glitch that you may see content twice during that process.

Sorry about this.

Uwe

Karel S.

unread,
Jun 30, 2011, 1:16:00 PM6/30/11
to Smarty Developers
It looks like the property force_cache is gone?

property 'force_cache' does not exist.
Time: 30-06-2011 19:13
File: /var/wda/libs/smarty/sysplugins/smarty_internal_templatebase.php
Line: 622
Code: 0

We use it like this:

$template = $smarty->createTemplate('file.html');

if renew
$template->setForceCache(true);

if ( !$template->isCached() )
{
// rebuild cache

globe

unread,
Jun 30, 2011, 1:26:02 PM6/30/11
to Smarty Developers
Hey There,

Before fixing this bug (by simply adding the property to the smarty
class…) I'd like to point out that "force_cache" is a misleading name.
I'd expect Smarty to set $smarty->caching = true; if it wasn't
already. But that is not the described behaviour. I do see the point
of this flag and would like to keep it. As it has never been
documented, I do suggest renaming it to "ignore_iscached" or
something…

Regards,
Rod

uwe.tews

unread,
Jun 30, 2011, 2:07:19 PM6/30/11
to Smarty Developers
Karel

Generic getter/setter of Smarty properties used on template objects
did by mistake throw an exception.

This bug is fixed in the SVN Smarty_3_1_DEV branch.

Uwe

Steve E

unread,
Jul 4, 2011, 9:47:57 AM7/4/11
to Smarty Developers
I am running Nginx with PHP 5.3.6 in PHP-FPM mode on a CentOS server.

I deployed a rather complex project to this server for the first time,
and received a warning. The error is replicated using this simple
code:

include('smarty/Smarty.class.php');
$smarty = new Smarty();
$smarty->setTemplateDir(dirname(__FILE__));
$smarty->display('test.tpl');

Whether test.tpl exists or not doesn't matter.

The warning is:

Warning: preg_match() [function.preg-match]: Compilation failed:
unrecognized character after (?< at offset 6 in /home/ibr/www/test/
smarty/sysplugins/smarty_resource.php on line 201

The code on that line is:

if (preg_match('#^\[(?<key>[^\]]+)\](?<file>.+)$#', $file, $match)) {

This is a fresh checkout from SVN (revision 4195) using:
svn co http://smarty-php.googlecode.com/svn/branches/Smarty_3_1_DEV/distribution/libs/
smarty

Note: I never saw this warning in development using WampServer running
PHP 5.3.5.

Any ideas?

uwe.tews

unread,
Jul 4, 2011, 12:33:28 PM7/4/11
to Smarty Developers
Steve

It looks like that your system does use an outdated version of the
pcre libraries.

Regards Uwe

On Jul 4, 3:47 pm, Steve E <st...@effectivemarketingtenerife.com>
wrote:
> I am running Nginx with PHP 5.3.6 in PHP-FPM mode on a CentOS server.
>
> I deployed a rather complex project to this server for the first time,
> and received a warning. The error is replicated using this simple
> code:
>
> include('smarty/Smarty.class.php');
> $smarty = new Smarty();
> $smarty->setTemplateDir(dirname(__FILE__));
> $smarty->display('test.tpl');
>
> Whether test.tpl exists or not doesn't matter.
>
> The warning is:
>
> Warning: preg_match() [function.preg-match]: Compilation failed:
> unrecognized character after (?< at offset 6 in /home/ibr/www/test/
> smarty/sysplugins/smarty_resource.php on line 201
>
> The code on that line is:
>
> if (preg_match('#^\[(?<key>[^\]]+)\](?<file>.+)$#', $file, $match)) {
>
> This is a fresh checkout from SVN (revision 4195) using:
> svn cohttp://smarty-php.googlecode.com/svn/branches/Smarty_3_1_DEV/distribu...

Steve E

unread,
Jul 4, 2011, 2:20:02 PM7/4/11
to Smarty Developers
Thanks Uwe, will check that out!

Might be worth mentioning the pcre version required in the
compatibility notes; the server isn't that old and I have used other
servers in the past with far older setup!

uwe.tews

unread,
Jul 4, 2011, 3:00:37 PM7/4/11
to Smarty Developers
Steve

Do you see same warning if you replace the preg_match with

if (preg_match('#^\[(?P<key>[^\]]+)\](?P<file>.+)$#', $file, $match))
{

?

Uwe

On Jul 4, 8:20 pm, Steve E <st...@effectivemarketingtenerife.com>

Steve E

unread,
Jul 4, 2011, 3:42:14 PM7/4/11
to Smarty Developers
Hi Uwe,

Just upgraded the server to:

pcre.i386 0:6.6-6.el5_6.1 (i.e. v6.6) and that didn't work (CentOS
5.4).

Then I downloaded and installed v8.12 from http://www.pcre.org/ and
that didn't work either.

The PCRE extension in PHP 5.3.6 is the one that came with the bundle
from php.net.

This works perfectly in Smarty 3.0 series, by the way.

Any ideas?

Regards,
Steve


On Jul 4, 7:20 pm, Steve E <st...@effectivemarketingtenerife.com>

Steve E

unread,
Jul 4, 2011, 3:43:52 PM7/4/11
to Smarty Developers
Hi Uwe,

That works perfectly!

Regards,
Steve

uwe.tews

unread,
Jul 4, 2011, 3:52:17 PM7/4/11
to Smarty Developers
(?<name>) Should work since PHP 5.2.2.

Anyway we will change the older (?P<name>) syntax to avoid this sort
of problems.

Uwe

On Jul 4, 9:43 pm, Steve E <st...@effectivemarketingtenerife.com>

Steve E

unread,
Jul 4, 2011, 6:06:51 PM7/4/11
to Smarty Developers
New revision works perfectly, thanks!

MH

unread,
Jul 5, 2011, 12:52:20 PM7/5/11
to Smarty Developers

Hey all,

Noticed something odd here. On local workstations, a number of sites
worked fine; but when pushed to a shared Linux box for testing,
templates would break on mixed-case plugins.

For instance, the below works on several Mac OS 10.6 boxes but breaks
on several Linux 2.6 machines.


test.tpl:
Hi! {makeMagic}

function.makeMagic.php:
<?php

function smarty_function_makeMagic($param1, $param2)
{
echo ":)\n";
}

?>



On Jul 4, 6:06 pm, Steve E <st...@effectivemarketingtenerife.com>

globe

unread,
Jul 5, 2011, 1:05:42 PM7/5/11
to Smarty Developers
Hey MH,

are you sure cases of function call, function name and file name
match?
Mac (potentially) and Windows have case-insensitive filesystems, where
linux typically has case-sensitive. So, if you were to call the plugin
file "function.makemagic.php" it may work on one system, but not the
other. Similarily PHP treats function names case-insensitive: <?
function a(){echo "yeah!";} A(); ?> would print "yeah!".

Make sure you're using the right case in all the places.

Regards,
Rod

MH

unread,
Jul 5, 2011, 1:21:42 PM7/5/11
to Smarty Developers

Hey there,

Most developers working locally use either Windows or Mac OS X, and
both do default to case insensitive filesystems. That said, I did
doublecheck, and the cases all match.

I've hit a few instances of this Friday and today; they work all fine
in Smarty 3.0.x (even on case-sensitive machines) but fail in Smarty
3.1.

P.S. Apologies if you got two emails, Rod.

uwe.tews

unread,
Jul 5, 2011, 1:33:28 PM7/5/11
to Smarty Developers
Hey MH

Smarty does expect the plugin file names to all lowercase even if you
are using camelcase function names.

We had in the early days of Smarty3 some discussion about this and
decission was made to use just lowercase filenames.

Regards Uwe

MH

unread,
Jul 5, 2011, 1:44:32 PM7/5/11
to Smarty Developers

To confirm - this is true for both 3.0 and 3.1?

uwe.tews

unread,
Jul 5, 2011, 1:48:00 PM7/5/11
to Smarty Developers
Yes, this is true for 3.0 and 3.1. Nothing has cahnged here.

MH

unread,
Jul 6, 2011, 2:39:26 AM7/6/11
to Smarty Developers

Hey uwe,

At this juncture, I may force people to rename their plugins, but for
whatever it's worth, I tested the this this evening on a case-
sensitive Linux box. Smarty 3.0.x is looking for a file of the same
case as the function name, but 3.1-RC is looking for a lower-case
named version.

- mph

MH

unread,
Aug 25, 2011, 9:20:44 PM8/25/11
to Smarty Developers

Considering it's been a couple months since there's been much
discussion here, do you mind if I ask what the current timeline for
3.1 is looking like?
- mph


On Jun 27, 11:11 am, Monte Ohrt <mo...@ohrt.com> wrote:
> Smarty 3.1 Release Candidate 1 has been released. There are many changes to this release, please see the notes file with the distribution.
>
> Notes file:
>

globe

unread,
Aug 26, 2011, 2:58:34 AM8/26/11
to Smarty Developers
Hey MH,

we're wrapping up the 3.1 specific documentation.
Once that's done, 3.1 can be officially released.
Without knowing an exact schedule, I'd say somewhere in the next 2
weeks?!
Reply all
Reply to author
Forward
0 new messages