Trouble with registerCpRoutes() I'm trying to add some custom routes for my plugin, but it's throwing a 400 CHttpException for invalidActionParams when accessing largeupload/folders/2 as an example.

public function registerCpRoutes ()
{
return array(
    'largeupload'                           =&gt; array( 'action' =&gt; 'largeUpload/index' ),
    'largeupload/folders'                   =&gt; array( 'action' =&gt; 'largeUpload/folder/index' ),
    'largeupload/folders/new'               =&gt; array( 'action' =&gt; 'largeUpload/folder/edit' ),
    'largeupload/folders/(?P&lt;folderId&gt;\d+)' =&gt; array( 'action' =&gt; 'largeUpload/folder/edit' ),
);
}


My controller is called LargeUpload_Folder, and my action actionEdit().

public function actionEdit ($variables = [ ])
{
    /* Simplified */
    if ( isset($variables['folderId']) ) {
    }
    else {
    }

    $this-&gt;renderTemplate('largeupload/LargeUpload_Edit', [
    ]);
}


If I remove $variables = [ ] from the action parameters, it doesn't return an error anymore.

Any ideas?
I believe this is caused by not including array in the function parameter, preceding the variable.

Changing to public function actionEdit (array $variables = [ ]) should do the trick.

As a bonus - can anyone explain why? Seems like the $variables variable needs to be cast as an array?