self-service-password icon indicating copy to clipboard operation
self-service-password copied to clipboard

[Debian smarty package bug] PHP Parse error: syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24

Open vgdko opened this issue 2 years ago • 6 comments

browser shows only blank main-page

in the apache-log following error pops up on every web-page-access …

[Tue Jul 19 11:49:44.774148 2022] [php:error] [pid 23813] [client 172.16.250.73:35968] PHP Parse error:  syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24

OS="Ubuntu 21.10" smarty ... "smarty3/impish-updates,impish-security,now 3.1.39-2ubuntu0.21.10.1 all [installed]"

misc php-packages are installed, eg… php-common/impish,now 2:82~0build1 php8.0-common/impish-updates

vgdko avatar Jul 19 '22 14:07 vgdko

Hello, the bug seems to be in Smarty, you should report this to ubuntu packagers

coudot avatar Jul 19 '22 15:07 coudot

@vgdko You might want to switch to ubuntu 22.04. ubuntu impish (21.10) was an interim release and is currently end of life since July 14, 2022.

source : https://wiki.ubuntu.com/Releases?_ga=2.133627726.173820398.1658294831-1596732122.1658294831

artlog avatar Jul 20 '22 05:07 artlog

This problem still exists in 22.04 package. There is now a bug report for it : https://bugs.launchpad.net/ubuntu/+source/smarty3/+bug/1986916

Since this smarty3 package is broken in 22.04. It should be installed manually from source

artlog avatar Aug 18 '22 07:08 artlog

here a hacky way to replace smarty3 broken package with source based one, this is a temporary hack until ubuntu version gets fixed. Warning it does not uninstall package smarty3 at all, just overwrite it.

bash script

#!/bin/bash

smarty_version=v3.1.46

rm -rf /usr/share/php/smarty3/ 

mkdir -p /usr/share/php/smarty3/ && \
    curl -Lqs https://github.com/smarty-php/smarty/archive/${smarty_version}.tar.gz | \
    tar xzf - -C /usr/share/php/smarty3/ --strip-components=2

artlog avatar Aug 18 '22 09:08 artlog

We could also install Smarty in another location (for example /usr/local/smarty3) and change the configuration in conf/config.inc.local.php :

define("SMARTY", "/usr/local/smarty3/Smarty.class.php");

coudot avatar Aug 18 '22 09:08 coudot

Oh this is an unfortunate bug seeing as it has been fixed upstream months ago. A less ugly fix is to use smarty3 from Debian unstable:

# wget http://ftp.us.debian.org/debian/pool/main/s/smarty3/smarty3_3.1.47-2_all.deb
# dpkg -i smarty3_3.1.47-2_all.deb

This is working for me in Ubuntu 22.04.2. I'm not sure if I want to do this long term, but it works for now...

alanorth avatar Mar 22 '23 21:03 alanorth