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

Broken 5.3 compatibility in 'empty($smarty.capture.name)'

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


Joined: 03 Jun 2016
Posts: 3

PostPosted: Sat Jun 04, 2016 10:09 am    Post subject: Broken 5.3 compatibility in 'empty($smarty.capture.name)' Reply with quote

smarty code
Code:

{capture name=capture_name}
   capture content
{/capture}

{if !empty($smarty.capture.capture_name)}
   {$smarty.capture.capture_name}
{/if}



compiled to condition:

Code:

...
<?php if (!empty($_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'capture_name'))) {?>
...


Quote:
Prior to PHP 5.5, empty() only supports variables


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


Joined: 03 Dec 2012
Posts: 1568

PostPosted: Sat Jun 04, 2016 2:51 pm    Post subject: Reply with quote

Update your PHP then, 5.3 is 2 years out of even security patching.
Back to top
View user's profile Send private message
a.shpota
Smarty n00b


Joined: 03 Jun 2016
Posts: 3

PostPosted: Mon Jun 06, 2016 1:57 pm    Post subject: Reply with quote

Dependence in composer.json allows to use PHP version >= 5.2
https://github.com/smarty-php/smarty/blob/master/composer.json#L28

For larger projects, update php is not always easy.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1568

PostPosted: Mon Jun 06, 2016 3:51 pm    Post subject: Reply with quote

I have two large projects on hand, one was written for 5.2, one was written even before PHP5 was a thing.
Both run just fine under 5.3 after just a few tweaks here and there, and passed tests under 5.5.
Firing new hosting space for both with 5.6 right now, but I'm fairly confident there will be no major issues. Only benefits.
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