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

Smarty bugged on PHP 5.2

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
XPSystemServices
Smarty Rookie


Joined: 20 Apr 2017
Posts: 7

PostPosted: Sat Feb 16, 2019 12:54 pm    Post subject: Smarty bugged on PHP 5.2 Reply with quote

According smarty documentation:
https://www.smarty.net/docs/en/installation.tpl

Smarty requires a web server running PHP 5.2 or greater.

But you are using code constructions that is not compatible with PHP 5.2

CODE TO REPRODUCE:

index.php
Code:
<?php

require_once('smarty/Smarty.class.php');

class MyClass {

  static function MyTag($params, $content, &$smarty, &$repeat) {
    return $content;
  }

  function __construct() {

    $smarty = new Smarty($this);

    $smarty->template_dir = 'templates/';
    $smarty->compile_dir = 'compiles/';

    $smarty->registerPlugin('block', 'mytag', array(__CLASS__, 'MyTag'));

    $smarty->display('my.html');

  }

}

new MyClass();

?>


templates/my.html
Code:
{mytag}Hello World!{/mytag}


The code above works fine in latest versions of PHP.
But it doesn't work in PHP 5.2 (tested in PHP 5.2.17).

It fails because in compiled templates you are using code generations similar to this:

$MyClass = 'MyClass';
echo $MyClass::MyTag();

that is not supported by PHP 5.2

Reference the class using a variable was added in PHP 5.3:
http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php

PLEASE FIX IT!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1518

PostPosted: Sat Feb 16, 2019 3:03 pm    Post subject: Reply with quote

PHP below 7.1 is unsupported.
Even 7.1 is in security support only.
http://php.net/eol
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    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