#19857 [Fbk]: wddx_deserialize Does Not Work Properly with Complex Data Types

From: Date: Sun, 13 Oct 2002 09:03:58 +0000
Subject: #19857 [Fbk]: wddx_deserialize Does Not Work Properly with Complex Data Types
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-22276@lists.php.net to get a copy of this message
ID: 19857 Updated by: sniper@php.net Reported By: darwin@museplay.com Status: Feedback Bug Type: WDDX related Operating System: Win XP Pro PHP Version: 4.2.3 New Comment: Please provide shortest possible example script that can be just copy pasted and run. That would help us a lot.. Previous Comments: ------------------------------------------------------------------------ [2002-10-13 04:02:02] darwin@museplay.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 03:30:13] darwin@museplay.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-12 02:31:47] 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-11 00:56:04] darwin@museplay.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 ) */ ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=19857&edit=1

« previous php.bugs (#22276) next »