Not a bug v1.5.23 -> v2.1.0 b5 Upgrade - PHP Fatal error accessing /install/

Mouth

Well-known member
Affected version
2.1.0
At step 3 of https://xenforo.com/xf2-docs/manual/install-upgrade/

Visiting /install/ -> "server is currently unable to handle this request. HTTP ERROR 500"

Code:
2018/12/17 11:11:45 [error] 52205#52205: *252806 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Class 'XenForo_Application' not found in library/config.php:31
Stack trace:
#0 src/XF/App.php(169): require()
#1 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#2 src/XF/App.php(580): XF\Container->offsetGet('config')
#3 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 src/XF/App.php(2328): XF\Container->offsetGet('db')
#5 src/XF/Error.php(45): XF\App->db()
#6 src/XF/Install/App.php(48): XF\Error->hasPendingUpgrade()
#7 src/XF/Container.php(159): XF\Install\App->XF\Install\{closure}(Object(XF\Error), Object(XF\Container))
#8 src/XF/Container.php(28): XF\Container->XF\{closure}(Object(XF\Container))
#9 src/XF/App.php(2513): XF\Container->offsetGet('error')
#10 ...PHP message: PHP Fatal error:  Uncaught Error: Class 'XenForo_Application' not found in library/config.php:31
Stack trace:
#0 src/XF/App.php(169): require()
#1 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#2 src/XF/App.php(580): XF\Container->offsetGet('config')
#3 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 src/XF/App.php(2328): XF\Container->offsetGet('db')
#5 src/XF/Error.php(45): XF\App->db()
#6 src/XF/Install/App.php(48): XF\Error->hasPendingUpgrade()
#7 src/XF/Container.php(159): XF\Install\App->XF\Install\{closure}(Object(XF\Error), Object(XF\Container))
#8 src/XF/Container.php(28): XF\Container->XF\{closure}(Object(XF\Container))
#9 src/XF/App.php(

library/config.php:31 ....
Code:
require(XenForo_Application::getInstance()->getConfigDir().'/SV/RedisCache/Installer.php');

Had to comment out this line to allow /install/ to work.

XF1->XF2 upgrades should probably ignore 'require' and/or 'XenForo_Application' calls?
 
There's not really a way we can do that, unfortunately.

FWIW I suspect @Xon might want/need to update his documentation if that's the advice coming from one of his add-ons.

There is generally no expectation that the config file would contain any usage of the XF framework directly.
 
I've upgraded the add-on description, but any add-on which may suggest changes to config.php needs to be checked before upgrading
 
There's not really a way we can do that, unfortunately.
You could tokenize config.php and reject it if it contains anything that is unecpected or only use known elements, but that would be a major task and most likely not worth the effort.
Adding a try-catch for PHP 7 to give a more friendly error message would be nice though.
 
Last edited:
Top Bottom