Fixed PHP 8.1: ErrorException: [E_DEPRECATED] htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

TickTackk

Well-known member
Affected version
2.1.8
Code:
ErrorException: [E_DEPRECATED] htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated src/XF/Api/Docs/Renderer/SimpleHtml.php:99
Code:
#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '<snipped>', 99)
#1 src/XF/Api/Docs/Renderer/SimpleHtml.php(99): htmlspecialchars(NULL)
#2 src/XF/Api/Docs/Renderer/SimpleHtml.php(35): XF\Api\Docs\Renderer\SimpleHtml->renderRoute(Object(XF\Api\Docs\Annotation\RouteBlock))
#3 src/XF/Api/Docs/Renderer/FileRendererTrait.php(60): XF\Api\Docs\Renderer\SimpleHtml->renderInternal(Array, Array)
#4 src/XF/Api/Docs/Compiler.php(235): XF\Api\Docs\Renderer\SimpleHtml->render(Array, Array)
#5 src/XF/Cli/Command/Development/GenerateApiDocs.php(95): XF\Api\Docs\Compiler->render(Object(XF\Api\Docs\Renderer\SimpleHtml))
#6 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\Development\GenerateApiDocs->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 src/XF/Cli/Command/Development/RequiresDevModeTrait.php(20): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 src/vendor/symfony/console/Application.php(992): XF\Cli\Command\Development\GenerateApiDocs->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\Development\GenerateApiDocs), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 src/XF/Cli/Runner.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 cmd.php(15): XF\Cli\Runner->run()
#13 {main}
 

XF Bug Bot

XenForo bug fixer bot
Staff member
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.2.9).

Change log:
Improve PHP 8.1 compatibility within the API docs generator
There may be a delay before changes are rolled out to the XenForo Community.
 
Top