php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19857 wddx_deserialize Does Not Work Properly with Complex Data Types
Submitted: 2002-10-11 00:56 UTC Modified: 2003-07-04 02:06 UTC
Votes:3
Avg. Score:4.3 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: darwin at museplay dot com Assigned:
Status: No Feedback Package: WDDX related
PHP Version: 4.2.3 OS: Win XP Pro
Private report: No CVE-ID: None
 [2002-10-11 00:56 UTC] darwin at museplay dot com
// Here is a valid WDDX packet with "layers" of PHP objects:
  $oItem	= '<wddxPacket version="1.0"><header /><data><struct><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="aoImages"><array length="0" /></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="aoSuboptions"><array length="2"><struct><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string> what size do you want</string></var><var name="iMaxNumPaidSuboptions"><string>2</string></var><var name="iMinNumPaidSuboptions"><string>2</string></var><var name="iMaxNumFreeSuboptions"><string>3</string></var><var name="iMinNumFreeSuboptions"><string>1</string></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>pizza</string></var><var name="iID"><string>1</string></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>coption</string></var></struct><struct><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string> what size do you want</string></var><var name="iMaxNumPaidSuboptions"><string>2</string></var><var name="iMinNumPaidSuboptions"><string>2</string></var><var name="iMaxNumFreeSuboptions"><string>3</string></var><var name="iMinNumFreeSuboptions"><string>1</string></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>salad</string></var><var name="iID"><string>2</string></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>coption</string></var></struct></array></var><var name="sQuestion"><string>Hello?</string></var><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>2</number></var><var name="iMaxNumFreeSuboptions"><number>3</number></var><var name="iMinNumFreeSuboptions"><number>0</number></var><var name="bActive"><boolean value="true" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="true" /></var><var name="fWholesalePrice"><number>12</number></var><var name="fRetailPrice"><number>18</number></var><var name="iTimesAvailable"><number>5</number></var><var name="sDetailedDesc"><string>&apos;Da bomb is hear again!  This is a friggin&apos; quarter pound of good, good stuff!</string></var><var name="sBriefDesc"><string>&apos;Dis Shit is Wack!</string></var><var name="iPosition"><number>0</number></var><var name="iNumber"><number>55</number></var><var name="sName"><string>Wacky Burger 6</string></var><var name="iID"><number>0</number></var></struct></data></wddxPacket>' ;

//  attempt to deserialize the WDDX packet:
  $oItem	= wddx_deserialize( $oItem ) ;
  print_r( $oItem ) ;

/* this will result in the following output; notice that fields, like $oItem->aoSuboptions[0]->iID do not get set in the deserialized version, even though they are contained in the original WDDX packet:

(
    [aoImages] => Array
        (
        )

    [aoSuboptions] => Array
        (
            [0] => coption Object
                (
                    [aoImages] => 
                    [aoSuboptions] => 
                    [sConstructionErrors] => 
                    [iNumber] => 
                    [iPosition] => 
                    [oOptionSuboptions] => 
                    [oOptionTaxes] => 
                    [oOptionDiscounts] => 
                    [oOptionImages] => 
                    [aoOptionMenues] => 
                    [oItemCategories] => 
                    [iID] => 
                    [sName] => 
                    [sBriefDesc] => 
                    [sDetailedDesc] => 
                    [iTimesAvailable] => 
                    [fRetailPrice] => 
                    [fWholesalePrice] => 
                    [bTaxable] => 
                    [bDiscounted] => 
                    [bActive] => 
                    [iMinNumFreeSuboptions] => 
                    [iMaxNumFreeSuboptions] => 
                    [iMinNumPaidSuboptions] => 
                    [iMaxNumPaidSuboptions] => 
                    [sQuestion] => 
                    [sScriptRoot] => http://localhost/Delisma/Menu/
                    [fDiscountRate] => 0
                    [fTaxRate] => 0.0825
                )

            [1] => coption Object
                (
                    [aoImages] => 
                    [aoSuboptions] => 
                    [sConstructionErrors] => 
                    [iNumber] => 
                    [iPosition] => 
                    [oOptionSuboptions] => 
                    [oOptionTaxes] => 
                    [oOptionDiscounts] => 
                    [oOptionImages] => 
                    [aoOptionMenues] => 
                    [oItemCategories] => 
                    [iID] => 
                    [sName] => 
                    [sBriefDesc] => 
                    [sDetailedDesc] => 
                    [iTimesAvailable] => 
                    [fRetailPrice] => 
                    [fWholesalePrice] => 
                    [bTaxable] => 
                    [bDiscounted] => 
                    [bActive] => 
                    [iMinNumFreeSuboptions] => 
                    [iMaxNumFreeSuboptions] => 
                    [iMinNumPaidSuboptions] => 
                    [iMaxNumPaidSuboptions] => 
                    [sQuestion] => 
                    [sScriptRoot] => http://localhost/Delisma/Menu/
                    [fDiscountRate] => 0
                    [fTaxRate] => 0.0825
                )

        )

    [sConstructionErrors] => 
    [iNumber] => 55
    [iPosition] => 0
    [oOptionSuboptions] => 
    [oOptionTaxes] => 
    [oOptionDiscounts] => 
    [oOptionImages] => 
    [aoOptionMenues] => 
    [oItemCategories] => 
    [iID] => 0
    [sName] => Wacky Burger 6
    [sBriefDesc] => 'Dis Shit is Wack!
    [sDetailedDesc] => 'Da bomb is hear again!  This is a friggin' quarter pound of good, good stuff!
    [iTimesAvailable] => 5
    [fRetailPrice] => 18
    [fWholesalePrice] => 12
    [bTaxable] => 1
    [bDiscounted] => 
    [bActive] => 1
    [iMinNumFreeSuboptions] => 0
    [iMaxNumFreeSuboptions] => 3
    [iMinNumPaidSuboptions] => 2
    [iMaxNumPaidSuboptions] => 2
    [sQuestion] => Hello?
    [sScriptRoot] => http://localhost/Delisma/Menu/
    [fDiscountRate] => 0
    [fTaxRate] => 0.0825
)

*/

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-12 02:31 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-10-13 03:30 UTC] darwin at museplay dot com
I tried using http://snaps.php.net/win32/php4-win32-latest.zip, and it did not solve the problem.  Is there anything special that I need to do to configure this build that you believe will solve the problem?
 [2002-10-13 04:02 UTC] darwin at museplay dot com
FYI, I tried changing the order of the fields in the WDDX packet, removing fields from the WDDX packet, changing the types of the fields in the WDDX packet, etc., none of this appears to have an impact on how PHP unserializes the packet.  Also, PHP consistently only populates the "last" four fields of the aoSuboptions array in the example that I sent you, no matter how the WDDX packet is modified.

Thus, I would suspect that, since this bug is so easy to reproduce, it will not be difficult to fix...
 [2002-10-13 04:03 UTC] sniper@php.net
Please provide shortest possible example script that can
be just copy pasted and run. That would help us a lot..

 [2002-10-13 04:06 UTC] darwin at museplay dot com
I tried changing the order of the fields in the WDDX packet,
removing fields from the WDDX packet, changing the types of the fields in the WDDX packet, etc., none of this appears to have an impact on how PHP unserializes the packet.  Also, PHP consistently only populates the "last" four fields of the aoSuboptions array in the example that I sent you, no matter how the WDDX packet is modified.

For example, this WDDX packet produces the same unserialized results as stated in the original submission, even though the order of fields and field data types in the packet have been changed:

<wddxPacket version="1.0"><header /><data><struct><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="aoImages"><array length="0" /></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="aoSuboptions"><array length="2"><struct><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>2</number></var><var name="iMaxNumFreeSuboptions"><number>3</number></var><var name="iMinNumFreeSuboptions"><number>1</number></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>pizza</string></var><var name="iID"><number>1</number></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string>What size do you want?</string></var></struct><struct><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string>What size do you want?</string></var><var name="iMaxNumPaidSuboptions"><string>2</string></var><var name="iMinNumPaidSuboptions"><string>2</string></var><var name="iMaxNumFreeSuboptions"><string>3</string></var><var name="iMinNumFreeSuboptions"><string>1</string></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>salad</string></var><var name="iID"><number>2</number></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>coption</string></var></struct></array></var><var name="sQuestion"><string>Waz&apos; up?</string></var><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>0</number></var><var name="iMaxNumFreeSuboptions"><number>1</number></var><var name="iMinNumFreeSuboptions"><number>0</number></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><number>12</number></var><var name="fRetailPrice"><number>18</number></var><var name="iTimesAvailable"><number>5</number></var><var name="sDetailedDesc"><string>&apos;Da bomb is hear again!  This is a friggin&apos; quarter pound of good, good stuff!</string></var><var name="sBriefDesc"><string>&apos;Dis Shit is Wack!</string></var><var name="iPosition"><number>0</number></var><var name="iNumber"><number>55</number></var><var name="sName"><string>Wacky Burger 5</string></var><var name="iID"><number>0</number></var></struct></data></wddxPacket>

Thus, I would suspect that, since this bug is so easy to reproduce, it will not be difficult to fix...
 [2002-10-13 04:06 UTC] darwin at museplay dot com
I tried changing the order of the fields in the WDDX packet,
removing fields from the WDDX packet, changing the types of the fields in the WDDX packet, etc., none of this appears to have an impact on how PHP unserializes the packet.  Also, PHP consistently only populates the "last" four fields of the aoSuboptions array in the example that I sent you, no matter how the WDDX packet is modified.

For example, this WDDX packet produces the same unserialized results as stated in the original submission, even though the order of fields and field data types in the packet have been changed:

<wddxPacket version="1.0"><header /><data><struct><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="aoImages"><array length="0" /></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="aoSuboptions"><array length="2"><struct><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>2</number></var><var name="iMaxNumFreeSuboptions"><number>3</number></var><var name="iMinNumFreeSuboptions"><number>1</number></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>pizza</string></var><var name="iID"><number>1</number></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string>What size do you want?</string></var></struct><struct><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string>What size do you want?</string></var><var name="iMaxNumPaidSuboptions"><string>2</string></var><var name="iMinNumPaidSuboptions"><string>2</string></var><var name="iMaxNumFreeSuboptions"><string>3</string></var><var name="iMinNumFreeSuboptions"><string>1</string></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>salad</string></var><var name="iID"><number>2</number></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>coption</string></var></struct></array></var><var name="sQuestion"><string>Waz&apos; up?</string></var><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>0</number></var><var name="iMaxNumFreeSuboptions"><number>1</number></var><var name="iMinNumFreeSuboptions"><number>0</number></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><number>12</number></var><var name="fRetailPrice"><number>18</number></var><var name="iTimesAvailable"><number>5</number></var><var name="sDetailedDesc"><string>&apos;Da bomb is hear again!  This is a friggin&apos; quarter pound of good, good stuff!</string></var><var name="sBriefDesc"><string>&apos;Dis Shit is Wack!</string></var><var name="iPosition"><number>0</number></var><var name="iNumber"><number>55</number></var><var name="sName"><string>Wacky Burger 5</string></var><var name="iID"><number>0</number></var></struct></data></wddxPacket>

Thus, I would suspect that, since this bug is so easy to reproduce, it will not be difficult to fix...
 [2002-10-13 04:07 UTC] darwin at museplay dot com
BTW, I apologize for all of the submissions; I mistakenly submitted more times that I wanted to...
 [2002-10-13 06:24 UTC] sniper@php.net
Please provide shortest possible example script that can
be just copy pasted and run. That would help us a lot..
 [2002-10-13 06:24 UTC] sniper@php.net
Please provide shortest possible example script that can
be just copy pasted and run. That would help us a lot..
 [2002-10-13 17:55 UTC] darwin at museplay dot com
<script language="php">

//  here is a very short, and simple example that reproduces the problem; please let me know, ASAP, if you locate the bug

class COption
{

  function COption( )
  {

  }    //  constructor

  var $iID			;
  var $sName			;
  var $sBriefDesc		;
  var $sDetailedDesc		;
  var $iTimesAvailable		;
  var $fRetailPrice		;
  var $fWholesalePrice		;
  var $bTaxable			;
  var $bDiscounted		;
  var $bActive			;
  var $iMinNumFreeSuboptions	;
  var $iMaxNumFreeSuboptions	;
  var $iMinNumPaidSuboptions	;
  var $iMaxNumPaidSuboptions	;
  var $sQuestion		;
  var $aoImages			;
  var $aoSuboptions		;
  var $iNumber			;
  var $iPosition		;

}    //  COption

$oItemTemp = '<wddxPacket version="1.0"><header /><data><struct><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="aoImages"><array length="0" /></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="aoSuboptions"><array length="2"><struct><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>2</number></var><var name="iMaxNumFreeSuboptions"><number>3</number></var><var name="iMinNumFreeSuboptions"><number>1</number></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="true" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>pizza</string></var><var name="iID"><number>1</number></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>COption</string></var><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string>What size do you want?</string></var></struct><struct><var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var><var name="fDiscountRate"><number>0</number></var><var name="fTaxRate"><number>0.0825</number></var><var name="sQuestion"><string>What size do you want?</string></var><var name="iMaxNumPaidSuboptions"><string>2</string></var><var name="iMinNumPaidSuboptions"><string>2</string></var><var name="iMaxNumFreeSuboptions"><string>3</string></var><var name="iMinNumFreeSuboptions"><string>1</string></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><string>5.02</string></var><var name="fRetailPrice"><string>5.35</string></var><var name="iTimesAvailable"><string>5</string></var><var name="sDetailedDesc"><string>good good stuff</string></var><var name="sBriefDesc"><string>good stuff</string></var><var name="sName"><string>salad</string></var><var name="iID"><number>2</number></var><var name="oItemCategories"><null /></var><var name="aoOptionMenues"><null /></var><var name="oOptionImages"><null /></var><var name="oOptionDiscounts"><null /></var><var name="oOptionTaxes"><null /></var><var name="oOptionSuboptions"><null /></var><var name="iPosition"><null /></var><var name="iNumber"><null /></var><var name="sConstructionErrors"><null /></var><var name="aoSuboptions"><null /></var><var name="aoImages"><null /></var><var name="php_class_name"><string>coption</string></var></struct></array></var><var name="sQuestion"><string>Waz&apos; up?</string></var><var name="iMaxNumPaidSuboptions"><number>2</number></var><var name="iMinNumPaidSuboptions"><number>0</number></var><var name="iMaxNumFreeSuboptions"><number>1</number></var><var name="iMinNumFreeSuboptions"><number>0</number></var><var name="bActive"><boolean value="false" /></var><var name="bDiscounted"><boolean value="false" /></var><var name="bTaxable"><boolean value="false" /></var><var name="fWholesalePrice"><number>12</number></var><var name="fRetailPrice"><number>18</number></var><var name="iTimesAvailable"><number>5</number></var><var name="sDetailedDesc"><string>&apos;Da bomb is hear again!  This is a friggin&apos; quarter pound of good, good stuff!</string></var><var name="sBriefDesc"><string>&apos;Dis Shit is Wack!</string></var><var name="iPosition"><number>0</number></var><var name="iNumber"><number>55</number></var><var name="sName"><string>Wacky Burger 5</string></var><var name="iID"><number>0</number></var></struct></data></wddxPacket>' ;
$oItem	= wddx_deserialize( $oItemTemp ) ;

print_r( $oItem ) ;

</script>
 [2002-10-13 19:04 UTC] sniper@php.net
How did you create the wddx data?
Can you please come up with SHORT example?

 [2002-10-13 19:06 UTC] darwin at museplay dot com
//  I HAVE ISSOLATED THE PROBLEM FOR YOU!!!
//
//  Check out the code, below; via it, you will note that PHP is sensitive to the positioning of fields in within the WDDX packet; this is your bug; since the fields of a WDDX packet are unordered, you cannot expect them to be in any particular order.  Please let me know, ASAP, once you have fixed this bug, since my team would really like to utilize WDDX for our project.
//
//  Take care,
//  Darwin

<script language="php">

class COption
{

  function COption( )
  {

  }    //  constructor

  function test( )
  {
    $oSuboption1 = new COption( ) ;
    $oSuboption1->iID = 10 ;
    $oSuboption1->sName = "Suboption 1" ;
    $oSuboption1->sBriefDesc = "SO 1 brief desc" ;
    $oSuboption1->sDetailedDesc = "Suboption 1 detailed description..." ;
    $oSuboption1->iTimesAvailable = 7 ;
    $oSuboption1->fRetailPrice = 10 ;
    $oSuboption1->fWholesalePrice = 5 ;
    $oSuboption1->bTaxable = true ;
    $oSuboption1->bDiscounted = false  ;
    $oSuboption1->bActive = true ;
    $oSuboption1->iMinNumFreeSuboptions = 0 ;
    $oSuboption1->iMaxNumFreeSuboptions = 0 ;
    $oSuboption1->iMinNumPaidSuboptions = 0 ;
    $oSuboption1->iMaxNumPaidSuboptions = 0 ;
    $oSuboption1->sQuestion = "Suoption 1 Question?" ;
    $oSuboption1->aoImages = array() ;
    $oSuboption1->iNumber = null ;
    $oSuboption1->iPosition = null ;
    $oSuboption1->sScriptRoot = "http://localhost/Delisma/Menu/" ;
    $oSuboption1->fDiscountRate = 0 ;
    $oSuboption1->fTaxRate = 0.0825 ;

    $oSuboption2 = new COption( ) ;
    $oSuboption2->iID = 10 ;
    $oSuboption2->sName = "Suboption 2" ;
    $oSuboption2->sBriefDesc = "SO 2 brief desc" ;
    $oSuboption2->sDetailedDesc = "Suboption 2 detailed description..." ;
    $oSuboption2->iTimesAvailable = 1 ;
    $oSuboption2->fRetailPrice = 8 ;
    $oSuboption2->fWholesalePrice = 3 ;
    $oSuboption2->bTaxable = true ;
    $oSuboption2->bDiscounted = false  ;
    $oSuboption2->bActive = true ;
    $oSuboption2->iMinNumFreeSuboptions = 5 ;
    $oSuboption2->iMaxNumFreeSuboptions = 10 ;
    $oSuboption2->iMinNumPaidSuboptions = 15 ;
    $oSuboption2->iMaxNumPaidSuboptions = 20 ;
    $oSuboption2->sQuestion = "Suoption 2 Question?" ;
    $oSuboption2->aoImages = array() ;
    $oSuboption2->iNumber = null ;
    $oSuboption2->iPosition = null ;
    $oSuboption2->sScriptRoot = "http://localhost/Delisma/Menu/" ;
    $oSuboption2->fDiscountRate = 0 ;
    $oSuboption2->fTaxRate = 0.0825 ;

    $this->iID = 0 ;
    $this->sName = "Wacky Burger 5" ;
    $this->sBriefDesc = "'Dis Shit is Wack!" ;
    $this->sDetailedDesc = "'Da bomb is hear again!  This is a friggin' quarter pound of good, good stuff!" ;
    $this->iTimesAvailable = 5 ;
    $this->fRetailPrice = 18 ;
    $this->fWholesalePrice = 12 ;
    $this->bTaxable = true ;
    $this->bDiscounted = false  ;
    $this->bActive = true ;
    $this->iMinNumFreeSuboptions = 0 ;
    $this->iMaxNumFreeSuboptions = 1 ;
    $this->iMinNumPaidSuboptions = 0 ;
    $this->iMaxNumPaidSuboptions = 2 ;
    $this->sQuestion = "Waz' up?" ;
    $this->aoImages = array() ;
    $this->aoSuboptions = array( $oSuboption1, $oSuboption2 ) ;
    $this->iNumber = 55 ;
    $this->iPosition = 0 ;
    $this->sScriptRoot = "http://localhost/Delisma/Menu/" ;
    $this->fDiscountRate = 0 ;
    $this->fTaxRate = 0.0825 ;
    $this->iNumber = 55 ;
    $this->iPosition = 0 ;
    $this->sScriptRoot = "http://localhost/Delisma/Menu/" ;
    $this->fDiscountRate = 0 ;
    $this->fTaxRate = 0.0825 ;
    
  }

  var $iID			;
  var $sName			;
  var $sBriefDesc		;
  var $sDetailedDesc		;
  var $iTimesAvailable		;
  var $fRetailPrice		;
  var $fWholesalePrice		;
  var $bTaxable			;
  var $bDiscounted		;
  var $bActive			;
  var $iMinNumFreeSuboptions	;
  var $iMaxNumFreeSuboptions	;
  var $iMinNumPaidSuboptions	;
  var $iMaxNumPaidSuboptions	;
  var $sQuestion		;
  var $aoImages			;
  var $aoSuboptions		;
  var $iNumber			;
  var $iPosition		;

}    //  COption

$sWDDXPacketBad = '
<wddxPacket version="1.0">
 <header />
 <data>
  <struct>
   <var name="php_class_name"><string>COption</string></var>
   <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
   <var name="aoImages"><array length="0" /></var>
   <var name="fDiscountRate"><number>0</number></var>
   <var name="fTaxRate"><number>0.0825</number></var>
   <var name="aoSuboptions">
    <array length="2">
     <struct>
      <var name="iMaxNumPaidSuboptions"><number>2</number></var>
      <var name="iMinNumPaidSuboptions"><number>2</number></var>
      <var name="iMaxNumFreeSuboptions"><number>3</number></var>
      <var name="iMinNumFreeSuboptions"><number>1</number></var>
      <var name="bActive"><boolean value="true" /></var>
      <var name="bDiscounted"><boolean value="false" /></var>
      <var name="bTaxable"><boolean value="true" /></var>
      <var name="fWholesalePrice"><string>5.02</string></var>
      <var name="fRetailPrice"><string>5.35</string></var>
      <var name="iTimesAvailable"><string>5</string></var>
      <var name="sDetailedDesc"><string>good good stuff</string></var>
      <var name="sBriefDesc"><string>good stuff</string></var>
      <var name="sName"><string>pizza</string></var>
      <var name="iID"><number>1</number></var>
      <var name="oItemCategories"><null /></var>
      <var name="aoOptionMenues"><null /></var>
      <var name="oOptionImages"><null /></var>
      <var name="oOptionDiscounts"><null /></var>
      <var name="oOptionTaxes"><null /></var>
      <var name="oOptionSuboptions"><null /></var>
      <var name="iPosition"><null /></var>
      <var name="iNumber"><null /></var>
      <var name="sConstructionErrors"><null /></var>
      <var name="aoSuboptions"><null /></var>
      <var name="aoImages"><null /></var>
      <var name="php_class_name"><string>COption</string></var>
      <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
      <var name="fDiscountRate"><number>0</number></var>
      <var name="fTaxRate"><number>0.0825</number></var>
      <var name="sQuestion"><string>What size do you want?</string></var>
     </struct>
     <struct>
      <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
      <var name="fDiscountRate"><number>0</number></var>
      <var name="fTaxRate"><number>0.0825</number></var>
      <var name="sQuestion"><string>What size do you want?</string></var>
      <var name="iMaxNumPaidSuboptions"><string>2</string></var>
      <var name="iMinNumPaidSuboptions"><string>2</string></var>
      <var name="iMaxNumFreeSuboptions"><string>3</string></var>
      <var name="iMinNumFreeSuboptions"><string>1</string></var>
      <var name="bActive"><boolean value="true" /></var>
      <var name="bDiscounted"><boolean value="false" /></var>
      <var name="bTaxable"><boolean value="true" /></var>
      <var name="fWholesalePrice"><string>5.02</string></var>
      <var name="fRetailPrice"><string>5.35</string></var>
      <var name="iTimesAvailable"><string>5</string></var>
      <var name="sDetailedDesc"><string>good good stuff</string></var>
      <var name="sBriefDesc"><string>good stuff</string></var>
      <var name="sName"><string>salad</string></var>
      <var name="iID"><number>2</number></var>
      <var name="oItemCategories"><null /></var>
      <var name="aoOptionMenues"><null /></var>
      <var name="oOptionImages"><null /></var>
      <var name="oOptionDiscounts"><null /></var>
      <var name="oOptionTaxes"><null /></var>
      <var name="oOptionSuboptions"><null /></var>
      <var name="iPosition"><null /></var>
      <var name="iNumber"><null /></var>
      <var name="sConstructionErrors"><null /></var>
      <var name="aoSuboptions"><null /></var>
      <var name="aoImages"><null /></var>
      <var name="php_class_name"><string>coption</string></var>
     </struct>
    </array>
   </var>
   <var name="sQuestion"><string>Waz&apos; up?</string></var>
   <var name="iMaxNumPaidSuboptions"><number>2</number></var>
   <var name="iMinNumPaidSuboptions"><number>0</number></var>
   <var name="iMaxNumFreeSuboptions"><number>1</number></var>
   <var name="iMinNumFreeSuboptions"><number>0</number></var>
   <var name="bActive"><boolean value="true" /></var>
   <var name="bDiscounted"><boolean value="false" /></var>
   <var name="bTaxable"><boolean value="true" /></var>
   <var name="fWholesalePrice"><number>12</number></var>
   <var name="fRetailPrice"><number>18</number></var>
   <var name="iTimesAvailable"><number>5</number></var>
   <var name="sDetailedDesc"><string>&apos;Da bomb is hear again!  This is a friggin&apos; quarter pound of good, good stuff!</string></var>
   <var name="sBriefDesc"><string>&apos;Dis Shit is Wack!</string></var>
   <var name="iPosition"><number>0</number></var>
   <var name="iNumber"><number>55</number></var>
   <var name="sName"><string>Wacky Burger 5</string></var>
   <var name="iID"><number>0</number></var>
  </struct>
 </data>
</wddxPacket>' ;

////////////////////////////////////////

////////////////////////////////////////
//  the "bad" packet reordered:

$sWDDXPacket = '
<wddxPacket version="1.0">
 <header />
 <data>
  <struct>
   <var name="php_class_name"><string>COption</string></var>
   <var name="iID"><number>0</number></var>
   <var name="sName"><string>Wacky Burger 5</string></var>
   <var name="sBriefDesc"><string>&apos;Dis Shit is Wack!</string></var>
   <var name="sDetailedDesc"><string>&apos;Da bomb is hear again!  This is a friggin&apos; quarter pound of good, good stuff!</string></var>
   <var name="iTimesAvailable"><number>5</number></var>
   <var name="fRetailPrice"><number>18</number></var>
   <var name="fWholesalePrice"><number>12</number></var>
   <var name="bTaxable"><boolean value="true" /></var>
   <var name="bDiscounted"><boolean value="false" /></var>
   <var name="bActive"><boolean value="true" /></var>
   <var name="iMinNumFreeSuboptions"><number>0</number></var>
   <var name="iMaxNumFreeSuboptions"><number>1</number></var>
   <var name="iMinNumPaidSuboptions"><number>0</number></var>
   <var name="iMaxNumPaidSuboptions"><number>2</number></var>
   <var name="sQuestion"><string>Waz&apos; up?</string></var>
   <var name="aoImages"><array length="0" /></var>
   <var name="aoSuboptions">
    <array length="2">
     <struct>
      <var name="php_class_name"><string>COption</string></var>
      <var name="iID"><number>1</number></var>
      <var name="sName"><string>pizza</string></var>
      <var name="sBriefDesc"><string>good stuff</string></var>
      <var name="sDetailedDesc"><string>good good stuff</string></var>
      <var name="iTimesAvailable"><string>5</string></var>
      <var name="fRetailPrice"><string>5.35</string></var>
      <var name="fWholesalePrice"><string>5.02</string></var>
      <var name="bTaxable"><boolean value="true" /></var>
      <var name="bDiscounted"><boolean value="false" /></var>
      <var name="bActive"><boolean value="true" /></var>
      <var name="iMinNumFreeSuboptions"><number>1</number></var>
      <var name="iMaxNumFreeSuboptions"><number>3</number></var>
      <var name="iMinNumPaidSuboptions"><number>2</number></var>
      <var name="iMaxNumPaidSuboptions"><number>2</number></var>
      <var name="sQuestion"><string>What size do you want?</string></var>
      <var name="aoImages"><null /></var>
      <var name="aoSuboptions"><null /></var>
      <var name="iNumber"><null /></var>
      <var name="iPosition"><null /></var>
      <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
      <var name="fDiscountRate"><number>0</number></var>
      <var name="fTaxRate"><number>0.0825</number></var>
      <var name="oItemCategories"><null /></var>
      <var name="aoOptionMenues"><null /></var>
      <var name="oOptionImages"><null /></var>
      <var name="oOptionDiscounts"><null /></var>
      <var name="oOptionTaxes"><null /></var>
      <var name="oOptionSuboptions"><null /></var>
      <var name="sConstructionErrors"><null /></var>
     </struct>
     <struct>
      <var name="php_class_name"><string>coption</string></var>
      <var name="iID"><number>2</number></var>
      <var name="sName"><string>salad</string></var>
      <var name="sBriefDesc"><string>good stuff</string></var>
      <var name="sDetailedDesc"><string>good good stuff</string></var>
      <var name="iTimesAvailable"><string>5</string></var>
      <var name="fRetailPrice"><string>5.35</string></var>
      <var name="fWholesalePrice"><string>5.02</string></var>
      <var name="bTaxable"><boolean value="true" /></var>
      <var name="bDiscounted"><boolean value="false" /></var>
      <var name="bActive"><boolean value="true" /></var>
      <var name="iMinNumFreeSuboptions"><string>1</string></var>
      <var name="iMaxNumFreeSuboptions"><string>3</string></var>
      <var name="iMinNumPaidSuboptions"><string>2</string></var>
      <var name="iMaxNumPaidSuboptions"><string>2</string></var>
      <var name="sQuestion"><string>What size do you want?</string></var>
      <var name="aoImages"><null /></var>
      <var name="aoSuboptions"><null /></var>
      <var name="iNumber"><null /></var>
      <var name="iPosition"><null /></var>
      <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
      <var name="fDiscountRate"><number>0</number></var>
      <var name="fTaxRate"><number>0.0825</number></var>
      <var name="oItemCategories"><null /></var>
      <var name="aoOptionMenues"><null /></var>
      <var name="oOptionImages"><null /></var>
      <var name="oOptionDiscounts"><null /></var>
      <var name="oOptionTaxes"><null /></var>
      <var name="oOptionSuboptions"><null /></var>
      <var name="sConstructionErrors"><null /></var>
     </struct>
    </array>
   </var>
   <var name="iNumber"><number>55</number></var>
   <var name="iPosition"><number>0</number></var>
   <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
   <var name="fDiscountRate"><number>0</number></var>
   <var name="fTaxRate"><number>0.0825</number></var>
  </struct>
 </data>
</wddxPacket>' ;

////////////////////////////////////////

////////////////////////////////////////

$sWDDXPacketGood = '
<wddxPacket version="1.0">
 <header/>
 <data>
  <struct>
   <var name="php_class_name"><string>coption</string></var>
   <var name="iID"><number>0</number></var>
   <var name="sName"><string>Wacky Burger 5</string></var>
   <var name="sBriefDesc"><string>\'Dis Shit is Wack!</string></var>
   <var name="sDetailedDesc"><string>\'Da bomb is hear again!  This is a friggin\' quarter pound of good, good stuff!</string></var>
   <var name="iTimesAvailable"><number>5</number></var>
   <var name="fRetailPrice"><number>18</number></var>
   <var name="fWholesalePrice"><number>12</number></var>
   <var name="bTaxable"><boolean value="true"/></var>
   <var name="bDiscounted"><boolean value="false"/></var>
   <var name="bActive"><boolean value="true"/></var>
   <var name="iMinNumFreeSuboptions"><number>0</number></var>
   <var name="iMaxNumFreeSuboptions"><number>1</number></var>
   <var name="iMinNumPaidSuboptions"><number>0</number></var>
   <var name="iMaxNumPaidSuboptions"><number>2</number></var>
   <var name="sQuestion"><string>Waz\' up?</string></var>
   <var name="aoImages"><array length="0"></array></var>
   <var name="aoSuboptions">
    <array length="2">
     <struct>
      <var name="php_class_name"><string>coption</string></var>
      <var name="iID"><number>10</number></var>
      <var name="sName"><string>Suboption 1</string></var>
      <var name="sBriefDesc"><string>SO 1 brief desc</string></var>
      <var name="sDetailedDesc"><string>Suboption 1 detailed description...</string></var>
      <var name="iTimesAvailable"><number>7</number></var>
      <var name="fRetailPrice"><number>10</number></var>
      <var name="fWholesalePrice"><number>5</number></var>
      <var name="bTaxable"><boolean value="true"/></var>
      <var name="bDiscounted"><boolean value="false"/></var>
      <var name="bActive"><boolean value="true"/></var>
      <var name="iMinNumFreeSuboptions"><number>0</number></var>
      <var name="iMaxNumFreeSuboptions"><number>0</number></var>
      <var name="iMinNumPaidSuboptions"><number>0</number></var>
      <var name="iMaxNumPaidSuboptions"><number>0</number></var>
      <var name="sQuestion"><string>Suoption 1 Question?</string></var>
      <var name="aoImages"><array length="0"></array></var>
      <var name="aoSuboptions"><null/></var>
      <var name="iNumber"><null/></var>
      <var name="iPosition"><null/></var>
      <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
      <var name="fDiscountRate"><number>0</number></var>
      <var name="fTaxRate"><number>0.0825</number></var>
     </struct>
     <struct>
      <var name="php_class_name"><string>coption</string></var>
      <var name="iID"><number>10</number></var>
      <var name="sName"><string>Suboption 2</string></var>
      <var name="sBriefDesc"><string>SO 2 brief desc</string></var>
      <var name="sDetailedDesc"><string>Suboption 2 detailed description...</string></var>
      <var name="iTimesAvailable"><number>1</number></var>
      <var name="fRetailPrice"><number>8</number></var>
      <var name="fWholesalePrice"><number>3</number></var>
      <var name="bTaxable"><boolean value="true"/></var>
      <var name="bDiscounted"><boolean value="false"/></var>
      <var name="bActive"><boolean value="true"/></var>
      <var name="iMinNumFreeSuboptions"><number>5</number></var>
      <var name="iMaxNumFreeSuboptions"><number>10</number></var>
      <var name="iMinNumPaidSuboptions"><number>15</number></var>
      <var name="iMaxNumPaidSuboptions"><number>20</number></var>
      <var name="sQuestion"><string>Suoption 2 Question?</string></var>
      <var name="aoImages"><array length="0"></array></var>
      <var name="aoSuboptions"><null/></var>
      <var name="iNumber"><null/></var>
      <var name="iPosition"><null/></var>
      <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
      <var name="fDiscountRate"><number>0</number></var>
      <var name="fTaxRate"><number>0.0825</number></var>
     </struct>
    </array>
   </var>
   <var name="iNumber"><number>55</number></var>
   <var name="iPosition"><number>0</number></var>
   <var name="sScriptRoot"><string>http://localhost/Delisma/Menu/</string></var>
   <var name="fDiscountRate"><number>0</number></var>
   <var name="fTaxRate"><number>0.0825</number></var>
  </struct>
 </data>
</wddxPacket>' ;

//$oItem = new COption() ;
//$oItem->test() ;
//$sWDDXPacket = wddx_serialize_value( $oItem ) ;

echo "\nHere is the non-working packet, deserialized:\n" ;
$oItemBad = wddx_deserialize( $sWDDXPacketBad ) ;
print_r( $oItemBad ) ;

echo "\n\nHere is the previous packet reordered, deserialized; this works, which means that PHP is sensitive to the order of items in a WDDX packet, which is a bug:\n" ;
$oItem = wddx_deserialize( $sWDDXPacket ) ;
print_r( $oItem ) ;

echo "\n\nHere is a working PHP generated packet, deserialized:\n" ;
$oItemGood = wddx_deserialize( $sWDDXPacketGood ) ;
print_r( $oItemGood ) ;

</script>
 [2002-10-16 11:53 UTC] darwin at museplay dot com
Have you guys made any progress on fixing this bug?  If not, can you tell me where to look, in the source code, so that I can see if I figure out what you have done incorrectly?
 [2002-10-19 12:33 UTC] darwin at museplay dot com
Is anyone working on this?  Again, I can assist you if you can tell me where in the source code to look...
 [2002-10-20 03:52 UTC] darwin at museplay dot com
I am not certain whether or not you guys are going to help out with this, but this bug also exists in the RedHat 7 version...
 [2003-07-04 02:06 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Nov 08 15:01:30 2024 UTC