|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57516 protected/private members cannot be serialized
Submitted: 2007-02-08 18:49 UTC Modified: 2008-12-18 22:23 UTC
From: david dot seidel at prodyna dot com Assigned:
Status: Wont fix Package: json (PECL)
PHP Version: 5.2.0 OS: Windows XP SP2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: david dot seidel at prodyna dot com
New email:
PHP Version: OS:


 [2007-02-08 18:49 UTC] david dot seidel at prodyna dot com
It's not possible to serialize protected and/or private member variables.

Reproduce code:
class MyBean {
	protected $value = null;
	public function __construct() { 
		$this->value = "hallo";
	public function setValue($value) {
		$this->value = $value;
	public function getValue() {
		return $value;
$a = new MyBean();
echo json_encode($a); 

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-12-18 22:23 UTC]
This is completely intentional looking at the code, if you 
wish to see this changed I'd open a bug report at
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Thu Dec 03 14:01:27 2020 UTC