Skip to content

Commit

Permalink
[BUGFIX] Do not use hard-coded magic 1337 in admin panel
Browse files Browse the repository at this point in the history
This change uses a "random" frontend user ID (currently 1337)
to a very unlikely number PHP_INT_MAX to ensure that no usual
frontend user is used to preview.

This line can be removed completely once
  https://review.typo3.org/c/Packages/TYPO3.CMS/+/64441
is fixed as well.

But 1337 is a no-go (that's why it needs to into 9.5)

Resolves: #91837
Related: #90773
Releases: master, 10.4, 9.5
Change-Id: I70eebcf1220b216b3a9929a7b31eb83e999f282a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65215
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
  • Loading branch information
bmack authored and andreaskienast committed Aug 6, 2020
1 parent ef4ff0f commit bb9eddc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion typo3/sysext/adminpanel/Classes/Modules/PreviewModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ protected function initializeFrontendPreview(
$frontendUser = $request->getAttribute('frontend.user');
$frontendUser->user[$frontendUser->usergroup_column] = $simulateUserGroup;
// let's fake having a user with that group, too
$frontendUser->user['uid'] = 1337;
// This can be removed once #90989 is fixed
$frontendUser->user['uid'] = PHP_INT_MAX;
$context->setAspect(
'frontend.user',
GeneralUtility::makeInstance(
Expand Down

0 comments on commit bb9eddc

Please sign in to comment.