|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7619 serialize() works not correct with cascaded objects in some circumstances
Submitted: 2000-11-03 08:13 UTC Modified: 2000-12-03 19:09 UTC
From: i088 at informatik dot fh-wuerzburg dot de Assigned:
Status: Closed Package: Variables related
PHP Version: 4.0.3pl1 OS: Win9x / Linux
Private report: No CVE-ID: None
 [2000-11-03 08:13 UTC] i088 at informatik dot fh-wuerzburg dot de
serialize() works not correct with cascaded objects in some circumstances  (on PHP 3.0.1x this worked correct !!) :
You have an object whitch contains "normal" variables like integers, strings and also other objects. These other objects also contains integers, strings etc. and again objects:

object 1 --- variable 11
          |- variable 12
          |      :
          |- variable 1x
          |- object 2 --- variable 21
                       |- variable 22
                       |      :
                       |- variable 2x
                       |- object 3 --- variable 31
                                    |      :
                                    |- variable 3x

Under some circumstances the output that serialize() produces does only contain the top-level object (object 1)with its "normal" variables (variable 11 ... variable 1x). The other objects (object 2 and 3) with all there variables are lost.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-05 06:31 UTC]
Could you please provide some short example code?
 [2000-11-29 06:37 UTC]
No feedback. 
 [2000-11-29 16:13 UTC] i088 at informatik dot fh-wuerzburg dot de
Here the script:
------------------------cut here----------------------------
  class MetaClass
    var $id;
    var $MainClassObject;

  class MainClass
    var $id;
    var $SubClassObjectArray;
  class SubClass
    var $id;
    var $Item;

  function MainClass_addSubClassObject(&$MainClassReference, $SubClassObject)

  $myMetaClass=new MetaClass;
  $myMainClass=new MainClass;

  $mySubClass1=new SubClass;
  $mySubClass1->Item="SubClass 1";
  MainClass_addSubClassObject($myMetaClass->MainClassObject, $mySubClass1);

  $mySubClass2=new SubClass;
  $mySubClass2->Item="SubClass 2";

  MainClass_addSubClassObject($myMetaClass->MainClassObject, $mySubClass2);

  while ($myoldSubClass)
    print $myoldSubClass->id."----".$myoldSubClass->Item."<br>\n";
  print "<br>\n";

  print $serialized_data."<br>\n";
  print "<br>\n";

  while ($mynewSubClass)
    print $mynewSubClass->id."----".$mynewSubClass->Item."<br>\n";
------------------------cut here----------------------------

 [2000-11-29 18:17 UTC]
Could you please try latest snapshot from ?
This example code of yours works for me just fine (Linux).

 [2000-12-03 19:09 UTC]
User feedback:

now I'v got the latest snapshot and it seems that the serialize-bug is
fixed. All my scripts seems to work just fine now (with
Linux/Apache/PHP4.0.4-DEV_DSO). I could not try anything with Win9x,
because I don't have MSVC++ to compile PHP under Windows OS. If anyone
have a compiled version for Windows as ISAPI ".dll" please send it to me
and I'll try.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Aug 04 23:01:24 2021 UTC