Closed Digioso closed 1 year ago
This is a bug with your theme, GuildWars
, not a bug within the e107 core.
The theme is trying to access an undefined constant, PRELINK
, which has been disallowed since PHP 8.0:
A number of warnings have been converted into Error exceptions:
- […]
- Attempting to access unqualified constants which are undefined. Previously, unqualified constant accesses resulted in a warning and were interpreted as strings.
You will have to fix this in the theme. Some options:
Defensively access the constant, which may or may not be defined, using pure PHP:
defined("PRELINK") ? PRELINK : ""
Use the e107 core wrapper, deftrue()
, to default the undefined constant to a blank string:
deftrue("PRELINK")
Thanks!
I fixed it doing this:
define("PRELINK", ""); define("POSTLINK", ""); define("LINKSTART", "<img src='".THEME."images/bullet2.gif' alt='' /> "); define("LINKEND", "<br />"); define("LINKALIGN", "left"); define("LINKDISPLAY", 2);
Basically I added quotation marks to the name of the constant as described here: https://www.php.net/manual/en/function.define.php Funny enough all other constants were defined correctly with quotation marks in the theme.php file - except for the above.
Bug Description
From my webserver logfile: [Mon Jan 30 08:47:17.964055 2023] [proxy_fcgi:error] [pid 549159:tid 281473405612224] [client 88.130.87.199:0] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Undefined constant "PRELINK" in /home/digioso/web/baod.de/public_html/e107_themes/GuildWars/theme.php:157\nStack trace:\n#0 /home/digioso/web/baod.de/public_html/class2.php(1078): require_once()\n#1 /home/digioso/web/baod.de/public_html/index.php(58): require_once('...')\n#2 {main}\n thrown in /home/digioso/web/baod.de/public_html/e107_themes/GuildWars/theme.php on line 157'
How to Reproduce
Steps to reproduce the behavior:
Expected Behavior
No error.
Server Information
PHP Operating System
PHP Version
PHP Modules
bcmath bz2 calendar cgi-fcgi Core ctype curl date dom exif FFI fileinfo filter ftp gd gettext hash iconv imagick imap intl json ldap libxml mbstring mysqli mysqlnd openssl pcre PDO pdo_mysql pdo_pgsql pgsql Phar posix pspell random readline Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer xml xmlreader xmlwriter xsl Zend OPcache zip zlib
Client Information
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0
Additional Information
When I switch PHP back to PHP 7.4 the main website is loading without problems.