[TYPO3-mvc] Non-required action argument thows Exception on unknown get-parameter uid

Marc Bastian Heinrichs typo3 at mbh-web.de
Thu Apr 1 16:40:44 CEST 2010


Hey there,

example:
?tx_blogexample_pi1[blog]=2&tx_blogexample_pi1[action]=index&tx_blogexample_pi1[controller]=Post&no_cache=1

When the index action of the Post controller is called with an unknown 
blog uid (here 2) an exception 
Tx_Extbase_MVC_Exception_InvalidArgumentValue is thrown.
----------------
#1251730701: The value must be of type 
"Tx_BlogExample_Domain_Model_Blog", but was of type "NULL".

Tx_Extbase_MVC_Exception_InvalidArgumentValue thrown in file
/var/www/web1/wwwroot/typo3conf/ext/extbase/Classes/MVC/Controller/Argument.php 
in line 367.
-----------------

But when I set the action argument explicit to non-required by adding an 
= NULL to the argument
-----
indexAction(Tx_BlogExample_Domain_Model_Blog $blog = NULL)
-----
the exception is also be thrown. So I have no chance to handle this 
situation inside my extension.

You see this also here, when you manipulate the offer id:
http://www.sjr-stuttgart.de/index.php?id=162&no_cache=1&tx_sjroffers_list[offer]=999&tx_sjroffers_list[action]=show&tx_sjroffers_list[controller]=Offer

I think, when an argument is non-required,
Tx_Extbase_MVC_Controller_Argument::transformValue
should allow the $transformedValue to be NULL.
See attached patch.

What do you think?


Regards
Bastian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Argument.php.patch
URL: <http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/attachments/20100401/13709412/attachment.txt>


More information about the TYPO3-project-typo3v4mvc mailing list