Fixed Error changing password after update to 2.0 B1

Snog

Well-known member
Affected version
2.0 Beta 1
I'm getting this error when trying to change my password after upgrading to 2.0 Beta 1...
Code:
Server error log

[LIST]
[*]ErrorException: Undefined index: 
[*]src/XF/Permission/Builder.php:382
[*]Generated by: Snog
[*]Sep 5, 2017 at 4:13 PM
[/LIST]
[SIZE=4][B]Stack trace[/B][/SIZE]

#0 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(382): XF::handlePhpError(8, 'Undefined index...', '/var/www/client...', 382, Array)
#1 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(350): XF\Permission\Builder->pickPermissionPriorityValue(Array, 'flag')
#2 /var/www/clients/client0/web1/web/src/XF/Permission/TreeContentPermissions.php(111): XF\Permission\Builder->calculatePermissions(Array, Array, Array)
#3 /var/www/clients/client0/web1/web/src/XF/Permission/TreeContentPermissions.php(102): XF\Permission\TreeContentPermissions->buildForContent(39, Array, 0, Array)
#4 /var/www/clients/client0/web1/web/src/XF/Permission/TreeContentPermissions.php(40): XF\Permission\TreeContentPermissions->buildForChildrenOf(NULL, Array, 0, Array)
#5 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(148): XF\Permission\TreeContentPermissions->rebuildCombination(Object(XF\Entity\PermissionCombination), Array)
#6 /var/www/clients/client0/web1/web/src/XF/Permission/Builder.php(140): XF\Permission\Builder->rebuildCombinationContent(Object(XF\Entity\PermissionCombination), Array)
#7 /var/www/clients/client0/web1/web/src/XF/Job/PermissionRebuild.php(58): XF\Permission\Builder->rebuildCombination(Object(XF\Entity\PermissionCombination))
#8 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(193): XF\Job\PermissionRebuild->run(7.9921991825104)
#9 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(140): XF\Job\Manager->runJobInternal(Array, 7.9921991825104)
#10 /var/www/clients/client0/web1/web/src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9921991825104)
#11 /var/www/clients/client0/web1/web/src/XF/Admin/Controller/Tools.php(105): XF\Job\Manager->runQueue(true, 8)
#12 /var/www/clients/client0/web1/web/src/XF/Mvc/Dispatcher.php(232): XF\Admin\Controller\Tools->actionRunJob(Object(XF\Mvc\ParameterBag))
#13 /var/www/clients/client0/web1/web/src/XF/Mvc/Dispatcher.php(85): XF\Mvc\Dispatcher->dispatchClass('XF:Tools', 'RunJob', 'html', Object(XF\Mvc\ParameterBag), 'tools')
#14 /var/www/clients/client0/web1/web/src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#15 /var/www/clients/client0/web1/web/src/XF/App.php(1771): XF\Mvc\Dispatcher->run()
#16 /var/www/clients/client0/web1/web/src/XF.php(319): XF\App->run()
#17 /var/www/clients/client0/web1/web/admin.php(13): XF::runApp('XF\\Admin\\App')
#18 {main}
 
Nope, it's still a bug. Not having debug mode enabled may suppress the error, but the error will be happening nonetheless and, although I haven't looked at it yet, it could be causing undesirable behaviour in the long run so we'll look into it.
 
Would it be possible for you to send me a copy of the data in your xf_permission_entry_content table? I'm not sure if that's going to show anything invalid as really that shouldn't be possible, but I'm not sure what else would cause this off hand.
 
This was due to a bug in the upgrade script. To workaround this, in XF\Install\Upgrade\2000010-200a.php, change:
Code:
SELECT DISTINCT content_type, content_id, user_group_id, user_id, 'forum', 'inlineMod', 'allow', 0
to:
Code:
SELECT DISTINCT content_type, content_id, user_group_id, user_id, 'forum', 'inlineMod', 'content_allow', 0

Note that there is a very similar change that needs to be made to the RM upgrade script that I haven't included here. @Snog, in your case, that upgrade script caused the issue as well.

Generally though, we have made further changes to the upgrade scripts to prevent this from happening. Specifically, this happened because INSERT IGNORE silences not only duplicate entry errors but it basically disables strict mode behaviors and allows potentially invalid data to be inserted. We've flipped most of these to use a different approach which only skips the duplicate entry errors (what we used IGNORE for).

The beta 2 script will fix the bad data from the previous upgrade script and remove any other bad data (which would catch and prevent the RM bug issue too for people who haven't noticed it).
 
Back
Top Bottom