note 127008 added to function.json-decode

From: Date: Sun, 24 Apr 2022 21:50:22 +0000
Subject: note 127008 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-218310@lists.php.net to get a copy of this message
I have been working with php v8.1.5 and this happens: I have these addresses saved in the "products" table in the image_path field (3 sizes): {\"thumb\":\"\\/public\\/products\\/strawberry-pulp.png-thumb.png\",\"medium\":\"\\/public\\/products \\/strawberry-pulp.png-medium.png\",\"full\":\"\\/public\\/products\\/strawberry-pulp.png-full.png\"} I want to retrieve "medium" size images with this code. data-src="{{ url('images'.json_decode($p->image_path)->medium) }}" But I get this error: Attempt to read property "medium" on null What is the right way? ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.135 (proxied: 190.83.61.142) ---- Manual Page -- https://php.net/manual/en/function.json-decode.php Edit -- https://main.php.net/note/edit/127008 Del: integrated -- https://main.php.net/note/delete/127008/integrated Del: useless -- https://main.php.net/note/delete/127008/useless Del: bad code -- https://main.php.net/note/delete/127008/bad+code Del: spam -- https://main.php.net/note/delete/127008/spam Del: non-english -- https://main.php.net/note/delete/127008/non-english Del: in docs -- https://main.php.net/note/delete/127008/in+docs Del: other reasons-- https://main.php.net/note/delete/127008 Reject -- https://main.php.net/note/reject/127008 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#218310) next »