XF 2.2 ErrorException: [E_DEPRECATED] htmlspecialchars()

El Porcharo

Well-known member
I've just noticed that I have an error in my ACP which is from last Saturday night.

I can't remember exactly what I was doing (the error comes from one of the staff account's I'm using), but for sure I didn't touch the thread mentioned in the log (392) and I wasn't either using the feature provided by the add-on that's reported on line #8 and #12.

All I was doing was debugging a template modification that didn't seem to work.

I can't figure out what this might be due, I found a reported bug that was fixed which looks very similar but has different lines, so I assume it's not the same issue.

Furthermore, that /var/www/vhosts folder doesn't exist on my server.

Code:
ErrorException: [E_DEPRECATED] htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated src/XF/BbCode/Renderer/ApiHtml.php:109
Generated by: Admin2 Nov 25, 2023 at 9:40 PM

Stack trace​

Code:
#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/var/www/vhosts...', 109)
#1 src/XF/BbCode/Renderer/ApiHtml.php(109): htmlspecialchars(NULL)
#2 src/XF/BbCode/Renderer/Html.php(1126): XF\BbCode\Renderer\ApiHtml->getRenderedQuote('<h3><div style=...', NULL, Array, Array)
#3 src/XF/BbCode/Renderer/Html.php(316): XF\BbCode\Renderer\Html->renderTagQuote(Array, NULL, Array, Array, Object(XF\BbCode\Renderer\ApiHtml))
#4 src/XF/BbCode/Traverser.php(63): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#5 src/XF/BbCode/Traverser.php(39): XF\BbCode\Traverser->renderSubTree(Array, Array)
#6 src/XF/BbCode/Traverser.php(22): XF\BbCode\Traverser->renderAst(Array, Object(XF\BbCode\RuleSet), Array)
#7 src/XF/SubContainer/BbCode.php(222): XF\BbCode\Traverser->render('[CENTER][URL='h...', Object(XF\BbCode\Parser), Object(XF\BbCode\RuleSet), Array)
#8 src/XF/Entity/Post.php(929): XF\SubContainer\BbCode->render('[CENTER][URL='h...', 'apiHtml', 'post:api', Object(TickTackk\ChangeContentOwner\XF\Entity\Post))
#9 src/XF/Mvc/Entity/Entity.php(547): XF\Entity\Post->setupApiResultData(Object(XF\Api\Result\EntityResult), 1, Array)
#10 src/XF/Mvc/Entity/AbstractCollection.php(47): XF\Mvc\Entity\Entity->toApiResult(1, Array)
#11 src/XF/Api/Controller/Thread.php(243): XF\Mvc\Entity\AbstractCollection->toApiResults()
#12 src/XF/Api/Controller/Thread.php(119): XF\Api\Controller\Thread->getPostsInThreadPaginated(Object(TickTackk\ChangeContentOwner\XF\Entity\Thread), 1)
#13 src/XF/Mvc/Dispatcher.php(352): XF\Api\Controller\Thread->actionGetPosts(Object(XF\Mvc\ParameterBag))
#14 src/XF/Api/Mvc/Dispatcher.php(27): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'Getposts', Object(XF\Api\Mvc\RouteMatch), Object(XF\Api\Controller\Thread), NULL)
#15 src/XF/Mvc/Dispatcher.php(115): XF\Api\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Api\Mvc\RouteMatch), Object(XF\Api\Controller\Thread), NULL)
#16 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Api\Mvc\RouteMatch))
#17 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#18 src/XF.php(524): XF\App->run()
#19 index.php(16): XF::runApp('XF\\Api\\App')
#20 {main}

Request state​

Code:
array(4) {
  ["url"] => string(23) "//api/threads/392/posts"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }

And the only reference I have in the server log is this one by an IP from another country:

1701093378107.png
 
That is not atypical if running PHP 8.1 or PHP 8.2. The reason you saw it was that you were in development mode. Normally that error is hidden from the log file.
If from an add-on, you may want to contact that add-on author to see if they will update it.
 
Back
Top Bottom