Bug #47473

Role->setParentRoles() fails if array of roles contains duplicates

Added by Robert Lemke over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Must have
Assignee:
Category:
Security
Start date:
2013-04-23
Due date:
% Done:

100%

PHP Version:
5.4
Has patch:
No
Complexity:
medium

Description

If the array of roles contains duplicates, Doctrine may fail while trying to insert the same role multiple times:

Uncaught Exception in Flow
An exception occurred while executing 'INSERT INTO typo3_flow_security_policy_role_parentroles_join (flow_policy_role, parent_role) VALUES (?, ?)' with params {"1":"Acme.Demo:Administrator","2":"Acme.Demo:Base"}: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Acme.Demo:Administrator-Acme.Demo:Base' for key 'PRIMARY'

Doctrine\DBAL\DBALException thrown in file
Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php in line 47.

Associated revisions

Revision 30124b20 (diff)
Added by Robert Lemke over 6 years ago

[BUGFIX] setParentRoles() fails if passed roles contain duplicates

Fixes an issue where Doctrine failed inserting parent roles if the array
passed to Role->setParentRoles() contained duplicates.

Even though getParentRoles() does return roles without duplicates,
setParentRoles() did not filter duplicates and caused the SQL error
mentioned in the related issue ticket.

Change-Id: I6f0ed41e74d0f2100990368f930b558fe0f3ed2f
Resolves: #47473
Releases: master, 2.0

Revision ec284d85 (diff)
Added by Robert Lemke over 6 years ago

[BUGFIX] setParentRoles() fails if passed roles contain duplicates

Fixes an issue where Doctrine failed inserting parent roles if the array
passed to Role->setParentRoles() contained duplicates.

Even though getParentRoles() does return roles without duplicates,
setParentRoles() did not filter duplicates and caused the SQL error
mentioned in the related issue ticket.

Change-Id: I6f0ed41e74d0f2100990368f930b558fe0f3ed2f
Resolves: #47473
Releases: master, 2.0

History

#1 Updated by Gerrit Code Review over 6 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/20101

#2 Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/20102

#3 Updated by Anonymous over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF