Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Composer upgraded to 3.1.30.. tons of problems

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


Joined: 19 May 2003
Posts: 6

PostPosted: Tue Aug 09, 2016 6:28 am    Post subject: Composer upgraded to 3.1.30.. tons of problems Reply with quote

Our project composer just upgraded our smarty version from 3.1.29 to 3.1.30... now we are getting tons of problems that did not exist before:

Just blank pages, no error messages, nothing.

Fatal error: Uncaught --> Smarty: plugin Smarty_Resource_ is not a valid name format <-- thrown in /SOMEFOLDER/vendor/smarty/smarty/libs/sysplugins/smarty_internal_method_loadplugin.php on line 40

$smarty->display($template, $cacheid, $cachelang); seems to be broken, works if $smarty->display() is used.

anyone else having problems? I think we are downgrading for the time being...
Back to top
View user's profile Send private message
kowach
Smarty Rookie


Joined: 26 Jan 2011
Posts: 13

PostPosted: Mon Aug 22, 2016 5:30 pm    Post subject: Reply with quote

I have similar problem with version 3.1.30
First uncached request is about 10 seconds long. I have traced code and found that it locks cache key (I can see LOCK#... key in APC cache for 10 seconds) and then it generates cache template.

I have custom class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore{}.

This should not happening because I'm testing it on dev machine with single request to server.

Code:

$cid = 'box1';
$smarty->isCached("box.tpl", $cid); // generates lock
echo $smarty->fetch("box.tpl", $cid ); // it should generate cache and remove lock, but it waits 10 sec?!
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5059
Location: Hamburg / Germany

PostPosted: Thu Sep 15, 2016 4:48 am    Post subject: Reply with quote

The delay on first uncached template with custom cache resource is now fixed in the master branch
Back to top
View user's profile Send private message
ueaole
Smarty n00b


Joined: 10 Nov 2017
Posts: 3

PostPosted: Fri Nov 10, 2017 6:10 pm    Post subject: Reply with quote

I'm seeing the exact same issue as tpanula. I tried to step backwards and debug it but didn't really know what was going on, but here's what I found.

Smarty has a UID 2d185aa406260ef92fd868208b44ef71f7f07115 and it tries to use it as a key in an array in the Smarty_Template_Complied object ->file_dependency array. But when I look at that, it's not in there. That doesn't stop it from trying to load the file and the plugin.. which makes $type null and later when the regex match tries to verify the plugin authenticity, it fails.

Any advice?

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


Joined: 03 Dec 2012
Posts: 1147

PostPosted: Fri Nov 10, 2017 7:02 pm    Post subject: Reply with quote

Sounds like a compiled template was not saved.
If you have a reproducible short test case, it may help.
Back to top
View user's profile Send private message
ueaole
Smarty n00b


Joined: 10 Nov 2017
Posts: 3

PostPosted: Fri Nov 10, 2017 10:43 pm    Post subject: Reply with quote

I don't have a reproducible test case to share, but I did investigate more and find a workaround.

It looks like the problem resides inside {include inline}. The templates are being generated and saved in the filesystem, but I don't believe this should be happening with an inline include.

Whatever is going on after that, $file_dependency ends up not having the ID passed to _renderSubTemplate. The $file_dependency[$uid] lookup fails but continues on with empty variables.


A workaround for this is setting $merge_compiled_includes to true. $file_dependency ends up having the correct ID and the compiled template ends up correct.

Hope this helps find the root cause of this.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1147

PostPosted: Sat Nov 11, 2017 6:53 pm    Post subject: Reply with quote

Include flag "inline" only means the RESULTS of a template will be inlined, for the purpose of caching.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5059
Location: Hamburg / Germany

PostPosted: Sun Nov 12, 2017 12:02 am    Post subject: Reply with quote

Which Smarty version did you use?

Have you tried to delete the compiled and cached template files once manually after the upgrade?

With composer you can also install "3.1.31" or "~3.1@dev" for the dev-master version of the upcomming 3.1.32
Back to top
View user's profile Send private message
ueaole
Smarty n00b


Joined: 10 Nov 2017
Posts: 3

PostPosted: Tue Nov 14, 2017 6:50 pm    Post subject: Reply with quote

@U.Tews: this has been since 3.1.29. Workaround is working with 3.1.31. I can try and see if the dev version of 3.1.32 is still affected.

And yes, I had previously deleted the cached files when changing versions.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5059
Location: Hamburg / Germany

PostPosted: Wed Nov 15, 2017 2:09 am    Post subject: Reply with quote

How did your {include ....} tag look like.
And please provide the content of the file_dependency array of the compiled template file.

I was not able to reproduce the 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