Closed jimmosk closed 10 years ago
It's absolutely worth a ticket when you get an internal error. I'll investigate.
Here's the log entry:
[Mon Jun 02 21:26:30 2014] [error] [client X.X.X.X] PHP Notice: Undefined offset: 0 in /var/www/engine/BMGame.php on line 251, referer: http://dev.buttonweavers.com/ui/game.html?game=516
[Mon Jun 02 21:26:30 2014] [error] [client X.X.X.X] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/engine/BMGame.php on line 252, referer: http://dev.buttonweavers.com/ui/game.html?game=516
Shadowshade: i'm suspicious because Notorious (and Zomulgustar, for that matter) is a button with option and reserve dice. The error is being triggered in a function, do_next_step_add_available_dice_to_game()
, iterating over swing dice in some fashion. Maybe something not quite implemented right in the intersection of option and reserve dice?
Okay, I'll take a look at this one.
I have a test case for this.
Add these two buttons:
test1: (1) (1) r(Z)
test2: (1,1) r(1)
Create a game between them, and play the first round. Button test1 will necessarily gain initiative and win the round, triggering the internal error, like so:
As noted above, the log error is:
[Tue Jun 17 15:17:34 2014] [error] [client 10.0.2.2] PHP Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/engine/BMGame.php on line 303, referer: http://localhost:8080/ui/game.html?game=16
Things i learned in the 16 games it took me to find a working test case:
(1) (Z) r(Z)
, the error doesn't occur. So it has something to do with the winning button having a reserve swing die which doesn't appear in its main recipeI think this would be good to fix, especially since it might affect more circumstances than the test case i was able to find. However, i've verified in vagrant that it doesn't appear to affect Hooloovoo (played Hooloovoo vs. Cammy Neko, and Hooloovoo vs. Sailor Mercury, made sure Hooloovoo won the first round each time, and at least once made sure Hooloovoo took the last attack before winning the round).
In other words, afaict this one only affects buttons with swing in reserve dice but not in starting dice, and that's only a handful of fanatics, none of which are considered "implemented", so no one is going to trip over them by accident on prod.
So my take is, not a blocker.
OK, I can replicate this bug:
Zomulgastar vs Cammy Neko, set swing option for Zomulgastar, then Cammy Neko surrenders as soon as possible.
I just had this crop up in game 516, when I won the first round:
Nothing seemed to actually go wrong with the game, though, so I'm not sure this is worth a ticket...