note 130461 added to function.json-encode

From: Date: Wed, 27 Aug 2025 04:43:51 +0000
Subject: note 130461 added to function.json-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-222320@lists.php.net to get a copy of this message
Note that json_encode() includes virtual properties in PHP 8.4 that define getters, which is unexpected. class Foo { public int $bar { get { return 42; } } } An instance of this will yield the following JSON: {"bar":42} ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 14.202.77.42) ---- Manual Page -- https://php.net/manual/en/function.json-encode.php Edit -- https://main.php.net/note/edit/130461 Del: integrated -- https://main.php.net/note/delete/130461/integrated Del: useless -- https://main.php.net/note/delete/130461/useless Del: bad code -- https://main.php.net/note/delete/130461/bad+code Del: spam -- https://main.php.net/note/delete/130461/spam Del: non-english -- https://main.php.net/note/delete/130461/non-english Del: in docs -- https://main.php.net/note/delete/130461/in+docs Del: other reasons-- https://main.php.net/note/delete/130461 Reject -- https://main.php.net/note/reject/130461 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#222320) next »