Not a bug Email-related error when sending or replying to conversation

Liam W

in memoriam 1998-2020
Affected version
2.0.0 Beta 4
Code:
InvalidArgumentException: DOMXPath::query(): Invalid expression in selector >> @CHARSET "UTF-8"; body << in /home/nginx/domains/lw-addons.net/public/src/vendor/pelago/emogrifier/Classes/Emogrifier.php on line 370 src/vendor/pelago/emogrifier/Classes/Emogrifier.php:1532

Stack trace:

Code:
#0 [internal function]: Pelago\Emogrifier->handleXpathError(2, 'DOMXPath::query...', '/home/nginx/dom...', 370, Array)
#1 src/vendor/pelago/emogrifier/Classes/Emogrifier.php(370): DOMXPath->query('//@CHARSET "UTF...')
#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)
#5 src/XF/Mail/Mail.php(210): XF\Mail\Mailer->renderMailTemplate('conversation_re...', Array, Object(XF\Language), Object(LiamW\VanityNames\XF\Entity\User))
#6 src/XF/Mail/Mail.php(248): XF\Mail\Mail->renderTemplate()
#7 src/XF/Mail/Mail.php(266): XF\Mail\Mail->getSendableMessage()
#8 src/XF/Service/Conversation/Notifier.php(115): XF\Mail\Mail->queue()
#9 src/XF/Service/Conversation/Notifier.php(65): XF\Service\Conversation\Notifier->_sendNotifications('reply', Array, Object(XF\Entity\ConversationMessage))
#10 src/XF/Service/Conversation/Replier.php(154): XF\Service\Conversation\Notifier->notifyReply(Object(XF\Entity\ConversationMessage))
#11 src/XF/Service/Conversation/Replier.php(133): XF\Service\Conversation\Replier->sendNotifications()
#12 src/XF/Service/ValidateAndSavableTrait.php(40): XF\Service\Conversation\Replier->_save()
#13 src/XF/Pub/Controller/Conversation.php(485): XF\Service\Conversation\Replier->save()
#14 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Conversation->actionAddReply(Object(XF\Mvc\ParameterBag))
#15 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Conversation', 'AddReply', 'json', Object(XF\Mvc\ParameterBag), 'conversations', Object(XF\Pub\Controller\Conversation), NULL)
#16 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#17 src/XF/App.php(1787): XF\Mvc\Dispatcher->run()
#18 src/XF.php(326): XF\App->run()
#19 index.php(13): XF::runApp('XF\\Pub\\App')
#20 {main}

Request state:

Code:
array(4) {
  ["url"] => string(40) "/conversations/<snip>/add-reply"
  ["referrer"] => string(52) "https://lw-addons.net/conversations/<snip>/"
  ["_GET"] => array(1) {
    ["/conversations/<snip>/add-reply"] => string(0) ""
  }
  ["_POST"] => array(9) {
    ["message_html"] => string(122) "<snip>"
    ["attachment_hash"] => string(32) "d0e04b756df2e17bb63356501d22b898"
    ["attachment_hash_combined"] => string(105) "{"type":"conversation_message","context":{"conversation_id":1},"hash":"d0e04b756df2e17bb63356501d22b898"}"
    ["last_date"] => string(10) "1506602820"
    ["last_known_date"] => string(1) "0"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(31) "/conversations/<snip>/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
@Xon it looks like your redis cache add-on is to blame here.
:oops:

This might be some css weirdness. I'll have a look.

:edit: fixed, I cache the entire css response + charset to allow sending from cache -> php -> network without reencoding (just the string copy) if the requestor supports GZ encoding; but missed I needed to strip out the charset header for internal usage.
 
Last edited:
Top Bottom