Bug #87903

Backend users having bookmark/shortcut with empty returnUrl parameter cannot access backend

Added by Joerg Kummer 4 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2019-03-13
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

After upgrade from TYPO3 7.6 to 9.5.5, we had one backend user, which could not access to backend after successfull login.

Given

You have a backend user with at least one bookmark, which contains a uri with empty returnUrl parameter.

Expected

If you are logged in, you can see your bookmark (upper toolbar star icon) and open it on click.

Actual

If you are logged in, the rendering of backend breaks with a PHP TypeError.
You cannot see anything or act in backend.

Error message

parse_str() expects parameter 1 to be string, null given
…
in /Users/jok/Dev/Sites/typo3/cms/review/10/typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php line 741

How to Reproduce (both TYPO3 v9.5.5 and 10.0.0-dev)

Manipulate stored URl for any bookmark in database directly to have an empty returnUrl parameter in it…

Having a backend user, create a bookmark for example:

  • Go to WebList module
  • Select Root page
    
* Open your backend user for editing
  • Add this edit page to bookmark (Star at upper right corner)

Goto database table sys_be_shortcuts and change field url, that it contains an empty parameter &returnUrl=
for example
from:

/typo3/index.php?&route=record_edit&route=%2Frecord%2Fedit&returnUrl=%2Ftypo3%2Findex.php%3Froute%3D%252Fweb%252Flist%252F%26token%3D407860fa493b86d79f3c738efdc762ccc71bf3d8%26id%3D0%26table%3D%26imagemode%3D1&edit%5Bbe_users%5D%5B1%5D=edit

to:

/typo3/index.php?&route=record_edit&route=%2Frecord%2Fedit&returnUrl=&edit%5Bbe_users%5D%5B1%5D=edit

Reload backend in your browser, and expect, that you will see PHP TypeError as described above



How to solve



The class typo3/sysext/backend/Classes/Backend/Shortcut/ShortcutRepository.php should be changed to ensure, that first argument in PHP method parse_uri() is a valid string.

I will append a patch for it.

Associated revisions

Revision 66a9f219 (diff)
Added by Joerg Kummer 4 months ago

[BUGFIX] Ensure parse_str method argument is valid for BE shortcuts

When backend shortcut links get parsed, this change ensures that
parameter for returnUrl get only parsed, if it is set and not empty.

Resolves: #87903
Releases: master, 9.5
Change-Id: Ie8f380e9cdfef4440153f2095797a2dccc577d1c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60239
Tested-by: TYPO3com <>
Tested-by: Daniel Goerz <>
Tested-by: Benjamin Franzke <>
Reviewed-by: Daniel Goerz <>
Reviewed-by: Oliver Klee <>
Reviewed-by: Benjamin Franzke <>

Revision 7493278c (diff)
Added by Joerg Kummer 4 months ago

[BUGFIX] Ensure parse_str method argument is valid for BE shortcuts

When backend shortcut links get parsed, this change ensures that
parameter for returnUrl get only parsed, if it is set and not empty.

Resolves: #87903
Releases: master, 9.5
Change-Id: Ie8f380e9cdfef4440153f2095797a2dccc577d1c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60295
Tested-by: TYPO3com <>
Tested-by: Benjamin Franzke <>
Reviewed-by: Benjamin Franzke <>

History

#1 Updated by Gerrit Code Review 4 months ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60239

#2 Updated by Gerrit Code Review 4 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60239

#3 Updated by Gerrit Code Review 4 months ago

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/60295

#4 Updated by Joerg Kummer 4 months ago

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

#5 Updated by Benni Mack 2 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF