-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Fatal error: Uncaught TypeError in viewforum_shortcodes.php #4929
Comments
I can't confirm. PHP 8.1.4, latest e107 (2,3,3git), no issue. |
@theBlbDan which version of e107 are you using? It may very well be that this issue is already resolved in the latest update. Please try updating from Github before we look into this issue more closely. Please always make a backup of you website (files and database) before updating. There is an easy way to sync with Github:
Alternatively you can download the ZIP file with all the latest files included by hitting the green 'Clone or download' button at the top of this page: https://github.com/e107inc/e107 |
I was able to reproduce the bug on the latest revision of e107 (ec68c8891 at the time of writing) using the provided instructions. Here's my stack trace, which is basically the same:
|
In array (
0 =>
array (
'user_id' => '4',
'user_name' => 'newuser',
'user_class' => '248,3,6',
),
) But array (
0 => 'Everyone (public)',
252 => 'Guests',
255 => 'No One (inactive)',
253 => 'Members',
254 => 'Admin',
250 => 'Main Admin',
251 => 'Read Only',
247 => 'New Users',
246 => 'Search Bots',
) Judging from the name |
I will give this a try when I get back from Christmas break. Thanks. |
@theBlbDan No worries! Enjoy the Christmas break. It looks like the bug can be reproduced anyhow. So it still has to be fixed. |
The bug comes from 2dedb86b#diff-d8b2fba5d26ab6acc066765263788bb9005d4d98e7de39b04d888dce1781603dR151-R154, where there's a different return type (string) in the same method that returns an array of structures like this: array (
0 =>
array (
'user_id' => '4',
'user_name' => 'newuser',
'user_class' => '248,3,6',
),
) |
…Members()` Also, `e107forum::getForumClassMembers()` is now documented and deprecated because it has unintuitive return values. Fixes: e107inc#4929
Fixes #4929: Fix type mismatch in usage of `e107forum::getForumClassMembers()`
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:
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
PHP Version
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
The text was updated successfully, but these errors were encountered: