Magento2: Undefined index notice when trying to add a new user role

Created on 4 May 2016  路  24Comments  路  Source: magento/magento2

When I try to add a new user role in the admin I get the following notice on production mode (and developer mode too):

Notice: Undefined index: title in [...]/vendor/magento/module-integration/Helper/Data.php on line 24

Anyone knows what causes this? Or why I even am seeing notices on production mode? I thought those where suppressed?

Ready for Work bug report

Most helpful comment

Wouldn't it be a good idea to add some sort of check for this? Could save a lot of headaches. For example, add the following to Magento\Integration\Helper\Data in the foreach-loop:

if (!isset($resource['title'])) {
    throw new \Exception("Title not set for resource {$resource['id']}");
}

This would save a lot of people a lot of frustration.

All 24 comments

@kanduvisla what version of Magento?

+1
Magento ver. 2.0.4

@kanduvisla @aunts thank you for reporting, we have created MAGETWO-52619 to investigate and fix.

Hi @kanduvisla @aunts could one of you please provide detailed steps on how to reproduce this? This seems like a problem with one of the ACL nodes. Possibly it doesn't have the attribute 'title'.

Hi @hshar7

  1. Login with default admin user to backoffice Magento ver. 2.0.4
  2. System - User Roles
  3. Add New Role
  4. Error Page "Notice: Undefined index: title in ../vendor/magento/module-integration/Helper/Data.php on line 24

Hope it works for you as well!?

Unfortunately I cannot reproduce that. I am on 2.0.4 and I am able to add new roles correctly. Could you clear your cache and try again? Maybe your acl cache is corrupt?

If that doesn't work can you try putting a breakpoint at ../vendor/magento/module-integration/Helper/Data.php on line 24 and use xdebug to investigate which resource is causing this? Maybe that will give you an idea of why it is failing.

Any updates @aunts ?

@hshar7 You are right. There was a missing title tag in one custom acl xml. Now it's working fine. I think we can close this ticket!

The ACL XSD needs to be updated for this, because it states that title isn't required but the data helper depends on it.

Thanks @joost-florijn-kega MAGETWO-52792 created to take care of that.

Getting this error in 2.0.7 as well.

This still occurs in 2.1

This issue has been fixed and delivered to mainline.

