Project

General

Profile

Actions

Bug #91040

closed

RequestBuilder fails merging params

Added by R3 H6 about 4 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
-- undefined --
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2020-04-15
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

If the plugin namespace param is not an array, RequestBuilder will fail.
This should not happen.

Example URL:
http://example.ddev.site/search?id=123&tx_solr=foo+bar

Error:

(1/1) TypeError
Argument 1 passed to TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule() must be of the type array, string given, called in /var/www/html/web/typo3/sysext/extbase/Classes/Mvc/Web/RequestBuilder.php on line 172

I guess any call like ?plugin_ns=foo instead of ?plugin_ns[xyz]=foo will cause the error.

Actions #1

Updated by Alexander Schnitzler about 4 years ago

  • Status changed from New to Needs Feedback
  • Priority changed from Should have to -- undefined --

First of all you are right. Any call like ?plugin_ns=foo will cause this error. Question is: Why are you using the namespace argument like that? You referred to ext solr. What is the purpose of using ?tx_solr=foo+bar?

Actions #2

Updated by R3 H6 about 4 years ago

Alexander Schnitzler wrote:

First of all you are right. Any call like ?plugin_ns=foo will cause this error. Question is: Why are you using the namespace argument like that? You referred to ext solr. What is the purpose of using ?tx_solr=foo+bar?

A client reported issues with this kind of link, no Idea from where he got a link like this.
It's just an example. I dont use namespace like this in own extensions.

The issue is, that it is possible to raise an error with invalid arguments.

Actions #3

Updated by Alexander Schnitzler almost 4 years ago

The issue is, that it is possible to raise an error with invalid arguments.

Adding namespaced arguments to a URL will trigger Extbase to evaluate them. So, what should Extbase do here instead of throwing an Exception in your opinion?

Actions #4

Updated by R3 H6 almost 4 years ago

Since Extbase expects an array, I think best would be do a type check. If argument is not an array then simply ignore it.

Actions #5

Updated by karlheinz schmidt almost 4 years ago

Suggestion:

TYPO3\CMS\Extbase\Mvc\Web\Requestbuilder Row 172:

if ($typo3Request instanceof ServerRequestInterface) {
            $queryArguments = $typo3Request->getAttribute('routing');
            if ($queryArguments instanceof PageArguments) {
                $getParameters = $queryArguments->get($pluginNamespace) ?? [];
            } else {
                $getParameters = $typo3Request->getQueryParams()[$pluginNamespace] ?? [];
            }
            if (!is_array($getParameters)) {
              $getParameters = [];
            }
            $bodyParameters = $typo3Request->getParsedBody()[$pluginNamespace] ?? [];
            $parameters = $getParameters;
            ArrayUtility::mergeRecursiveWithOverrule($parameters, $bodyParameters);
        } else {
            $parameters = \TYPO3\CMS\Core\Utility\GeneralUtility::_GPmerged($pluginNamespace);
        }
Actions #6

Updated by Gerrit Code Review over 3 years ago

  • Status changed from Needs Feedback 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/+/65351

Actions #7

Updated by Gerrit Code Review over 3 years 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/+/65351

Actions #8

Updated by Gerrit Code Review over 3 years ago

Patch set 3 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/+/65351

Actions #9

Updated by Gerrit Code Review almost 3 years ago

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

Actions #10

Updated by Gerrit Code Review almost 3 years ago

Patch set 4 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/+/65351

Actions #11

Updated by Gerrit Code Review almost 3 years ago

Patch set 5 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/+/65351

Actions #12

Updated by Gerrit Code Review almost 3 years ago

Patch set 6 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/+/65351

Actions #13

Updated by Gerrit Code Review almost 3 years ago

Patch set 7 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/+/65351

Actions #14

Updated by Remo H. almost 3 years ago

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

Updated by Gerrit Code Review almost 3 years ago

  • Status changed from Resolved to Under Review

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

Actions #16

Updated by Gerrit Code Review almost 3 years ago

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

Actions #17

Updated by Gerrit Code Review almost 3 years 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/+/68988

Actions #18

Updated by Gerrit Code Review almost 3 years ago

Patch set 2 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/+/68988

Actions #19

Updated by Gerrit Code Review almost 3 years ago

Patch set 3 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/+/68988

Actions #20

Updated by Remo H. almost 3 years ago

  • Status changed from Under Review to Resolved
Actions #21

Updated by Benni Mack almost 3 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF