Fixed Deselecting "Send unsubscribe requests via HTTP" fatally breaks forum

Sim

Well-known member
Affected version
2.2.14
If you uncheck the option to "Send unsubscribe requests via HTTP" without checking "Send unsubscribe requests via email", it fatally breaks the forum:

1706672651964.webp

Code:
Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /srv/www/xenforo22/src/XF/App.php:756 Stack trace: #0 /srv/www/xenforo22/src/XF/App.php(756): in_array('...', false) #1 /srv/www/xenforo22/src/XF/App.php(1959): XF\App->XF\{closure}(Object(ArrayObject), Object(XF\Container), '...') #2 /srv/www/xenforo22/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #3 /srv/www/xenforo22/src/XF/App.php(2725): XF\Container->offsetGet('...') #4 /srv/www/xenforo22/src/XF.php(838): XF\App->options() #5 /srv/www/xenforo22/src/XF/Entity/User.php(2431): XF::options() #6 /srv/www/xenforo22/src/addons/Hampel/ApprovalQueuePlus/XF/Entity/User.php(9): XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #7 /srv/www/xenforo22/src/addons/Hampel/HideAdverts/XF/Entity/User.php(36): Hampel\ApprovalQueuePlus\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #8 /srv/www/xenforo22/src/addons/XFMG/XF/Entity/User.php(74): Hampel\HideAdverts\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #9 /srv/www/xenforo22/src/addons/XFRM/XF/Entity/User.php(38): XFMG\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #10 /srv/www/xenforo22/src/XF/Mvc/Entity/Manager.php(72): XFRM\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #11 /srv/www/xenforo22/src/XF/Repository/User.php(86): XF\Mvc\Entity\Manager->getEntityStructure('...') #12 /srv/www/xenforo22/src/XF/Repository/User.php(32): XF\Repository\User->getGuestUser() #13 /srv/www/xenforo22/src/XF.php(586): XF\Repository\User->getVisitor(0) #14 /srv/www/xenforo22/src/XF/Error.php(137): XF::visitor() #15 /srv/www/xenforo22/src/XF/App.php(2519): XF\Error->logException(Object(TypeError), true, '') #16 /srv/www/xenforo22/src/XF.php(202): XF\App->logException(Object(TypeError), true) #17 [internal function]: XF::handleException(Object(TypeError)) #18 {main} thrown in /srv/www/xenforo22/src/XF/App.php on line 756

Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, bool given in /srv/www/xenforo22/src/XF/App.php:756 Stack trace: #0 /srv/www/xenforo22/src/XF/App.php(756): in_array('...', false) #1 /srv/www/xenforo22/src/XF/App.php(1959): XF\App->XF\{closure}(Object(ArrayObject), Object(XF\Container), '...') #2 /srv/www/xenforo22/src/XF/Container.php(31): XF\App->XF\{closure}(Object(XF\Container)) #3 /srv/www/xenforo22/src/XF/App.php(2725): XF\Container->offsetGet('...') #4 /srv/www/xenforo22/src/XF.php(838): XF\App->options() #5 /srv/www/xenforo22/src/XF/Entity/User.php(2431): XF::options() #6 /srv/www/xenforo22/src/addons/Hampel/ApprovalQueuePlus/XF/Entity/User.php(9): XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #7 /srv/www/xenforo22/src/addons/Hampel/HideAdverts/XF/Entity/User.php(36): Hampel\ApprovalQueuePlus\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #8 /srv/www/xenforo22/src/addons/XFMG/XF/Entity/User.php(74): Hampel\HideAdverts\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #9 /srv/www/xenforo22/src/addons/XFRM/XF/Entity/User.php(38): XFMG\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #10 /srv/www/xenforo22/src/XF/Mvc/Entity/Manager.php(72): XFRM\XF\Entity\User::getStructure(Object(XF\Mvc\Entity\Structure)) #11 /srv/www/xenforo22/src/XF/Repository/User.php(86): XF\Mvc\Entity\Manager->getEntityStructure('...') #12 /srv/www/xenforo22/src/XF/Repository/User.php(32): XF\Repository\User->getGuestUser() #13 /srv/www/xenforo22/src/XF.php(586): XF\Repository\User->getVisitor(0) #14 /srv/www/xenforo22/src/XF/Error.php(137): XF::visitor() #15 /srv/www/xenforo22/src/XF/App.php(2519): XF\Error->logException(Object(ErrorException), true, '') #16 /srv/www/xenforo22/src/XF.php(242): XF\App->logException(Object(ErrorException), true) #17 [internal function]: XF::handleFatalError() #18 {main} thrown in /srv/www/xenforo22/src/XF/App.php on line 756

I fixed it by editing the database directly to restore the default value for unsubscribeEmail.

I don't think this should be changed to a radio button (the option to not add any unsubscribe headers is valid), we just need more sanity checking for an unset option.
 
I had to run xf-dev:rebuild-caches from the CLI to get the site working again after editing the database - fortunately I was on my dev server, because this doesn't work on a prod server.

Is there an equivalent command to get the system to recognise the updated database options on a prod server?
 
I think rebuilding the master data should trigger a core cache rebuild.

That's what I was looking for - I keep missing that option.

I can confirm that xf:rebuild-master-data will fix the issue after editing the database to restore the default value for the option.
 
Back
Top Bottom