Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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 #681

Open
vgdko opened this issue Jul 19, 2022 · 6 comments

Comments

@vgdko
Copy link

vgdko commented Jul 19, 2022

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

@coudot coudot added the bug label Jul 19, 2022
@coudot
Copy link
Member

coudot commented Jul 19, 2022

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

@artlog
Copy link

artlog commented Jul 20, 2022

@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
Copy link

artlog commented Aug 18, 2022

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
Copy link

artlog commented Aug 18, 2022

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

@coudot
Copy link
Member

coudot commented Aug 18, 2022

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 coudot added the wontfix label Sep 1, 2022
@coudot coudot changed the title PHP Parse error: syntax error [Smarty Bug] PHP Parse error: syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24 Sep 1, 2022
@coudot coudot changed the title [Smarty Bug] PHP Parse error: syntax error, unexpected token "class" in /usr/share/php/smarty3/sysplugins/smarty_internal_templateparser.php on line 24 [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 Sep 1, 2022
@alanorth
Copy link

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants