File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -381,19 +381,13 @@ public function getAction($fullyQualified = FALSE)
381381
382382
383383 /**
384- * Changes current action. Only alphanumeric characters are allowed.
384+ * Changes current action.
385385 * @param string
386386 * @return void
387387 */
388388 public function changeAction ($ action )
389389 {
390- if (is_string ($ action ) && Nette \Utils \Strings::match ($ action , '#^[a-zA-Z0-9][a-zA-Z0-9_\x7f-\xff]*\z# ' )) {
391- $ this ->action = $ action ;
392- $ this ->view = $ action ;
393-
394- } else {
395- $ this ->error ('Action name is not alphanumeric string. ' );
396- }
390+ $ this ->action = $ this ->view = (string ) $ action ;
397391 }
398392
399393
@@ -1231,7 +1225,11 @@ private function initGlobalParameters()
12311225 }
12321226
12331227 // init & validate $this->action & $this->view
1234- $ this ->changeAction (isset ($ selfParams [self ::ACTION_KEY ]) ? $ selfParams [self ::ACTION_KEY ] : self ::DEFAULT_ACTION );
1228+ $ action = $ selfParams [self ::ACTION_KEY ] ?? self ::DEFAULT_ACTION ;
1229+ if (!is_string ($ action ) || !Nette \Utils \Strings::match ($ action , '#^[a-zA-Z0-9][a-zA-Z0-9_\x7f-\xff]*\z# ' )) {
1230+ $ this ->error ('Action name is not valid. ' );
1231+ }
1232+ $ this ->changeAction ($ action );
12351233
12361234 // init $this->signalReceiver and key 'signal' in appropriate params array
12371235 $ 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