php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28335 wddx_serialize_value returns empty string
Submitted: 2004-05-09 09:16 UTC Modified: 2005-02-03 01:00 UTC
From: antonr at game dot permonline dot ru Assigned:
Status: No Feedback Package: WDDX related
PHP Version: 5CVS-2004-05-09 (dev) OS: Win32
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-05-09 09:16 UTC] antonr at game dot permonline dot ru
Description:
------------
In some cases wddx_serialize_value returns empty string.

Reproduce code:
---------------
<?php
  class MyClass1
    { public $myclass2;
    }

  class MyClass2
    { public $myclass1;
    }

  $a = new MyClass1;
  $a->number = 1;
  $a->myclass2 = new MyClass2;
  $a->myclass2->myclass1 = $a;

  echo wddx_serialize_value($a);
?>


Actual result:
--------------
empty string

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-21 12:46 UTC] clemens at gutweiler dot net
This example segfaults with PHP-5-RC3.
It contains recursive objects and should be solved like the 'r:123'-way in serialize().
 [2004-06-30 12:56 UTC] moriyoshi@php.net
A quotation from "The WDDX DTD" bundled in the WDDX SDK 10a.

---------------------------------------------
Serialization model-
WDDX serializes data using a model of pure aggregation. It has no mechanism for handling object references. Aliased references will result in multiple object instances being deserialized. WDDX serialization applied to a data structure that has cyclical references will most likely result in infinite iteration/recursion, depending on the serializer implementation. Object references support is another area of 
future investigation.
---------------------------------------------

Since WDDX instances are not designed to hold references as stated in the documentation, circular references doesn't make sense with it. It works differently from the serialize() function in essence. But, segfault should be prevented in a manner that wouldn't serialize objects referenced that way.

Patch can be found here: http://www.voltex.jp/patches/bug28335-preliminary.patch.diff
 [2004-06-30 15:45 UTC] antonr at game dot permonline dot ru
Probably you should part the objects themselves and links to these objects. And then serialize them separately.
 [2005-01-26 04:57 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-02-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 21:01:25 2019 UTC