- Issue created by @markconroy
- 🇮🇪Ireland markconroy
Adding credit to Open Code for the time to file this issue and work on it.
- Status changed to Needs review
6 months ago 11:04am 8 August 2024 - Status changed to Postponed: needs info
6 months ago 11:11am 8 August 2024 - 🇧🇪Belgium RandalV
Hi markconroy,
Thanks for reporting a possible bug.
Could you provide a little more information on how to reproduce this error? I don't seem to get this on a clean install.
Any contrib modules that might interfere?From what I can tell, the unserialize function in the below piece of code should only be run if the data isn't empty.
if (!empty($this->getData($uid, 'roles'))) { $data = unserialize($this->getData($uid, 'roles')); }
However, it should be impossible for this data to be anything but a string, since it's only set by one function (the below code) and that code serializes the value before committing it to the DB.
public function setRoles($uid, array $roles) { return $this->setData($uid, 'roles', serialize($roles)); }
Hence why it sounds like some external source might be messing with the msqrole user data 🤔
PS. While the MR seems just fine, it simply shouldn't be needed.. Hence why I currently see that check more as unnecessary clutter, so I'd prefer to be able to reproduce it and perhaps fix it in a different way 😇
- 🇮🇪Ireland markconroy
Thanks @RandalV. I'll click around a bit more and see if I can reliably reproduce the issue. Like I said in the summary I'm not even sure how/why it's happening.
Thanks for the quick response.
- 🇨🇦Canada mahde Vancouver
I am facing the same issue and tried to use the patch from the MR but it doesn't work and I am getting access denied error!
- 🇧🇪Belgium RandalV
Hi @mahde,
If you could also please provide more information on how to reproduce this bug, we could move forward with this.
Currently on a fresh install of D10/11, nothing of the sort seems to happen..Thank you!
- 🇨🇦Canada mahde Vancouver
Hi @randalv - I have a role called Site Admin and that role has almost same permissions as Administrator except some permissions such as Administer modules, Administer site configuration and Administer Software update.
When I am logged in as Administrator and I use the msqrole module to login as Site Admin, I get that error.
Hope that helps! - 🇧🇪Belgium RandalV
I'm sorry guys, I've tried debugging this but nothing seems to point to an error 😓
Could you perhaps provide me with a list of contrib modules currently in use?
That way I could test with those, maybe one of them triggers something malicious in msqrole.PS. I did fix some little bits here and there in the latest release, in the D11 compatible version there were some regressions, but none of which should have caused the main issue raised here.
The "access denied" error you mentioned, @mahde, should be fixed though. - 🇨🇦Canada mahde Vancouver
Hey @randalv - I will spend some time today to debug this issue and find the root cause.
- 🇨🇦Canada mahde Vancouver
@randalv - I have updated the MR and now it works fine!
- 🇧🇪Belgium RandalV
Hi @mahde,
Thanks for taking the time to debug and updating the MR!
This brings us back to my comment in #5 🐛 TypeError_: unserialize(): Argument #1 ($data) must be of type string, array given in _unserialize() Postponed: needs info though, there's only one piece of code in the module that updates the user data for roles, and it always serializes it..
I don't understand how it could possibly contain an array unless some other module messes with it 😓 - 🇨🇦Canada mahde Vancouver
Hey @randalv - No worries!
I forgot to mention in the steps to reproduce that I get that error only when I go to People -> Add user.
I tried to print out the value of $serializedRoles variable when I visit that page and I got this:string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" array(1) { [50]=> string(84) "a:2:{s:13:"authenticated";s:13:"authenticated";s:10:"site_admin";s:10:"site_admin";}" } The website encountered an unexpected error. Try again later.
Notice the Array at the end which causes this issue 🫤, I will try to find out from where it comes!
- 🇧🇪Belgium RandalV
That's a very interesting development... an array containing the serialized content with `50` as its key, thanks for sharing @mahde!
I'll debug some more too and see if I can reproduce it somehow.
I also notice it adds both roles twice, interesting! - Status changed to Needs work
5 months ago 10:54am 20 August 2024