#19857 [NEW]: wddx_deserialize Does Not Work Properly with Complex Data Types
| From: | darwin at museplay dot com | Date: | Fri, 11 Oct 2002 05:56:04 +0000 |
| Subject: | #19857 [NEW]: wddx_deserialize Does Not Work Properly with Complex Data Types | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-22138@lists.php.net to get a copy of this message | ||
From: darwin@museplay.com
Operating system: Win XP Pro
PHP version: 4.2.3
PHP Bug Type: WDDX related
Bug description: wddx_deserialize Does Not Work Properly with Complex Data Types
// 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>'Da bomb is hear again! This is a
friggin' quarter pound of good, good stuff!</string></var><var
name="sBriefDesc"><string>'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 bug report at http://bugs.php.net/?id=19857&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19857&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19857&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19857&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19857&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19857&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19857&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19857&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19857&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19857&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19857&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19857&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=19857&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=19857&r=isapi