thedevdojo / voyager

Voyager - The Missing Laravel Admin
https://voyager.devdojo.com
MIT License
11.78k stars 2.67k forks source link

json_decode(): Passing null to parameter #1 ($json) of type string is deprecated #5603

Open SafonovVA opened 2 years ago

SafonovVA commented 2 years ago

Laravel version

9.14.0

PHP version

8.1.5

Voyager version

1.5.2

Database

PostgeSQL 14.3

Description

_jsondecode(): Passing null to parameter #1 ($json) of type string is deprecated in /var/www/vendor/tcg/voyager/src/Models/MenuItem.php on line 93

Steps to reproduce

This warning shows the debugbar on any page in Voyager

Expected behavior

Get rid of the warning

Screenshots

Screenshot from 2022-05-25 14-24-03

Additional context

Try to use null coleascing operator:

public function getParametersAttribute() { -. return json_decode($this->attributes['parameters']); }


public function getParametersAttribute() { +. return json_decode($this->attributes['parameters'] ?? ''); }

nistlrooy2 commented 2 years ago

same problem

howdu commented 2 years ago

Also could be fixed with https://github.com/the-control-group/voyager/pull/5575