php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32909 wddx_* works incorrectly with objects with private/protected members
Submitted: 2005-05-02 10:20 UTC Modified: 2005-05-02 13:42 UTC
From: dan at yes dot lt Assigned:
Status: Closed Package: WDDX related
PHP Version: 5.0.4 OS: winxp
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dan at yes dot lt
New email:
PHP Version: OS:

 

 [2005-05-02 10:20 UTC] dan at yes dot lt
Description:
------------
wddx_* works incorrectly with objects with private/protected members. for correct behaviour see serialize/unserialize functions.

Reproduce code:
---------------
class Test
{
    private $a = 10;
    protected $b = true;
    public $c = 'test';
}

$src = new Test();
print_r($src);

$wddx = wddx_serialize_value($src);
echo $wddx, "\n";

$dst = wddx_deserialize($wddx);
print_r($dst);

Expected result:
----------------
Test Object
(
    [a:private] => 10
    [b:protected] => 1
    [c] => test
)

<wddxPacket version='1.0'><header/><data><struct><var name='php_class_name'><string>Test</string></var><var name='a'><number>10</number></var><var name='b'><boolean value='true'/></var><var name='c'><string>test</string></var></struct></data></wddxPacket>

Test Object
(
    [a:private] => 10
    [b:protected] => 1
    [c] => test
)


Actual result:
--------------
Test Object
(
    [a:private] => 10
    [b:protected] => 1
    [c] => test
)

<wddxPacket version='1.0'><header/><data><struct><var name='php_class_name'><string>Test</string></var><var name=''><number>10</number></var><var name=''><boolean value='true'/></var><var name='c'><string>test</string></var></struct></data></wddxPacket>

Test Object
(
    [a:private] => 10
    [b:protected] => 1
    [c] => test
    [0] => 10
    [1] => 1
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-02 13:42 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC