Duplicate Maybe a bug when running pending rebuild job


Affected version
2.2.8 patch 1
Dear friends,
I'm running php xf 2.2.8 patch 1 (not the last version, I know), on Php 8.1

Today, while developing my addon on my dev environment, I noticed the yellow message on the admin dashboard "there are rebuild jobs pending, rebuild now" (or similar, I can not remember exactly the wording).
When clicking on the link, the process fails with the following exception:

Server error log
  • ErrorException: [E_DEPRECATED] str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
  • src/XF/Job/AddOnUninstallData.php:76
  • Generated by: Admin
  • Mar 5, 2023 at 10:50 AM

Stack trace​

#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/var/www/bla bla...', 76)
#1 src/XF/Job/AddOnUninstallData.php(76): str_replace('_', ' ', NULL)
#2 src/XF/Admin/Controller/Tools.php(176): XF\Job\AddOnUninstallData->getStatusMessage()
#3 src/XF/Mvc/Dispatcher.php(352): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#4 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#5 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Admin\Controller\Tools), NULL)
#6 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#7 src/XF/App.php(2351): XF\Mvc\Dispatcher->run()
#8 src/XF.php(517): XF\App->run()
#9 admin.php(13): XF::runApp('XF\\Admin\\App')
#10 {main}

Request state​

array(4) {
["url"] => string(24) "/admin.php?tools/run-job"
["referrer"] => string(38) "https:/bla bla bla/admin.php"
["_GET"] => array(1) {
["tools/run-job"] => string(0) ""
["_POST"] => array(0) {

I managed to finish the rebuild jobs by changing a little bit the XF\Job\AddOnUninstallData->getStatusMessage() method to:
public function getStatusMessage(){
// TODO: These (and the types) probably should be phrased
$actionPhrase = 'Deleting';
$typePhrase = 'Add-on data';

//  $currentType = ucfirst(str_replace('_', ' ', $this->currentType)); //In php 8.1 the subject can not be null

if ($this->currentType)
$currentType = ucfirst(str_replace('_', ' ', $this->currentType));
return sprintf('%s... %s (%s)', $actionPhrase, $typePhrase, $currentType);
return sprintf('%s... %s', $actionPhrase, $typePhrase);

Maybe this little bug has been already addressed in higher versions of XF than 2.2.8 patch1, but I only wanted to let you know just in the case it was not

Top Bottom