Users are double-posting

HRCTom

Member
Licensed customer
Nearly every time when the users reply to a thread, they get an error and click on reply again, resulting in a double post. I see this in the logs:
  • InvalidArgumentException: DOMXPath::query(): Invalid expression in selector >> body << in /home/hotrodcraft/public_html/theGarage/src/vendor/pelago/emogrifier/Classes/Emogrifier.php on line 370
  • src/vendor/pelago/emogrifier/Classes/Emogrifier.php:1532
  • Generated by: Tom
  • Nov 14, 2024 at 12:20 AM

Stack trace​

#0 [internal function]: Pelago\Emogrifier->handleXpathError(2, 'DOMXPath::query...', '/home/hotrodcra...', 370, Array)
#1 src/vendor/pelago/emogrifier/Classes/Emogrifier.php(370): DOMXPath->query('//')
#2 src/vendor/pelago/emogrifier/Classes/Emogrifier.php(289): Pelago\Emogrifier->process(Object(DOMDocument))
#3 src/XF/Mail/Styler.php(36): Pelago\Emogrifier->emogrify()
#4 src/XF/Mail/Mailer.php(189): XF\Mail\Styler->styleHtml('<!DOCTYPE html>...', true, Object(XF\Language))
#5 src/XF/Mail/Mail.php(277): XF\Mail\Mailer->renderMailTemplate('watched_thread_...', Array, Object(XF\Language), Object(XFMG\XF\Entity\User))
#6 src/XF/Mail/Mail.php(327): XF\Mail\Mail->renderTemplate()
#7 src/XF/Mail/Mail.php(358): XF\Mail\Mail->getSendableMessage()
#8 src/XF/Notifier/Post/AbstractWatch.php(128): XF\Mail\Mail->queue()
#9 src/XF/Service/AbstractNotifier.php(92): XF\Notifier\Post\AbstractWatch->sendEmail(Object(XFMG\XF\Entity\User))
#10 src/XF/Service/AbstractNotifier.php(44): XF\Service\AbstractNotifier->notifyType(Object(XF\Notifier\Post\ThreadWatch), Array, 1731543617.4804)
#11 src/XF/Service/AbstractNotifier.php(56): XF\Service\AbstractNotifier->notify(3)
#12 src/XF/Service/Thread/Replier.php(199): XF\Service\AbstractNotifier->notifyAndEnqueue(3)
#13 src/XF/Pub/Controller/Thread.php(300): XF\Service\Thread\Replier->sendNotifications()
#14 src/XF/Pub/Controller/Thread.php(433): XF\Pub\Controller\Thread->finalizeThreadReply(Object(XF\Service\Thread\Replier))
#15 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#16 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', 'json', Object(XF\Mvc\ParameterBag), 'forums', Object(XFMG\XF\Pub\Controller\Thread), NULL)
#17 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#18 src/XF/App.php(1931): XF\Mvc\Dispatcher->run()
#19 src/XF.php(328): XF\App->run()
#20 index.php(13): XF::runApp('XF\\Pub\\App')
#21 {main}

Request state​

array(4) {
["url"] => string(51) "/theGarage/index.php?threads/got-wood.112/add-reply"
["referrer"] => string(71) "https://hotrodcraft.com/theGarage/index.php?threads/got-wood.112/page-8"
["_GET"] => array(1) {
["threads/got-wood_112/add-reply"] => string(0) ""
}
["_POST"] => array(9) {
["message_html"] => string(560) "<p>
I have been absent for a while.&nbsp; Finally started to move into my new shop space, so I am getting my cars lined up to move in.&nbsp;&nbsp;</p><p><img src="/theGarage/index.php?attachments/frontv-jpg.300250/" data-attachment="full:300250" alt="300250" class="fr-fic fr-dii"><img src="/theGarage/index.php?attachments/rear-v-jpg.300251/" data-attachment="full:300251" alt="300251" class="fr-fic fr-dii">
</p><p>Nice Marc ! &nbsp;Are you keeping it stock? &nbsp; That might be a first for you! &nbsp;LOL</p>"
["attachment_hash"] => string(32) "776e1cb815a3869bdd2ad7540018c091"
["attachment_hash_combined"] => string(85) "{"type":"post","context":{"thread_id":112},"hash":"776e1cb815a3869bdd2ad7540018c091"}"
["last_date"] => string(10) "1731531490"
["last_known_date"] => string(10) "1731531490"
["_xfToken"] => string(8) "********"
["_xfRequestUri"] => string(48) "/theGarage/index.php?threads/got-wood.112/page-8"
["_xfWithData"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
Delete


Important note: The server OS was updated (AlmaLinux8.10) as well as PHP-FPM and MySQL8.
 
Important note: The server OS was updated (AlmaLinux8.10) as well as PHP-FPM and MySQL8.
Does this coincide with when the errors started? If you're really running XF 2.0.7, it's doubtful XF will run properly with anything beyond PHP 7.2.
 
You will need to be sure any custom styles and add-ons are compatible or you may run into other issues, but it will support newer versions of PHP properly.
 
Back
Top Bottom