Stack Exchange Network
Stack Exchange network consists of 183 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I am facing after an issue after upgrading version magneto 2.4.2 to 2.4.5 When I run this command I got error
json_decode(): Passing null to parameter #1 ($json) of type string is deprecated
app/code/Vendor/Module/Helper/Data.php(495): json_decode(NULL)
public function getParametersAttribute()
return $cookieValue=json_decode((string)$cookieValue);
2. Add condition
public function getParametersAttribute(){
if (isset($cookieValue)) {
return $cookieValue=json_decode($cookieValue);
}else{
return [];
3. Try this one
public function getParametersAttribute(){
return $cookieValue= json_decode($cookieValue ?? '');
public function getParametersAttribute()
-. return $cookieValue=json_decode($cookieValue);
public function getParametersAttribute()
+. return $cookieValue= json_decode($cookieValue ?? '');
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.