Duplicate Unfurl error due to apostrophe in internal link

yodiceman

Member
Affected version
2.2.13
We've been getting the following error and it shows up when someone posts an internal link with an apostrophe in the URL. When "Unfurl URL to a rich preview automatically" is checked, we get the error below. When it is unchecked, it will post the text of the URL, but it doesn't automatically link. If I remove the apostrophe manually in the link I'm posting, everything works as it should - no errors and the unfurl works. We shouldn't have to manually remove the apostrophe each time should we? This will be a problem for our users.

This is what is trying to be posted/linked:


I can go to that URL from any browser just fine, but when I try to link to this from our forum, I get the following error:


Server error log
  • TypeError: XF\Util\Url::urlToUtf8(): Argument #1 ($url) must be of type string, null given, called in /home/debatepo/public_html/src/XF/BbCode/ProcessorAction/AutoLink.php on line 430
  • src/XF/Util/Url.php:50
  • Generated by: ASHES
  • Oct 17, 2023 at 7:49 AM

Stack trace​

#0 src/XF/BbCode/ProcessorAction/AutoLink.php(430): XF\Util\Url::urlToUtf8(NULL, false)
#1 src/XF/BbCode/ProcessorAction/AutoLink.php(149): XF\BbCode\ProcessorAction\AutoLink->unfurlLinkUrl('https://debatep...')
#2 [internal function]: XF\BbCode\ProcessorAction\AutoLink->XF\BbCode\ProcessorAction\{closure}(Array)
#3 src/XF/BbCode/ProcessorAction/AutoLink.php(146): preg_replace_callback('#^(?<=[^a-z0-9@...', Object(Closure), 'So he listened ...')
#4 src/XF/BbCode/Processor.php(377): XF\BbCode\ProcessorAction\AutoLink->filterString('So he listened ...', Array, Object(XF\BbCode\Processor))
#5 src/XF/BbCode/Processor.php(360): XF\BbCode\Processor->filterString('So he listened ...', Array)
#6 src/XF/BbCode/Traverser.php(67): XF\BbCode\Processor->renderString('So he listened ...', Array)
#7 src/XF/BbCode/Traverser.php(39): XF\BbCode\Traverser->renderSubTree(Array, Array)
#8 src/XF/BbCode/Traverser.php(22): XF\BbCode\Traverser->renderAst(Array, Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#9 src/XF/Service/Message/Preparer.php(164): XF\BbCode\Traverser->render('So he listened ...', Object(XF\BbCode\Parser), Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#10 src/XF/Service/Message/Preparer.php(129): XF\Service\Message\Preparer->processMessage('So he listened ...')
#11 src/XF/Service/Post/Preparer.php(98): XF\Service\Message\Preparer->prepare('So he listened ...', true)
#12 src/XF/Service/Post/Editor.php(129): XF\Service\Post\Preparer->setMessage('So he listened ...', true, true)
#13 src/XF/Pub/Controller/Post.php(58): XF\Service\Post\Editor->setMessage('So he listened ...')
#14 src/XF/Pub/Controller/Post.php(127): XF\Pub\Controller\Post->setupPostEdit(Object(SV\ThreadReplyBanTeeth\XF\Entity\Post))
#15 src/XF/Mvc/Dispatcher.php(352): XF\Pub\Controller\Post->actionEdit(Object(XF\Mvc\ParameterBag))
#16 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'Edit', Object(XF\Mvc\RouteMatch), Object(SV\ThreadReplyBanTeeth\XF\Pub\Controller\Post), NULL)
#17 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\ThreadReplyBanTeeth\XF\Pub\Controller\Post), NULL)
#18 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#20 src/XF.php(524): XF\App->run()
#21 index.php(20): XF::runApp('XF\\Pub\\App')
#22 {main}

Request state​

array(4) {
["url"] => string(22) "/posts/1078628667/edit"
["referrer"] => string(186) "https://debatepolitics.com/threads/...d-use-litter-boxes-instead-of-toilets.524059/"
["_GET"] => array(0) {
}
["_POST"] => array(8) {
["_xfToken"] => string(8) "********"
["_xfInlineEdit"] => string(1) "1"
["message_html"] => string(218) "<p>So he listened to Joe Rogan?</p><p><br></p><p>https://debatepolitics.com/threads/...her-daughter’s-school-to-install-a-litter-box</p>"
["attachment_hash"] => string(32) "44c5a05fbe9c7a517ceb8867f50b7e94"
["attachment_hash_combined"] => string(90) "{"type":"post","context":{"post_id":1078628667},"hash":"44c5a05fbe9c7a517ceb8867f50b7e94"}"
["_xfRequestUri"] => string(160) "/threads/republican-candidate-for-nc-governor-tells-audience-that-public-schools-allow-children-to-dress-as-cats-and-use-litter-boxes-instead-of-toilets.524059/"
["_xfWithData"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
 
Top Bottom