Skip to content

Fatal error: Uncaught TypeError in viewforum_shortcodes.php #4929

@theBlbDan

Description

@theBlbDan

Bug Description

When I apply a custom user class, i.e. a non fixed class, to a forum, it generates a Fatal error: Uncaught TypeError

Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /usr/www/public_html/e107_handlers/userclass_class.php:108 Stack trace: #0 /usr/www/public_html/e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php(245): user_class->getFixedClassDescription() #1 /usr/www/public_html/e107_handlers/shortcode_handler.php(1154): plugin_forum_viewforum_shortcodes->sc_viewable_by() #2 [internal function]: e_parse_shortcode->doCode() #3 /usr/www/public_html/e107_handlers/shortcode_handler.php(1020): preg_replace_callback() #4 /usr/www/public_html/e107_handlers/e_parse_class.php(848): e_parse_shortcode->parseCodes() #5 /usr/www/public_html/e107_plugins/forum/forum_viewforum.php(445): e_parse->parseTemplate() #6 /usr/www/public_html/e107_plugins/forum/forum_viewforum.php(56): forum_viewforum_front->init() #7 /usr/www/public_html/e107_plugins/forum/forum_viewforum.php(565): forum_viewforum_front->__construct() #8 /usr/www/public_html/index.php(69): include_once('...') #9 {main} thrown in /usr/www/public_html/e107_handlers/userclass_class.php on line 108

How to Reproduce

Steps to reproduce the behavior:

  1. Create a standard user class
  2. Add this class to a user
  3. Apply this class to the 'Visibility' of a forum and then visit this forum as above mentioned user
  4. You should get a similar stack trace as shown above.

Expected Behavior

Well, I kinda expect to apply custom user classes to forums to limit their visibility. It appears that in ./e107_plugins/forum/shortcodes/batch/viewforum_shortcodes.php(), it is passing an array which clearly won't work.

Server Information

PHP Operating System

Linux hosted5 5.15.82 #1 SMP Sat Dec 10 23:29:08 PST 2022 x86_64

PHP Version

PHP Version 8.1.12

PHP Modules

apache2handler
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
imap
intl
ionCube Loader
json
ldap
libxml
mbstring
mcrypt
mysqli
mysqlnd
odbc
openssl
pcre
PDO
pdo_dblib
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pspell
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
ssh2
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions