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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Thu May 30 03:01:30 2024 UTC