AT_alphanum keep rejecting my argument

Game development with Board Game Arena Studio
Post Reply
User avatar
jomikr
Posts: 2
Joined: 16 May 2020, 11:05

AT_alphanum keep rejecting my argument

Post by jomikr »

I have the following code snippet in action.php:

Code: Select all

self::setAjaxMode();
$actions = self::getArg('declaredActions', 'AT_alphanum', true);
self::dump('actions', $actions);
$this->game->declareActions($actions);
self::ajaxResponse();
And this is the client side code:

Code: Select all

this.ajaxcall(
  '/alchemistsjokr/alchemistsjokr/declareActions.html', { lock: true, declaredActions: this.chosenActionSpaces.join(' ') },
  this,
  function() {},
  function() {}
);
This keeps fataling my request:

Code: Select all

06/12 00:24:42 [error] [T216294] [2341045/jokr3] Unexpected exception: Bad argument type: declaredActions should be a AT_alphanum (forage forage transmute) (BGA service error 1607210682)#
#0 /var/tournoi/release/games/alchemistsjokr/999999-9999/alchemistsjokr.action.php(35): APP_Action->getArg('declaredActions', 'AT_alphanum', true)#
#1 /var/tournoi/release/tournoi-201204-0905-gs/www/include/webActionCore.inc.php(189): action_alchemistsjokr->declareActions()#
#2 /var/tournoi/release/tournoi-201204-0905-gs/www/index.php(242): launchWebAction('alchemistsjokr', 'action_alchemis...', 'declareActions', false, false, NULL, true, false)#
#3 {main}h
http://1.studio.boardgamearena.com/1/alchemistsjokr/alchemistsjokr/declareActions.html?lock=28986f6f-e6f1-4706-8601-29adfad8edc2&declaredActions=forage%20forage%20transmute&table=216294&testuser=2341045&dojo.preventCache=1607210684547
In fact any sort of string keeps fataling, even just "hello":

Code: Select all

06/12 00:32:40 [error] [T216294] [2341045/jokr3] Unexpected exception: Bad argument type: declaredActions should be a AT_alphanum (hello) (BGA service error 1607211160)#
#0 /var/tournoi/release/games/alchemistsjokr/999999-9999/alchemistsjokr.action.php(35): APP_Action->getArg('declaredActions', 'AT_alphanum', true)#
#1 /var/tournoi/release/tournoi-201204-0905-gs/www/include/webActionCore.inc.php(189): action_alchemistsjokr->declareActions()#
#2 /var/tournoi/release/tournoi-201204-0905-gs/www/index.php(242): launchWebAction('alchemistsjokr', 'action_alchemis...', 'declareActions', false, false, NULL, true, false)#
#3 {main}h
http://1.studio.boardgamearena.com/1/alchemistsjokr/alchemistsjokr/declareActions.html?lock=bfe7b9d1-e1d5-488a-8ade-765c5d4be6fa&declaredActions=hello&table=216294&testuser=2341045&dojo.preventCache=16072111629620
06/12 00:32:40 [notice] [T216294] [2341045/jokr3] ER-300 430 d10 c0 e317 m0 I423 A0 V0 T0 /1/alchemistsjokr/alchemistsjokr/declareActions.html?lock=bfe7b9d1-e1d5-488a-8ade-765c5d4be6fa&declaredActions=hello&table=216294&testuser=2341045&dojo.preventCache=1607211162962
So either I have a really silly bug here somewhere, or something is broken with the framework's arg parasing.

Any idea what might be going on?
User avatar
Tisaac
Posts: 2743
Joined: 26 August 2014, 21:28

Re: AT_alphanum keep rejecting my argument

Post by Tisaac »

jomikr wrote: 06 December 2020, 00:33 Any idea what might be going on?
Silly bug indeed, that's AT_alphanum without any quote around since that's a PHP constant.. :)
User avatar
jomikr
Posts: 2
Joined: 16 May 2020, 11:05

Re: AT_alphanum keep rejecting my argument

Post by jomikr »

:facepalm:

thanks for catching that! I was staring too long at this code!
Post Reply

Return to “Developers”