i added the log(magento 2.1.1)
`
1 exception(s):
Exception #0 (Exception): Notice: Undefined index: title in /home/magentop/public_html/vendor/magento/module-integration/Helper/Data.php on line 24

Exception #0 (Exception): Notice: Undefined index: title in /home/magentop/public_html/vendor/magento/module-integration/Helper/Data.php on line 24

0 /home/magentop/public_html/vendor/magento/module-integration/Helper/Data.php(24): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/home/magentop/...', 24, Array)

1 /home/magentop/public_html/vendor/magento/module-user/Block/Role/Tab/Edit.php(203): Magento\Integration\Helper\Data->mapResources(Array)

2 /home/magentop/public_html/vendor/magento/module-user/view/adminhtml/templates/role/edit.phtml(40): Magento\User\Block\Role\Tab\Edit->getTree()

3 /home/magentop/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/home/magentop/...')

4 /home/magentop/public_html/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\User\Block\Role\Tab\Edit), '/home/magentop/...', Array)

5 /home/magentop/public_html/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/home/magentop/...')

6 /home/magentop/public_html/vendor/magento/module-backend/Block/Template.php(104): Magento\Framework\View\Element\Template->_toHtml()

7 /home/magentop/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Backend\Block\Template->_toHtml()

8 /home/magentop/public_html/vendor/magento/module-backend/Block/Widget/Tabs.php(387): Magento\Framework\View\Element\AbstractBlock->toHtml()

9 /home/magentop/public_html/vendor/magento/module-backend/view/adminhtml/templates/widget/tabs.phtml(57): Magento\Backend\Block\Widget\Tabs->getTabContent(Object(Magento\User\Block\Role\Tab\Edit))

10 /home/magentop/public_html/vendor/magento/framework/View/TemplateEngine/Php.php(59): include('/home/magentop/...')

11 /home/magentop/public_html/vendor/magento/framework/View/Element/Template.php(255): Magento\Framework\View\TemplateEngine\Php->render(Object(Magento\User\Block\Role\Edit), '/home/magentop/...', Array)

12 /home/magentop/public_html/vendor/magento/framework/View/Element/Template.php(279): Magento\Framework\View\Element\Template->fetchView('/home/magentop/...')

13 /home/magentop/public_html/vendor/magento/module-backend/Block/Template.php(104): Magento\Framework\View\Element\Template->_toHtml()

14 /home/magentop/public_html/vendor/magento/framework/View/Element/AbstractBlock.php(659): Magento\Backend\Block\Template->_toHtml()

15 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(542): Magento\Framework\View\Element\AbstractBlock->toHtml()

16 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(518): Magento\Framework\View\Layout->_renderBlock('adminhtml.user....')

17 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('adminhtml.user....')

18 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('adminhtml.user....')

19 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('adminhtml.user....', true)

20 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('adminhtml.user....')

21 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('left')

22 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('left')

23 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('left')

24 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('left', true)

25 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('left')

26 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('side.col')

27 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('side.col')

28 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('side.col')

29 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('side.col', true)

30 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('side.col')

31 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.main.conta...')

32 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.main.conta...')

33 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.main.conta...')

34 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.main.conta...', true)

35 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.main.conta...')

36 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.content')

37 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.content')

38 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.content')

39 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.content', true)

40 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.content')

41 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('page.wrapper')

42 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')

43 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')

44 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)

45 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')

46 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('backend.page')

47 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('backend.page')

48 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('backend.page')

49 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('backend.page', true)

50 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(569): Magento\Framework\View\Layout\Interceptor->renderElement('backend.page')

51 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(520): Magento\Framework\View\Layout->_renderContainer('root')

52 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')

53 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(472): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')

54 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)

55 /home/magentop/public_html/vendor/magento/framework/View/Layout.php(938): Magento\Framework\View\Layout\Interceptor->renderElement('root')

56 /home/magentop/public_html/var/generation/Magento/Framework/View/Layout/Interceptor.php(492): Magento\Framework\View\Layout->getOutput()

57 /home/magentop/public_html/vendor/magento/framework/View/Result/Page.php(243): Magento\Framework\View\Layout\Interceptor->getOutput()

58 /home/magentop/public_html/vendor/magento/framework/View/Result/Layout.php(164): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))

59 /home/magentop/public_html/var/generation/Magento/Backend/Model/View/Result/Page/Interceptor.php(193): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))

60 /home/magentop/public_html/vendor/magento/framework/App/View.php(221): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))

61 /home/magentop/public_html/vendor/magento/module-user/Controller/Adminhtml/User/Role/EditRole.php(52): Magento\Framework\App\View->renderLayout()

62 /home/magentop/public_html/var/generation/Magento/User/Controller/Adminhtml/User/Role/EditRole/Interceptor.php(24): Magento\User\Controller\Adminhtml\User\Role\EditRole->execute()

63 /home/magentop/public_html/vendor/magento/framework/App/Action/Action.php(102): Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor->execute()

64 /home/magentop/public_html/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))

65 /home/magentop/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))

66 /home/magentop/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor->___callParent('dispatch', Array)

67 /home/magentop/public_html/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\User\Co...', 'dispatch', Object(Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor), Array, 'adminAuthentica...')

68 /home/magentop/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain{closure}(Object(Magento\Framework\App\Request\Http))

69 /home/magentop/public_html/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))

70 /home/magentop/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\User\Co...', 'dispatch', Object(Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor), Array, 'adminMassaction...')

71 /home/magentop/public_html/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

72 /home/magentop/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))

73 /home/magentop/public_html/var/generation/Magento/User/Controller/Adminhtml/User/Role/EditRole/Interceptor.php(39): Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor->___callPlugins('dispatch', Array, Array)

74 /home/magentop/public_html/vendor/magento/framework/App/FrontController.php(55): Magento\User\Controller\Adminhtml\User\Role\EditRole\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

75 /home/magentop/public_html/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))

76 /home/magentop/public_html/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)

77 /home/magentop/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')

78 /home/magentop/public_html/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

79 /home/magentop/public_html/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))

80 /home/magentop/public_html/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)

81 /home/magentop/public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

82 /home/magentop/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()

83 /home/magentop/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))

84 {main}

`

i even try to disable all the modules and clean up all the cache from magento and static files and still i had this error . i hope it will be fixed soon . thats a really important bug to solve

Please check if you missing 'title' attribute in custom acl.xml file, i added title attribute for my acl.xml file and it's working now.

I'm having this error as well and I have attached my acl.xml file which seems to show the title attribute is correct. I'm using magento 2.1
acl.txt

@estaticfear What is the file path where the correct acl.xml is located?

@ooples app/code/CompanyName/ModuleName/etc/acl.xml

The issue is that one of your modules doesn't have a title defined in the acl.xml file. The easiest way to fix this is to update in src/vendor/magento/module-integration/Helper/Data.php to have:
$item['data'] = isset($resource['title']) ? $resource['title'] : '';

This will enable the UI to load but for one or many of the modules will have a blank space next to the folder. You then need to let the module developer know to fix the issue, but as a short term fix just add a title attribute to the acl.xml for the module yourself. You can work out which module by inspecting the element.

Wouldn't it be a good idea to add some sort of check for this? Could save a lot of headaches. For example, add the following to Magento\Integration\Helper\Data in the foreach-loop:

if (!isset($resource['title'])) {
    throw new \Exception("Title not set for resource {$resource['id']}");
}

This would save a lot of people a lot of frustration.

This happens during the setup process of 2.1.6

Happened the same to me. But is not a Magento issue, is an external extension that doesn't have defined the title in the acl.xml. @kanduvisla's suggestion helped me to find the module. Would be nice to have something similar in further versions.

Was this page helpful?
0 / 5 - 0 ratings