PHP Parse error: syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24

Bug #1986916 reported by philippe lhardy
46
This bug affects 7 people
Affects Status Importance Assigned to Milestone
fusiondirectory (Ubuntu)
Confirmed
Undecided
Unassigned
smarty3 (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

smarty 3.1.39-2ubuntu1 template parsing code is broken :

dpkg -l | grep smarty
ii smarty3 3.1.39-2ubuntu1 all Smarty - the compiling PHP template engine

Given this test.php file :

<?php

require('/usr/share/php/smarty3/Smarty.class.php');
$smarty = new Smarty();
$smarty->testInstall();

$smarty->assign('name', 'Ned');
$smarty->display('index.tpl');

?>

and those directories :

ls
cache configs templates templates_c test.php test.php~

find
.
./templates
./templates/index.tpl
./cache
./templates_c
./configs
./test.php~
./test.php

php test.php
<PRE>
Smarty Installation test...
Testing template directory...
/test/templates is OK.
Testing compile directory...
/test/templates_c is OK.
Testing plugins directory...
/usr/share/php/smarty3/plugins is OK.
Testing cache directory...
/test/cache is OK.
Testing configs directory...
/test/configs/ is OK.
Testing sysplugin files...
... OK
Testing plugin files...
... OK
Tests complete.
</PRE>
PHP Parse error: syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24

problem is from a line containing 0 :

(...)
// line "./lexer/smarty_internal_templateparser.y"
0
// line 11 "./lexer/smarty_internal_templateparser.y"

/**
* Smarty Template Parser Class
*
* This is the template parser.
* It is generated from the smarty_internal_templateparser.y file
*
* @author Uwe Tews <email address hidden>
*/
class Smarty_Internal_Templateparser

Revision history for this message
philippe lhardy (artlog) wrote :

cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

Revision history for this message
philippe lhardy (artlog) wrote :
Revision history for this message
philippe lhardy (artlog) wrote :

This bug is major since it just make smarty3 totally unusable under ubuntu 22.04 for everybody.
It took me some time to open it just because i wondered how nobody else did hit this problem.
In fact i guess that many projects don't use system smarty3 library but either from code or another version like smarty4.

Revision history for this message
Ed Martin (edman007) wrote (last edit ):

Same issue on debian, I put in the bug here https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1021571

Revision history for this message
Mike Gabriel (sunweaver) wrote (last edit ):
Revision history for this message
Mike Gabriel (sunweaver) wrote :

Resolved via

https://salsa.debian.org/debian/smarty-lexer/-/commit/02985244bfb9062a708a7fd70235cfe06fc2f10f

in smarty-lexer. Src:pkgs smarty3 + smarty4 need a rebuild against smarty-lexer containing the above mentioned fix.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in smarty3 (Ubuntu):
status: New → Confirmed
Revision history for this message
Harald Hetzner (haraldhetzner) wrote :

This bug prevents FusionDirectory (1.3-4build1) from working in 22.04.1 LTS.

Parse error: syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in fusiondirectory (Ubuntu):
status: New → Confirmed
Revision history for this message
Harald Hetzner (haraldhetzner) wrote :

Will this bug ever be resolved? As of #6 from 2022-10-25 the solution seems to be clear, but he smarty package in jammy has not been updated so far.

Revision history for this message
Seth Arnold (seth-arnold) wrote :

Harald, you can find some guidance on how to prepare an update for sponsoring on https://wiki.ubuntu.com/StableReleaseUpdates

Thanks

Revision history for this message
Zertrin (zertrin) wrote :

For reference to other users waiting for an update, I resolved myself to directly edit /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on the three locations where there was a stray 0 (one near the beginning, one at line 2838 and the last one at the very end of the file).

Not great to edit files managed by the package manager, but I really needed an immediate temporary solution and this did it.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.