|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-08 15:13 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2013-10-08 15:13 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 14:00:01 2025 UTC |
Description: ------------ When I use json_encode on a class, this get the properties values directly and bypass the __get magic method. It would be great if I could control the properties with __get Test script: --------------- class Example { public foo; public function __construct() { $this->foo = 'bar; } public function __get($param) { return $this->$param . ' modified'; } } $foo = new Example(); echo json_encode($foo); Expected result: ---------------- {"foo":"bar modified"} Actual result: -------------- {"foo":"bar"}