PennyDreadfulMTG / gatherling_fork

This is an archived repo. Check https://github.com/PennyDreadfulMTG/gatherling instead.
https://github.com/PennyDreadfulMTG/gatherling
MIT License
8 stars 5 forks source link

Registration fails with blank screen - Call to undefined method stdClass::save() #207

Closed vorpal-buildbot closed 5 years ago

vorpal-buildbot commented 5 years ago

Reported on Discord by bakert#2193

bakert commented 5 years ago

/var/log/apache2/access_log is the access log so I assume /var/log/apache2/error_log is the error log.

bakert commented 5 years ago

/home/discord/gatherling.log is the error log

bakert commented 5 years ago
[Mon Apr 08 04:23:06.373179 2019] [php7:notice] [pid 15167] [client 172.69.23.41:60242] PHP Notice:  Trying to get property 'password' of non-object in /home/discord/public_html/gatherling.one/register.php on line 78, referer: https://gatherling.one/register.php
[Mon Apr 08 04:23:06.373267 2019] [php7:warn] [pid 15167] [client 172.69.23.41:60242] PHP Warning:  Creating default object from empty value in /home/discord/public_html/gatherling.one/register.php on line 82, referer: https://gatherling.one/register.php
[Mon Apr 08 04:23:06.381838 2019] [php7:error] [pid 15167] [client 172.69.23.41:60242] PHP Fatal error:  Uncaught Error: Call to undefined method stdClass::save() in /home/discord/public_html/gatherling.one/register.php:87\nStack trace:\n#0 /home/discord/public_html/gatherling.one/register.php(26): doRegister()\n#1 /home/discord/public_html/gatherling.one/register.php(14): content()\n#2 {main}\n  thrown in /home/discord/public_html/gatherling.one/register.php on line 87, referer: https://gatherling.one/register.php
bakert commented 5 years ago

Cannot repro on local.

bakert commented 5 years ago

The problem is that $player = Player::findOrCreateByName($_POST['username']); returns NULL. Which I guess is theoretically not possible.

bakert commented 5 years ago
MariaDB [gatherli_gatherling]> INSERT INTO players (name) VALUES ('bakertsupertest');
ERROR 1364 (HY000): Field 'email_privacy' doesn't have a default value

might be the root cause here.

bakert commented 5 years ago

The database thinks it is up to date even though v23 adds a default value of 0 for this field. So not sure how we got in this mangled state.

Ran ALTER TABLEplayersCHANGE COLUMNemail_privacy`email_privacy TINYINT(3) NOT NULL DEFAULT '0';` manually to fix things up but I'm concerned other db upgrades may have been skipped causing other issues.

bakert commented 5 years ago

Leaving this open to check other db upgrades. Registration now works.

bakert commented 5 years ago
bakert commented 5 years ago

OK well I didn't find any problems in the last eleven changes except that one. Confused but closing.