XF 2.1 When upgrading: ParseError: syntax error, unexpected 'Fn' (T_FN), expecting identifier (T_STRING) or '{' in src/XF/Template/Compiler.php at line 8

Lamp

Member
I'm not sure what exact version I was upgrading from (2.1.0 maybe) but on upgrade to 2.1.3 it encountered this error:

ParseError: syntax error, unexpected 'Fn' (T_FN), expecting identifier (T_STRING) or '{' in src/XF/Template/Compiler.php at line 8
  1. Composer\Autoload\includeFile() in src/vendor/composer/ClassLoader.php at line 322
  2. Composer\Autoload\ClassLoader->loadClass()
  3. spl_autoload_call() in src/XF/App.php at line 1292
  4. XF\App->XF\{closure}() in src/XF/Container.php at line 28
  5. XF\Container->offsetGet() in src/XF/App.php at line 2970
  6. XF\App->templateCompiler() in src/XF/Entity/Template.php at line 180
  7. XF\Entity\Template->validateTemplateText() in src/XF/Entity/Template.php at line 166
  8. XF\Entity\Template->verifyTemplate() in src/XF/Mvc/Entity/Entity.php at line 768
  9. XF\Mvc\Entity\Entity->_verifyValueCustom() in src/XF/Mvc/Entity/Entity.php at line 613
  10. XF\Mvc\Entity\Entity->set() in src/XF/Mvc/Entity/Entity.php at line 548
  11. XF\Mvc\Entity\Entity->__set() in src/XF/AddOn/DataType/BbCodeMediaSite.php at line 81
  12. XF\AddOn\DataType\BbCodeMediaSite->importAddOnData() in src/XF/Job/AddOnData.php at line 106
  13. XF\Job\AddOnData->run() in src/XF/Job/Atomic.php at line 38
  14. XF\Job\Atomic->run() in src/XF/Job/Manager.php at line 253
  15. XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 195
  16. XF\Job\Manager->runJobEntry() in src/XF/Job/Manager.php at line 146
  17. XF\Job\Manager->runUnique() in src/XF/Install/Controller/AbstractController.php at line 24
  18. XF\Install\Controller\AbstractController->manualJobRunner() in src/XF/Install/Controller/Upgrade.php at line 257
  19. XF\Install\Controller\Upgrade->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 321
  20. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 244
  21. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
  22. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
  23. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2178
  24. XF\App->run() in src/XF.php at line 390
  25. XF::runApp() in install/index.php at line 14
 
At least XenForo 2.1.3 2.1.4 is required for PHP 7.4.

This was reported as fixed for 2.1.3
but the fix was only complete in 2.1.4.

If you are running an older verision you will have to upgrade first.
 
Last edited:
And no one noticed in fix only for XF/Template/Templater in 2.1.3.
In XF 2.1.3, in XF/Template/Compiler uses class XF/Template/Compiler/Fn/AbstractFn. Potentially, PHP throws error because he see "reserved word" in namespace.
In XF 2.1.4 this namespace replaced on XF/Template/Compiler/Func/....
 
Back
Top Bottom