File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -391,9 +391,8 @@ public function changeAction($action)
391391 if (is_string ($ action ) && Nette \Utils \Strings::match ($ action , '#^[a-zA-Z0-9][a-zA-Z0-9_\x7f-\xff]*\z# ' )) {
392392 $ this ->action = $ action ;
393393 $ this ->view = $ action ;
394-
395394 } else {
396- $ this -> error ('Action name is not alphanumeric string. ' );
395+ throw new Nette \ InvalidArgumentException ('Action name is not alphanumeric string. ' );
397396 }
398397 }
399398
@@ -1232,7 +1231,11 @@ private function initGlobalParameters()
12321231 }
12331232
12341233 // init & validate $this->action & $this->view
1235- $ this ->changeAction ($ selfParams [self ::ACTION_KEY ] ?? self ::DEFAULT_ACTION );
1234+ try {
1235+ $ this ->changeAction ($ selfParams [self ::ACTION_KEY ] ?? self ::DEFAULT_ACTION );
1236+ } catch (\Throwable $ e ) {
1237+ $ this ->error ('Action name is not valid. ' , 0 , $ e );
1238+ }
12361239
12371240 // init $this->signalReceiver and key 'signal' in appropriate params array
12381241 $ this ->signalReceiver = $ this ->getUniqueId ();
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ $presenter->injectPrimary(
3838Assert::exception (function () use ($ presenter ) {
3939 $ request = new Application \Request ('Test ' , Http \Request::GET , ['action ' => []]);
4040 $ presenter ->run ($ request );
41- }, Nette \Application \BadRequestException::class, 'Action name is not alphanumeric string . ' );
41+ }, Nette \Application \BadRequestException::class, 'Action name is not valid . ' );
4242
4343
4444Assert::exception (function () use ($ presenter ) {
You can’t perform that action at this time.
0 commit comments