Bug #4013
Argument handling in RESTController doesn't work correctly
Status: | Resolved | Start date: | 2009-07-28 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 100% |
|
Category: | MVC | |||
Target version: | TYPO3 Flow Base Distribution - 1.0 alpha 5 | |||
PHP Version: | Complexity: | |||
Has patch: | Affected Flow version: |
Description
The RESTController is inherited from the ActionController. Therefore the ArgumentHandling should work as intended.
The problem is due to the following code of the RESTController class.
public function processRequest(\F3\FLOW3\MVC\RequestInterface $request, \F3\FLOW3\MVC\ResponseInterface $response) { $this->arguments->addNewArgument('id', 'UUID', FALSE); parent::processRequest($request, $response); }
Adding an argument in this code portion results in an shift of all arguments of a called method. The value for the 1st argument is now shifted to the second argument.
If addNewArgument is removed from that code it works as intended.
A possible solution would be to move that line into the initializeAction method. The argument is then added to the end of the argument array and not to the beginning.
But actually it also shouldn't be passed to the method if it is not required or specified by the method.
Associated revisions
[!!!][+BUGFIX] FLOW3 (MVC): The RESTController no longer defines the $id argument for methods, this fixes #4013. You must declare the $id argument properly in your controller actions from now on!
History
#1 Updated by Robert Lemke about 6 years ago
- Priority changed from Must have to -- undefined --
- Target version deleted (
1.0 alpha 3)
#2 Updated by Karsten Dambekalns about 6 years ago
- Subject changed from Arguement Handling in RESTController doesn't work correctly to Argument handling in RESTController doesn't work correctly
#3 Updated by Karsten Dambekalns almost 6 years ago
- Status changed from New to Accepted
- Assigned To set to Karsten Dambekalns
- Priority changed from -- undefined -- to Should have
- Target version set to 1.0 alpha 5
#4 Updated by Karsten Dambekalns almost 6 years ago
I propose to drop that we simply drop processRequest() from the RESTController. The $id argument should be specified in the action method's signature as usual, the RESTController would do it's only magic in resolveActionMethodName() then. This solves the problem with argument shifting (I stumbled across this, too) and gives back control over the use of the argument to the developer.
#5 Updated by Karsten Dambekalns almost 6 years ago
- Status changed from Accepted to Resolved
- % Done changed from 0 to 100
Applied in changeset r3225.