neos / flow-development-collection

The unified repository containing the Flow core packages, used for Flow development.
https://flow.neos.io/
MIT License
137 stars 189 forks source link

500 exception for not existing URL with "special" querystring #612

Closed neos-bot closed 7 years ago

neos-bot commented 8 years ago

Jira issue originally created by user su_decaf:

Hello,

an 500 exception is thrown, when you try to request a non existing page with a query string of numbers Try the following URL: https://www.neos.io/folder/site?123 and you will get a 500 answer

https://www.neos.io/folder/site or https://www.neos.io/folder/site?ts=123 is working as excepted (404)

Here is the exception

Exception #1210858767 in line 553 of /.../Data/Temporary/Production/Cache/Code/Flow*Object_Classes/TYPO3_Flow_Mvc*ActionRequest.php: Invalid argument name (must be a non-empty string).

7 TYPO3\Flow\Mvc\ActionRequest_Original::setArgument(123, "")
6 TYPO3\Flow\Mvc\ActionRequest_Original::setArguments(array|1|)
5 TYPO3\Flow\Mvc\DispatchComponent_Original::handle(TYPO3\Flow\Http\Component\ComponentContext)
4 TYPO3\Flow\Http\Component\ComponentChain_Original::handle(TYPO3\Flow\Http\Component\ComponentContext)
3 TYPO3\Flow\Http\Component\ComponentChain_Original::handle(TYPO3\Flow\Http\Component\ComponentContext)
2 TYPO3\Flow\Http\RequestHandler::handleRequest()
1 TYPO3\Flow\Core\Bootstrap::run()

Why this ticket: In one of our projects, the old TYPO3 page rendered the static files with such a timestamp value, and these URLs are in the index of several search engines. After switching to NEOS we are getting thousands of such exceptions (which are logged in Data/Logs/Exceptions), because the bots try to get these (old) URLs again and again.

Best, Stefan

Jira-URL: https://jira.neos.io/browse/FLOW-451

neos-bot commented 8 years ago

Comment created by @aertmann:

[su_decaf]: Thanks for reporting, I agree that behavior is not optimal and should be more graceful, at least in production context.

[bwaidelich], [~kdambekalns]: maybe you have an opinion?

neos-bot commented 8 years ago

Comment created by @kdambekalns:

An immediate solution would be to rewrite ?(\[0-9\]+$) in the webserver and remove it.

For the actual handling, I think it would be ok to treat 123 the same as "123" as a name (I am actually surprised it comes in as an integer here).

neos-bot commented 8 years ago

Comment created by @kdambekalns:

[~su_decaf], could you check if changing if (!is_string($argumentName) || strlen($argumentName) === 0) {toif (empty($argumentName)) {(inActionRequest.setArgument) solves your case and keep everything else working?

neos-bot commented 8 years ago

Comment created by @albe:

Ping. How should we proceed? Implement the fix [~kdambekalns] suggested?

kitsunet commented 7 years ago

via #954