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

Low-level PHP 8.2.0 crash #4938

Closed
Deltik opened this issue Jan 2, 2023 · 0 comments · Fixed by #4939
Closed

Low-level PHP 8.2.0 crash #4938

Deltik opened this issue Jan 2, 2023 · 0 comments · Fixed by #4939
Assignees
Labels
status: pending This issue is being worked on or is in the backlog to be fixed. type: bug A problem that should not be happening

Comments

@Deltik
Copy link
Member

Deltik commented Jan 2, 2023

Bug Description

The admin area (/e107_admin/admin.php) won't load on PHP 8.2.0, at least on Linux.

How to Reproduce

Run the latest e107 master revision on PHP 8.2.0 and navigate to the admin area. You'll probably get an HTTP 500 Internal Server Error with no exception logged. If running on Apache, you may see that the script ended abruptly like this:

[Mon Jan 02 06:44:12.532437 2023] [fcgid:warn] [pid 1080114:tid 140472727098944] (104)Connection reset by peer: [client [REDACTED]:0] mod_fcgid: error reading data from FastCGI server, referer: https://www.deltik.net/
[Mon Jan 02 06:44:12.532475 2023] [core:error] [pid 1080114:tid 140472727098944] [client [REDACTED]:0] End of script output before headers: admin.php, referer: https://www.deltik.net/

Expected Behavior

The admin area loads as it did on PHP 8.1.13.

Server Information

PHP Operating System

Linux host1 5.15.0-30-generic #31-Ubuntu SMP Thu May 5 10:00:34 UTC 2022 x86_64

PHP Version

PHP Version 8.2.0

PHP Modules

bcmath
bz2
calendar
cgi-fcgi
Core
ctype
curl
date
dba
dom
enchant
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_dblib
PDO_Firebird
pdo_mysql
PDO_ODBC
pdo_pgsql
pdo_sqlite
pgsql
Phar
posix
pspell
random
readline
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tidy
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

Additional Information

The segmentation fault crashing PHP is probably php/php-src#10200.

This is the stack trace where e107 crashes:

#0 /build/e107/e107_handlers/xml_class.php(591): xmlClass->xml2array(Object(SimpleXMLElement), '...')
#1 /build/e107/e107_handlers/xml_class.php(533): xmlClass->xml2array(Object(SimpleXMLElement))
#2 /build/e107/e107_handlers/xml_class.php(873): xmlClass->parseXml('...', false)
#3 /build/e107/e107_handlers/theme_handler.php(1061): xmlClass->loadXMLfile('...', '...', true)
#4 /build/e107/e107_handlers/theme_handler.php(882): e_theme::parse_theme_xml('...')
#5 /build/e107/e107_handlers/theme_handler.php(487): e_theme::getThemeInfo('...')
#6 /build/e107/e107_handlers/theme_handler.php(78): e_theme->load(false)
#7 /build/e107/e107_handlers/e107_class.php(1148): e_theme->__construct(Array)
#8 /build/e107/e107_handlers/e107_class.php(1784): e107::getSingleton('...', '...', NULL, Array)
#9 /build/e107/e107_handlers/library_manager.php(2398): e107::getTheme('...', false)
#10 /build/e107/e107_handlers/library_manager.php(2355): e_library_manager->getExcludedLibraries()
#11 /build/e107/e107_handlers/library_manager.php(1922): e_library_manager->preLoad(Array, NULL, NULL)
#12 /build/e107/e107_handlers/library_manager.php(1899): e_library_manager->traverseLibrary(Array, '...')
#13 /build/e107/e107_handlers/library_manager.php(1479): e_library_manager->invoke('...', Array)
#14 /build/e107/e107_handlers/e107_class.php(2349): e_library_manager->load('...', NULL, Array)
#15 /build/e107/e107_handlers/js_manager.php(243): e107::library('...', '...')
#16 /build/e107/e107_handlers/js_manager.php(218): e_jsmanager->_init()
#17 /build/e107/e107_handlers/e107_class.php(2443): e_jsmanager::getInstance()
#18 /build/e107/e107_handlers/e107_class.php(2652): e107::getJs()
#19 /build/e107/e107_plugins/social/e_module.php(6): e107::css('...', '...')
#20 /build/e107/class2.php(773): require_once('...')
…
@Deltik Deltik added type: bug A problem that should not be happening status: pending This issue is being worked on or is in the backlog to be fixed. labels Jan 2, 2023
@Deltik Deltik self-assigned this Jan 2, 2023
Deltik added a commit to Deltik/e107 that referenced this issue Jan 2, 2023
… error

Casting a `SimpleXMLElement` to an array should be equivalent to
`get_object_vars(…)` as far as I can tell.  At least all existing
tests pass and I don't see any visual regressions upon making this
change.

By replacing `get_object_vars(…)` with a cast to array, we sidestep
this PHP 8.2.0 bug: php/php-src#10200

Fixes: e107inc#4938
CaMer0n added a commit that referenced this issue Jan 3, 2023
#4938: Workaround for PHP 8.2.0 segmentation fault / assertion error
Jimmi08 pushed a commit to hpkizi/e107 that referenced this issue Jan 3, 2023
Casting a `SimpleXMLElement` to an array should be equivalent to
`get_object_vars(…)` as far as I can tell.  At least all existing
tests pass and I don't see any visual regressions upon making this
change.

By replacing `get_object_vars(…)` with a cast to array, we sidestep
this PHP 8.2.0 bug: php/php-src#10200

Fixes: e107inc/e107#4938
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pending This issue is being worked on or is in the backlog to be fixed. type: bug A problem that should not be happening
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant