#32909 [Opn->Csd]: wddx_* works incorrectly with objects with private/protected members
| From: | sniper@php.net | Date: | Mon, 02 May 2005 11:42:35 +0000 |
| Subject: | #32909 [Opn->Csd]: wddx_* works incorrectly with objects with private/protected members | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-78518@lists.php.net to get a copy of this message | ||
ID: 32909
Updated by: sniper@php.net
Reported By: dan at yes dot lt
-Status: Open
+Status: Closed
Bug Type: WDDX related
Operating System: winxp
PHP Version: 5.0.4
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-05-02 10:20:18] 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
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32909&edit=1