Not a bug Bugs Random.php:45

Affected version



I get the error

ErrorException: Could not generate random bytes of significant length in src/XF/Util/Random.php at line 45
XF\Util\Random::getRandomBytes() in src/XF.php at line 699
XF::generateRandomString() in src/XF/Repository/Attachment.php at line 25
XF\Repository\Attachment->getEditorData() in src/XF/Pub/Controller/Thread.php at line 1289
XF\Pub\Controller\Thread->getReplyAttachmentData() in src/XF/Pub/Controller/Thread.php at line 100
XF\Pub\Controller\Thread->actionIndex() in src/XF/Mvc/Dispatcher.php at line 249
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 89
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 41
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 1931
XF\App->run() in src/XF.php at line 328
XF::runApp() in index.php at line 13

I attach messages from the internal logs of the forum

ErrorException: Macro public:pAGE_CONTAINER :: search() error: Could not generate random bytes of significant length src/XF/Util/Random.php:45
Generated by: Unknown account, 1 August 2018 at 09: 00
Stack trace

#0 src/XF/Util/Random.php(55): XF\Util\Random::getRandomBytes(16)
#1 src/XF.php(703): XF\Util\Random::getRandomString(16)
#2 src/XF/App.php(742): XF::generateRandomString(16)
#3 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#4 src/XF/App.php(1967): XF\Container->offsetGet(‘csrf.token’)
#5 src/XF/Template/Templater.php(1999): XF\App->offsetGet(‘csrf.token’)
#6 [internal function]: XF\Template\Templater->fnCsrfInput(Object(XF\Template\Templater), false)
#7 src/XF/Template/Templater.php(880): call_user_func_array(Array, Array)
#8 internal_data/code_cache/templates/l2/s10/public/PAGE_CONTAINER.php(630): XF\Template\Templater->fn(‘csrf_input’)
#9 src/XF/Template/Templater.php(662): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Array)
#10 internal_data/code_cache/templates/l2/s10/public/PAGE_CONTAINER.php(516): XF\Template\Templater->callMacro(‘PAGE_CONTAINER’, ‘search’, Array, Array)
#11 src/XF/Template/Templater.php(662): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array, Array)
#12 internal_data/code_cache/templates/l2/s10/public/PAGE_CONTAINER.php(1032): XF\Template\Templater->callMacro(‘PAGE_CONTAINER’, ‘visitortabs’, Array, Array)
#13 src/XF/Template/Templater.php(1249): XF\Template\Templater->{closure}(Object(XF\Template\Templater), Array)
#14 src/XF/Pub/App.php(449): XF\Template\Templater->renderTemplate(‘PAGE_CONTAINER’, Array)
#15 src/XF/App.php(1766): XF\Pub\App->renderPageHtml(’\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n…’, Array, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#16 src/XF/Mvc/Dispatcher.php(310): XF\App->renderPage(’\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n…’, Object(XF\Mvc\Reply\View), Object(XF\Mvc\Renderer\Html))
#17 src/XF/Mvc/Dispatcher.php(44): XF\Mvc\Dispatcher->render(Object(XF\Mvc\Reply\View), ‘html’)
#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}
The contents of the query
array(4) {
[“url”] => string(74) “/xenforum/threads/sovetnik-na-osnove-indikatora-zaversheno-08-02-2016.577/”
[“referrer”] => bool(false)
["_GET"] => array(0) {
["_POST"] => array(0) {

More error

ErrorException: Could not generate random bytes of significant length src/XF/Util/Random.php:45
Сгенерирована пользователем: Неизвестная учётная запись 1 Авг 2018 в 08:41
Трассировка стека
#0 src/XF/Util/Random.php(55): XF\Util\Random::getRandomBytes(32)
#1 src/XF.php(703): XF\Util\Random::getRandomString(32)
#2 src/XF/Session/Session.php(73): XF::generateRandomString(32)
#3 src/XF/App.php(669): XF\Session\Session->start(’_\xA3\xFF-’)
#4 src/XF/Container.php(28): XF\App->XF\{closure}(Object(XF\Container))
#5 src/XF/Pub/App.php(39): XF\Container->offsetGet(‘session.public’)
#6 src/XF/Container.php(28): XF\Pub\App->XF\Pub\{closure}(Object(XF\Container))
#7 src/XF/App.php(2250): XF\Container->offsetGet(‘session’)
#8 src/XF/Pub/App.php(91): XF\App->session()
#9 src/XF/App.php(1927): XF\Pub\App->start(true)
#10 src/XF.php(328): XF\App->run()
#11 index.php(13): XF::runApp(‘XF\\Pub\\App’)
#12 {main}
Содержимое запроса
array(4) {
[“url”] => string(38) “/xenforum/threads/alpari-konkursy.653/”
[“referrer”] => bool(false)
["_GET"] => array(0) {
["_POST"] => array(0) {

What's broken ? How to fix ?



XenForo developer
Staff member
Is this just happening randomly and occasionally, or constantly?

Can you confirm your PHP version? Do you know your server's OS? (Is it a VPS?)


Is this just happening randomly and occasionally, or constantly?

Can you confirm your PHP version? Do you know your server's OS? (Is it a VPS?)
Hello, the problem was solved. The problem was that the main CMS of the site blocked part of the forum.
CMS Bitrix site management.
Helped to exclude the forum directory from CMS control.
The problem was manifested periodically, and manifested in different ways. At the moment, the problems are not observed

PHP Version 7.2.5


I have the same problem, too CMS Bitrix. What you prescribed in .htaccess ?
You need to contact your hosting service and ask them to exclude a folder. What would Bitrix saw her. This makes hosting support

Вам нужно обратиться к своему хостингу и попросить их исключить папку. Что бы битрикс ее не видел. Это делает поддержка хостинга


Today I ran again the same problem and solved it the same way
Я сегодня столкнулся снова с такой проблемой и решил ее тем же способом


I am writing in two languages, since it is a big problem and many have to know the solution.
Я пишу на двух языках, так как это большая проблема и многие должны знать ее решение.


Эта проблема очень не приятная. Она снова и снова проявляется...
This problem is not very pleasant. It appears again and again. . .