Page 1 of 1

Upgrade to PHP 8

Posted: 21 December 2023, 18:08
by joezg
Dear developers.
We are preparing the migration of BGA game servers to PHP 8. All games deployed to production must eventually be compatible with PHP 8 so we are currently analyzing them and patching them to solve common issues. We will individually contact you if your game cannot be simply patched and we will coordinate the upgrade with you.

The upgrade to PHP 8 will be done in two steps. We will first upgrade the Studio game server. At that point you will be able to check if your game works well with PHP 8 and fix any potential issue.
Following that, we will upgrade all the production game servers. Until this is done and we officially announce that boardgamearena is running on PHP 8, no specific PHP 8 feature is allowed.

We will post the exact date on this very channel. The upgrade of the Studio Game server will, most likely, be done during the January with upgrade of the production following shortly.

Re: Upgrade to PHP 8

Posted: 22 December 2023, 04:18
by Kayvon
joezg wrote: 21 December 2023, 18:08We will individually contact you if your game cannot be simply patched and we will coordinate the upgrade with you.
Will you contact us even if our games can be simply patched? If you patch my code without telling me, I'm likely to overwrite your changes next time I upload a bug fix. I'd prefer for that not to happen, so please let me know if my code is modified.

Re: Upgrade to PHP 8

Posted: 22 December 2023, 09:34
by p1ngouiin
Kayvon wrote: 22 December 2023, 04:18
joezg wrote: 21 December 2023, 18:08We will individually contact you if your game cannot be simply patched and we will coordinate the upgrade with you.
Will you contact us even if our games can be simply patched? If you patch my code without telling me, I'm likely to overwrite your changes next time I upload a bug fix. I'd prefer for that not to happen, so please let me know if my code is modified.
For now, the only change we applied on almost all games is the `implode` rule (https://www.php.net/manual/en/function.implode.php). If, in any case, you erased our changes, that's not a big deal. We could either re-patch the game before switching to PHP 8.x, or, you will be able to detect that your game doesn't work by yourselves directly on the studio (when the first step will be done). All games that could simply be patched have been patched already. So, if your games are not in active development, they have probably been patched.

We will keep communicating about this, to ensure everything is working well on PHP 8.x.

Re: Upgrade to PHP 8

Posted: 22 December 2023, 15:05
by Victoria_La
Is it possible to provide a list of games that has been patched?

Re: Upgrade to PHP 8

Posted: 23 December 2023, 19:15
by quietmint
As I mentioned in January 2021, a very common issue I foresee is related to static vs non-static method calls.

https://www.php.net/manual/en/language.oop5.static.php
Warning
Calling non-static methods statically throws an Error.

Prior to PHP 8.0.0, calling non-static methods statically were deprecated, and generated an E_DEPRECATED warning.
The Studio docs have never taken care on this point and are littered with incorrect usage. Since the documentation isn't consistent, you can bet that game code isn't consistent either. :lol: Same page https://en.doc.boardgamearena.com/Main_ ... e.game.php has both non-static (correct) and static (incorrect) examples for the same function:

Code: Select all

$players = $this->loadPlayersBasicInfos(); // okay
$players = self::loadPlayersBasicInfos(); // error

Re: Upgrade to PHP 8

Posted: 23 December 2023, 19:50
by GTSchemer
p1ngouiin wrote: 22 December 2023, 09:34
Kayvon wrote: 22 December 2023, 04:18
joezg wrote: 21 December 2023, 18:08We will individually contact you if your game cannot be simply patched and we will coordinate the upgrade with you.
Will you contact us even if our games can be simply patched? If you patch my code without telling me, I'm likely to overwrite your changes next time I upload a bug fix. I'd prefer for that not to happen, so please let me know if my code is modified.
For now, the only change we applied on almost all games is the `implode` rule (https://www.php.net/manual/en/function.implode.php). If, in any case, you erased our changes, that's not a big deal. We could either re-patch the game before switching to PHP 8.x, or, you will be able to detect that your game doesn't work by yourselves directly on the studio (when the first step will be done). All games that could simply be patched have been patched already. So, if your games are not in active development, they have probably been patched.

We will keep communicating about this, to ensure everything is working well on PHP 8.x.
Is it possible to still communicate with the developer when patching, e.g. via BGA message? Even with the paths you describe, I still foresee devs accidentally overwriting games when they later update them, if they missed checking 100% of their games and resyncing offline code during the Studio test period. Some devs have a LOT of games.

Re: Upgrade to PHP 8

Posted: 27 December 2023, 11:44
by LeSteffen
Happy about the change :D

Re: Upgrade to PHP 8

Posted: 09 January 2024, 01:24
by Kayvon
GTSchemer wrote: 23 December 2023, 19:50Is it possible to still communicate with the developer when patching, e.g. via BGA message?
Apparently, the answer is no. I just noticed one of my games had been changed just as I was deploying. :(

Re: Upgrade to PHP 8

Posted: 19 April 2024, 06:10
by quietmint
There's now a dedicated wiki page about this:
https://en.doc.boardgamearena.com/PHP_8_upgrade

Re: Upgrade to PHP 8

Posted: 19 April 2024, 07:47
by thoun
quietmint wrote: 23 December 2023, 19:15 As I mentioned in January 2021, a very common issue I foresee is related to static vs non-static method calls.

https://www.php.net/manual/en/language.oop5.static.php
Warning
Calling non-static methods statically throws an Error.

Prior to PHP 8.0.0, calling non-static methods statically were deprecated, and generated an E_DEPRECATED warning.
The Studio docs have never taken care on this point and are littered with incorrect usage. Since the documentation isn't consistent, you can bet that game code isn't consistent either. :lol: Same page https://en.doc.boardgamearena.com/Main_ ... e.game.php has both non-static (correct) and static (incorrect) examples for the same function:

Code: Select all

$players = $this->loadPlayersBasicInfos(); // okay
$players = self::loadPlayersBasicInfos(); // error
I updated the docs to remove all bad calls I found. And same for the new project base code. It should be cleaner now :) Don't hesitate to fix the doc or report if you see I missed some.