Editmode Resolver isEditmode returning false when logged in


I’ve been updating from pimcore 4 to pimcore 6. After upgrading to pimcore 5, I noticed the add brick icon had disappeared when editing a document. I tried upgrading to 6 on the off chance it might sort it, but it didn’t.
Strangely, this is only happens on a development environment - I can see the add brick icon on my local version.

What I’ve tried to debug myself:

  • Looking through the pimcore files, I saw that the isEditmode function in the EditmodeResolver class was returning false. From this, I found that it was failing to find the user even though I was logged in.
  • Looking into the functions to get the user, I managed to get it printing out a User object in different places (in both the loadUser function in the UserLoader class and the getUserProxy function in the UserResolver class), but I’m assuming those functions are run in multiple places and must have been printing it out before it got to the point where isEditmode calls the user loader to get the user seeing as it still wasn’t loading the icon.
  • I’ve tried creating another user with it potentially being the user causing the problem and that user had the same issue. I tried giving them 2FA too just in case and it had the same issue.
  • I’ve copied the development database over my local one and the same user on my local version and I can see the add brick icon.
  • I’ve tried rsyncing the code from develop to my local and couldn’t see any noticeable differences that would affect anything to do with this.
  • I checked the nginx configs against each other and they both matched up (apart from server names / URLs).
  • I copied the pimcore folder from the composer generated vendor folder into a repository of its own and tried overwriting it with what was on the develop server and there wasn’t any differences. I tried doing the same for the whole vendor folder but terminal wouldn’t let me get into the directory weirdly.
  • I tried creating a new fresh server on the off chance there was something cached from the old pimcore version that may have been breaking it, but that didn’t do anything either.

After all the above, I found out that the user was only needed to get the language the user had set and seeing as we only currently use English in the CMS, I set it to default to English, but it would be a lot better if someone could help figure out why pimcore is unable to find the user as this is obviously a bit of a hacky way to get around the problem.

The hacky fix I did was to update 2 files, both in the vendor folder generated through composer:

In pimcore/pimcore/bundles/CoreBundle/EventListener/Frontend/EditmodeListener.php:
Changed line 206 to $headHtml = $this->buildHeadHtml($document, $user ? $user->getLanguage() : 'en'); to default to English

In pimcore/pimcore/lib/Http/Request/Resolver/EditmodeResolver.php:
Changed line 116 to be commented out so $result isn’t set to false when a user isn’t found

Not really sure what else I can do to debug this and realise it is most likely not possible to reproduce, but I hope someone can help.


After fixing some other issues, this seems to have sorted itself strangely. Hope the above helps someone else if they’re struggling to find a fix, even if it is a bit hacky.