Inconsistent typing of stopSmilies in EmailHtml renderer

pegasus

Well-known member
Affected version
2.2.15
An E_WARNING appears to be thrown if a BB-Code is rendered using the email renderer which contains stopSmilies in its rules. The email renderer contains a default stopSmilies value which appears inconsistent with the stopSmilies implementation.

Background:
A user of our add-on recently submitted the following error message on our site, assuming it was a bug in our add-on probably because a lot of the classes in the trace were most recently extended by the add-on. But further investigation strongly suggests that the parent XenForo code had actually thrown the error, and appeared to be inconsistent with other XenForo code as cited. I do not have reproduction steps or know the full content that is required to get the parser to throw this error, since this was reported by another user.

Error:
Code:
ErrorException: Template error: [E_WARNING] Increment on type bool has no effect, this will change in the next major version of PHP src/XF/BbCode/Renderer/Html.php:296
Trace:
Code:
#0 src/XF/BbCode/Renderer/Html.php(296): XF\Template\Templater->handleTemplateError(2, '[E_WARNING] Inc...', '/var/www/vhosts...', 296)
#1 src/addons/vw/vw/XF/BbCode/Renderer/EmailHtml.php(475): XF\BbCode\Renderer\Html->renderTag(Array, Array)
#2 src/XF/BbCode/Traverser.php(63): vw\vw\XF\BbCode\Renderer\EmailHtml->renderTag(Array, Array)
#3 src/addons/vw/vw/XF/BbCode/Renderer/EmailHtml.php(505): XF\BbCode\Traverser->renderSubTree(Array, Array)
#4 src/XF/BbCode/Traverser.php(39): vw\vw\XF\BbCode\Renderer\EmailHtml->renderSubTree(Array, Array)
#5 src/addons/vw/vw/XF/BbCode/Renderer/EmailHtml.php(137): XF\BbCode\Traverser->renderAst(Array, Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#6 src/XF/BbCode/Traverser.php(22): vw\vw\XF\BbCode\Renderer\EmailHtml->renderAst(Array, Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#7 src/addons/vw/vw/XF/BbCode/Renderer/EmailHtml.php(132): XF\BbCode\Traverser->render('[USER=18876]@to...', Object(vw\vw\XF\BbCode\Parser), Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#8 src/addons/vw/vw/XF/BbCode/Renderer/EmailHtml.php(92): vw\vw\XF\BbCode\Renderer\EmailHtml->vwParentRender('[USER=18876]@to...', Object(vw\vw\XF\BbCode\Parser), Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#9 src/XF/SubContainer/BbCode.php(222): vw\vw\XF\BbCode\Renderer\EmailHtml->render('[USER=18876]@to...', Object(vw\vw\XF\BbCode\Parser), Object(SV\SignupAbuseBlocking\XF\BbCode\RuleSet), Array)
#10 src/XF/Template/Templater.php(2391): XF\SubContainer\BbCode->render('[USER=18876]@to...', 'emailHtml', 'post', Object(XFMG\XF\Entity\Post), Array)
#11 src/XF/Template/Templater.php(2411): XF\Template\Templater->fnBbCode(Object(XF\Mail\Templater), false, '[USER=18876]@to...', 'post', Object(XFMG\XF\Entity\Post), Array, 'emailHtml')
#12 src/XF/Template/Templater.php(1132): XF\Template\Templater->fnBbCodeType(Object(XF\Mail\Templater), false, 'emailHtml', '[USER=18876]@to...', 'post', Object(XFMG\XF\Entity\Post))
#13 internal_data/code_cache/templates/l2/s3/email/watched_thread_reply.php(18): XF\Template\Templater->func('bb_code_type', Array, false)
#14 src/XF/Template/Templater.php(1655): XF\Template\Templater->{closure}(Object(XF\Mail\Templater), Array, NULL)
#15 src/XF/Mail/Mailer.php(224): XF\Template\Templater->renderTemplate('watched_thread_...', Array)
#16 src/XF/Mail/Mailer.php(158): XF\Mail\Mailer->renderPartialMailTemplate('watched_thread_...', Array, Object(vw\vw\XF\Language), Object(SV\SignupAbuseBlocking\XF\Entity\User))
#17 src/XF/Mail/Mail.php(411): XF\Mail\Mailer->renderMailTemplate('watched_thread_...', Array, Object(vw\vw\XF\Language), Object(SV\SignupAbuseBlocking\XF\Entity\User))
#18 src/XF/Mail/Mail.php(480): XF\Mail\Mail->renderTemplate()
#19 src/XF/Mail/Mail.php(590): XF\Mail\Mail->getSendableMessage()
#20 src/XF/Notifier/Post/AbstractWatch.php(137): XF\Mail\Mail->queue()
#21 src/XF/Service/AbstractNotifier.php(94): XF\Notifier\Post\AbstractWatch->sendEmail(Object(SV\SignupAbuseBlocking\XF\Entity\User ))
#22 src/XF/Service/AbstractNotifier.php(46): XF\Service\AbstractNotifier->notifyType(Object(XF\Notifier\Post\ThreadWatch), Array, 1.70773E+9)
#23 src/XF/Service/AbstractNotifier.php(58): XF\Service\AbstractNotifier->notify(3)
#24 src/XF/Service/Thread/Replier.php(252): XF\Service\AbstractNotifier->notifyAndEnqueue(3)
#25 src/XF/Pub/Controller/Thread.php(459): XF\Service\Thread\Replier->sendNotifications()
#26 src/XF/Pub/Controller/Thread.php(618): XF\Pub\Controller\Thread->finalizeThreadReply(Object(SV\SignupAbuseBlocking\XF\Ser vice\Thread\Replier))
#27 src/addons/AL/PostLimit/XF/Pub/Controller/Thread.php(13): XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#28 src/XF/Mvc/Dispatcher.php(352): AL\PostLimit\XF\Pub\Controller\Thread->actionAddReply(Object(XF\Mvc\ParameterBag))
#29 src/XF/Mvc/Dispatcher.php(258): XF\Mvc\Dispatcher->dispatchClass('XF:Thread', 'AddReply', Object(XF\Mvc\RouteMatch), Object(XFMG\XF\Pub\Controller\Thread), NULL)
#30 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XFMG\XF\Pub\Controller\Thread), NULL)
#31 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#32 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#33 src/XF.php(524): XF\App->run()
#34 index.php(20): XF::runApp('XF\\Pub\\App')
#35 {main}
Status der Anfrage
array(4) {
["url"] => string(59) "/forum/threads/modellbahnausstellungen-2024.66470/add-reply"
["referrer"] => string(79) "https://xxxforum/threads/modellbahnausstellungen-2024.66470/page-2"
["_GET"] => array(0) {
}
["_POST"] => array(10) {
["_xfToken"] => string(8) "********"
["message_html"] => string(486) "<p>xxxxx&nbsp;</p><p><br></p>"
["attachment_hash"] => string(32) "c8b2502669044510f5181d46254d89ea"
["attachment_hash_combined"] => string(87) "{"type":"post","context":{"thread_id":66470},"hash":"c8b 2502669044510f5181d46254d89ea"}"
["last_date"] => string(10) "1707727059"
["last_known_date"] => string(10) "1707727059"
["load_extra"] => string(1) "1"
["_xfRequestUri"] => string(56) "/forum/threads/modellbahnausstellungen-2024.66470/page-2"
["_xfWithData"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}
The error appears to be caused due to the following code. XF/BbCode/Renderer/EmailHtml.php getDefaultOptions:
Code:
$options['stopSmilies'] = true;
EmailHtml inherits renderTag from Html.
XF/BbCode/Renderer/Html.php renderTag:
Code:
$options['stopSmilies']++;
 
Apologies, this appears to be a duplicate of: https://xenforo.com/community/threads/php-8-3-warning-increment-on-type-bool.219147/
As a side note, it seems strange that the policy of XenForo is:
If the add-on developer believes there is a bug in XF, they can post a thread here with reproduction steps: https://xenforo.com/community/forums/bugs/
When a XenForo user mistakenly posts to the add-on developer, I would think the developer saying something like "you have posted this in the wrong place. Please contact the appropriate developer (XenForo) with the information. Here is additional evidence" would be sufficient. But XenForo then telling the user to go back to the first place they mistakenly reported it, and have that place make the report to XenForo instead, even though the user is the one who knows context and reproduction steps... makes no sense to me. Maybe that's just me though.
 
Top Bottom