Fixed $config.php can no longer safely touch \XF::app()->error() for all XF\App implementations

Xon

Well-known member
Affected version
2.3.2
config.php used to allow safely touching a few parts of XF application object., But XF2.3.2 changed something with the XF bootstrapping process, that impacts the \XF\Installer\App context.

When using the installer app (ie php cmd.php xf:upgrade) having \XF::app()->error(); in the config.php causes a hard php interpreter error.

It either causes a core dump (php 8.2) or the following error for php 8.3:
Code:
PHP Fatal error:  Maximum call stack size of 8339456 bytes (zend.max_allowed_stack_size - zend.reserved_stack_size) reached during compilation. Try splitting expression in /var/www/html/src/config.php on line 12

This looks to be from recursive php file inclusion of config.php
 
Last edited:
The install app configures the error object to force traces when there are pending upgrades. This involves a database call, which in turn requires the database configuration, and hence the config file. Touching \XF::app()->error() in config.php crashes the install app on XF 2.2.16 for me all the same.

I'll see what we can do, but given the config file is part of the bootstrapping process this might just not be something we support.
 
I would prefer if XF would just guard against recursive inclusion of config.php, and if it happens the best solution would be to just die with a hard error. And in debug mode dump an error to standard out about the misconfiguration. In developer mode a stacktrace would be nice :D
 
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.3.3).

Change log:
Throw an error when attempting to recursively load config file
There may be a delay before changes are rolled out to the XenForo Community.
 
Back
Top Bottom