Fixed Guest poll create bugsplats

Affected version
2.2.6

Lukas W.

Well-known member
When creating a poll as a guest, the following error line will fail, since $thread->User appears to be set, but the value is null regardless:

XF\Service\Poll\Creator Line 127
PHP:
if (isset($content->User) && $content->User->user_id != \XF::visitor()->user_id)

Code:
ErrorException: [E_WARNING] Attempt to read property "user_id" on null in src\XF\Service\Poll\Creator.php at line 127
XF::handlePhpError() in src\XF\Service\Poll\Creator.php at line 127
XF\Service\Poll\Creator->_save() in src\XF\Service\ValidateAndSavableTrait.php at line 40
XF\Service\Poll\Creator->save() in src\XF\Service\Thread\TypeData\PollCreator.php at line 58
XF\Service\Thread\TypeData\PollCreator->_save() in src\XF\Service\ValidateAndSavableTrait.php at line 40
XF\Service\Thread\TypeData\PollCreator->save() in src\XF\Service\Thread\Creator.php at line 521
XF\Service\Thread\Creator->_save() in src\XF\Service\ValidateAndSavableTrait.php at line 40
XF\Service\Thread\Creator->save() in src\XF\Pub\Controller\Forum.php at line 910
XF\Pub\Controller\Forum->actionPostThread() in src\XF\Mvc\Dispatcher.php at line 350
XF\Mvc\Dispatcher->dispatchClass() in src\XF\Mvc\Dispatcher.php at line 257
XF\Mvc\Dispatcher->dispatchFromMatch() in src\XF\Mvc\Dispatcher.php at line 113
XF\Mvc\Dispatcher->dispatchLoop() in src\XF\Mvc\Dispatcher.php at line 55
XF\Mvc\Dispatcher->run() in src\XF\App.php at line 2344
XF\App->run() in src\XF.php at line 512
XF::runApp() in index.php at line 20
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.7).

Change log:
Fix an issue preventing guests from creating polls
There may be a delay before changes are rolled out to the XenForo Community.
 
Top