gamification icon indicating copy to clipboard operation
gamification copied to clipboard

Fix json encode null

Open datlechin opened this issue 1 year ago • 2 comments

Fix json encode null in php8.3

Fixes #0000

Changes proposed in this pull request:

Reviewers should focus on:

Screenshot

Confirmed

  • [ ] Frontend changes: tested on a local Flarum installation.
  • [ ] Backend changes: tests are green (run composer test).

Required changes:

datlechin avatar Jul 06 '24 04:07 datlechin

@DavideIadeluca if you want to do an optimization, although just a slight one, stop early instead of accessing the settings repository first (which you then don't need for an admin):

        if ($this->user->isAdmin()) return;

        return json_decode(
                $settings->get('fof-gamification.autoAssignGroups', '[]'),
                true
        );

luceos avatar Jul 24 '24 08:07 luceos

@DavideIadeluca if you want to do an optimization, although just a slight one, stop early instead of accessing the settings repository first (which you then don't need for an admin):

        if ($this->user->isAdmin()) return;

        return json_decode(
                $settings->get('fof-gamification.autoAssignGroups', '[]'),
                true
        );

Yeah right, makes sense. @datlechin Can you please use the suggestion of @luceos instead? 🙏

DavideIadeluca avatar Jul 24 '24 09:07 DavideIadeluca