diff options
Diffstat (limited to 'ext/wddx/tests')
-rw-r--r-- | ext/wddx/tests/001-64bit.phpt | 62 | ||||
-rw-r--r-- | ext/wddx/tests/001.phpt | 62 | ||||
-rw-r--r-- | ext/wddx/tests/002.phpt | 21 | ||||
-rw-r--r-- | ext/wddx/tests/003.phpt | 26 | ||||
-rw-r--r-- | ext/wddx/tests/004.phpt | 63 | ||||
-rw-r--r-- | ext/wddx/tests/005.phpt | 74 | ||||
-rw-r--r-- | ext/wddx/tests/bug27287.phpt | 20 | ||||
-rw-r--r-- | ext/wddx/tests/bug34306.phpt | 14 | ||||
-rw-r--r-- | ext/wddx/tests/bug35410.phpt | 76 | ||||
-rw-r--r-- | ext/wddx/tests/bug35410_64bit.phpt | 76 | ||||
-rw-r--r-- | ext/wddx/tests/bug37569.phpt | 784 | ||||
-rw-r--r-- | ext/wddx/tests/bug37587.phpt | 34 | ||||
-rw-r--r-- | ext/wddx/tests/bug41283.phpt | 27 | ||||
-rw-r--r-- | ext/wddx/tests/bug41527.phpt | 22 | ||||
-rw-r--r-- | ext/wddx/tests/bug45901.phpt | 18 | ||||
-rw-r--r-- | ext/wddx/tests/bug48562.phpt | 34 | ||||
-rw-r--r-- | ext/wddx/tests/bug52468.phpt | 26 | ||||
-rw-r--r-- | ext/wddx/tests/wddx.xml | 60 |
18 files changed, 1499 insertions, 0 deletions
diff --git a/ext/wddx/tests/001-64bit.phpt b/ext/wddx/tests/001-64bit.phpt new file mode 100644 index 0000000..78b1dc9 --- /dev/null +++ b/ext/wddx/tests/001-64bit.phpt @@ -0,0 +1,62 @@ +--TEST-- +wddx deserialization test (64-bit) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +<?php echo PHP_INT_SIZE != 8 ? "skip 64-bit only" : "OK" ?> +--INI-- +precision=14 +--FILE-- +<?php + $path = dirname(__FILE__); + var_dump(wddx_deserialize(file_get_contents("{$path}/wddx.xml"))); +?> +--EXPECT-- +array(11) { + ["aNull"]=> + NULL + ["aString"]=> + string(8) "a string" + ["aNumber"]=> + float(-12.456) + ["aDateTime"]=> + int(897625932) + ["aDateTime2"]=> + int(329632332) + ["aDateTime3"]=> + int(2223088332) + ["aBoolean"]=> + bool(true) + ["anArray"]=> + array(2) { + [0]=> + int(10) + [1]=> + string(14) "second element" + } + ["aBinary"]=> + string(11) "binary data" + ["anObject"]=> + array(2) { + ["s"]=> + string(8) "a string" + ["n"]=> + float(-12.456) + } + ["aRecordset"]=> + array(2) { + ["NAME"]=> + array(2) { + [0]=> + string(8) "John Doe" + [1]=> + string(8) "Jane Doe" + } + ["AGE"]=> + array(2) { + [0]=> + int(34) + [1]=> + int(31) + } + } +} diff --git a/ext/wddx/tests/001.phpt b/ext/wddx/tests/001.phpt new file mode 100644 index 0000000..e1aafd0 --- /dev/null +++ b/ext/wddx/tests/001.phpt @@ -0,0 +1,62 @@ +--TEST-- +wddx deserialization test (32-bit) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +<?php echo PHP_INT_SIZE == 8 ? "skip 32-bit only" : "OK" ?> +--INI-- +precision=14 +--FILE-- +<?php + $path = dirname(__FILE__); + var_dump(wddx_deserialize(file_get_contents("{$path}/wddx.xml"))); +?> +--EXPECT-- +array(11) { + ["aNull"]=> + NULL + ["aString"]=> + string(8) "a string" + ["aNumber"]=> + float(-12.456) + ["aDateTime"]=> + int(897625932) + ["aDateTime2"]=> + int(329632332) + ["aDateTime3"]=> + string(22) "2040-06-12T04:32:12+00" + ["aBoolean"]=> + bool(true) + ["anArray"]=> + array(2) { + [0]=> + int(10) + [1]=> + string(14) "second element" + } + ["aBinary"]=> + string(11) "binary data" + ["anObject"]=> + array(2) { + ["s"]=> + string(8) "a string" + ["n"]=> + float(-12.456) + } + ["aRecordset"]=> + array(2) { + ["NAME"]=> + array(2) { + [0]=> + string(8) "John Doe" + [1]=> + string(8) "Jane Doe" + } + ["AGE"]=> + array(2) { + [0]=> + int(34) + [1]=> + int(31) + } + } +} diff --git a/ext/wddx/tests/002.phpt b/ext/wddx/tests/002.phpt new file mode 100644 index 0000000..692bfa8 --- /dev/null +++ b/ext/wddx/tests/002.phpt @@ -0,0 +1,21 @@ +--TEST-- +wddx packet construction using wddx ressource +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--INI-- +precision=14 +--FILE-- +<?php + $pkt = wddx_packet_start('TEST comment'); + + $var1 = NULL; + $var2 = 'some string'; + $var3 = 756; + $var4 = true; + + // add vars to packet + wddx_add_vars($pkt, 'var1', 'var2', array('var3', 'var4')); + echo wddx_packet_end($pkt); +?> +--EXPECT-- +<wddxPacket version='1.0'><header><comment>TEST comment</comment></header><data><struct><var name='var1'><null/></var><var name='var2'><string>some string</string></var><var name='var3'><number>756</number></var><var name='var4'><boolean value='true'/></var></struct></data></wddxPacket> diff --git a/ext/wddx/tests/003.phpt b/ext/wddx/tests/003.phpt new file mode 100644 index 0000000..3240e43 --- /dev/null +++ b/ext/wddx/tests/003.phpt @@ -0,0 +1,26 @@ +--TEST-- +wddx deserialize from ressource +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--INI-- +precision=14 +--FILE-- +<?php + $path = dirname(__FILE__); + $fp = fopen("php://temp", 'w+'); + fputs($fp, "<wddxPacket version='1.0'><header><comment>TEST comment</comment></header><data><struct><var name='var1'><null/></var><var name='var2'><string>some string</string></var><var name='var3'><number>756</number></var><var name='var4'><boolean value='true'/></var></struct></data></wddxPacket>"); + rewind($fp); + var_dump(wddx_deserialize($fp)); + fclose($fp); +?> +--EXPECT-- +array(4) { + ["var1"]=> + NULL + ["var2"]=> + string(11) "some string" + ["var3"]=> + int(756) + ["var4"]=> + bool(true) +} diff --git a/ext/wddx/tests/004.phpt b/ext/wddx/tests/004.phpt new file mode 100644 index 0000000..ae5a6b4 --- /dev/null +++ b/ext/wddx/tests/004.phpt @@ -0,0 +1,63 @@ +--TEST-- +wddx session serializer handler (serialize) +--SKIPIF-- +<?php + if (!extension_loaded("wddx")) die("skip Wddx module not loaded"); + if (!extension_loaded('session')) die('skip Session module not enabled'); + + // following test code stolen from ext/session/skipif.inc + $save_path = ini_get("session.save_path"); + if ($save_path) { + if (!file_exists($save_path)) { + die("skip Session save_path doesn't exist"); + } + + if ($save_path && !@is_writable($save_path)) { + if (($p = strpos($save_path, ';')) !== false) { + $save_path = substr($save_path, ++$p); + } + if (!@is_writable($save_path)) { + die("skip\n"); + } + } + } +?> +--INI-- +precision=14 +session.serialize_handler=wddx +session.use_cookies=0 +session.cache_limiter= +session.save_handler=files +--FILE-- +<?php + class foo { + public $bar = "ok"; + public $invisible = 'you don\'t see me!'; + + function method() { $this->yes = "done"; } + + public function __sleep() { return array('bar', 'yes'); } + } + + session_start(); + + $_SESSION['data'] = array( + 'test1' => true, + 'test2' => 'some string', + 'test3' => 654321, + 'test4' => array( + 'some string', + true, + null + ), + ); + + $_SESSION['class'] = new foo(); + $_SESSION['class']->method(); + + var_dump(session_encode()); + + session_destroy(); +?> +--EXPECT-- +string(550) "<wddxPacket version='1.0'><header/><data><struct><var name='data'><struct><var name='test1'><boolean value='true'/></var><var name='test2'><string>some string</string></var><var name='test3'><number>654321</number></var><var name='test4'><array length='3'><string>some string</string><boolean value='true'/><null/></array></var></struct></var><var name='class'><struct><var name='php_class_name'><string>foo</string></var><var name='bar'><string>ok</string></var><var name='yes'><string>done</string></var></struct></var></struct></data></wddxPacket>" diff --git a/ext/wddx/tests/005.phpt b/ext/wddx/tests/005.phpt new file mode 100644 index 0000000..99e7a9e --- /dev/null +++ b/ext/wddx/tests/005.phpt @@ -0,0 +1,74 @@ +--TEST-- +wddx session serializer handler (deserialize) +--SKIPIF-- +<?php + if (!extension_loaded("wddx")) die("skip Wddx module not loaded"); + if (!extension_loaded('session')) die('skip Session module not enabled'); + + // following test code stolen from ext/session/skipif.inc + $save_path = ini_get("session.save_path"); + if ($save_path) { + if (!file_exists($save_path)) { + die("skip Session save_path doesn't exist"); + } + + if ($save_path && !@is_writable($save_path)) { + if (($p = strpos($save_path, ';')) !== false) { + $save_path = substr($save_path, ++$p); + } + if (!@is_writable($save_path)) { + die("skip\n"); + } + } + } +?> +--INI-- +precision=14 +session.serialize_handler=wddx +session.use_cookies=0 +session.cache_limiter= +session.save_handler=files +--FILE-- +<?php + class foo { + public $bar = "ok"; + + function method() { $this->yes = "done"; } + } + + session_start(); + + session_decode("<wddxPacket version='1.0'><header/><data><struct><var name='data'><struct><var name='test1'><boolean value='true'/></var><var name='test2'><string>some string</string></var><var name='test3'><number>654321</number></var><var name='test4'><array length='3'><string>some string</string><boolean value='true'/><null/></array></var></struct></var><var name='class'><struct><var name='php_class_name'><string>foo</string></var><var name='bar'><string>ok</string></var><var name='yes'><string>done</string></var></struct></var></struct></data></wddxPacket>"); + + var_dump($_SESSION); + + session_destroy(); +?> +--EXPECT-- +array(2) { + ["data"]=> + array(4) { + ["test1"]=> + bool(true) + ["test2"]=> + string(11) "some string" + ["test3"]=> + int(654321) + ["test4"]=> + array(3) { + [0]=> + string(11) "some string" + [1]=> + bool(true) + [2]=> + NULL + } + } + ["class"]=> + object(foo)#1 (2) { + ["bar"]=> + string(2) "ok" + ["yes"]=> + string(4) "done" + } +} diff --git a/ext/wddx/tests/bug27287.phpt b/ext/wddx/tests/bug27287.phpt new file mode 100644 index 0000000..72ac317 --- /dev/null +++ b/ext/wddx/tests/bug27287.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #27287 (segfault with deserializing object data) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php + + class foo { + } + $foo = new foo(); + $foo->abc = 'def'; + + $string = wddx_serialize_value($foo); + $bar = wddx_deserialize($string); + + echo "OK\n"; + +?> +--EXPECT-- +OK diff --git a/ext/wddx/tests/bug34306.phpt b/ext/wddx/tests/bug34306.phpt new file mode 100644 index 0000000..5f1a0df --- /dev/null +++ b/ext/wddx/tests/bug34306.phpt @@ -0,0 +1,14 @@ +--TEST-- +#34306 (wddx_serialize_value() crashes with long array keys) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php + +$var = array('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa12345678901234567890123456789012345678901234567890ba12345678901234567890123456789012345678901234567890ba12345678901234567890123456789012345678901234567890ba12345678901234567890123456789012345678901234567890b12345678901234567891234567890123123121231211111' => 1); +$buf = wddx_serialize_value($var, 'name'); +echo "OK\n"; + +?> +--EXPECT-- +OK diff --git a/ext/wddx/tests/bug35410.phpt b/ext/wddx/tests/bug35410.phpt new file mode 100644 index 0000000..3b4b9b6 --- /dev/null +++ b/ext/wddx/tests/bug35410.phpt @@ -0,0 +1,76 @@ +--TEST-- +#35410 (wddx_deserialize() doesn't handle large ints as keys properly) +--SKIPIF-- +<?php + if (!extension_loaded("wddx")) print "skip"; + if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> +--FILE-- +<?php +$wddx = <<<WDX +<wddxpacket version="1.0"> +<header> +<comment>Content Configuration File</comment> +</header> +<data> +<struct> +<var name="content_queries"> +<struct> +<var name="content_113300831086270200"> +<struct> +<var name="113301888545229100"> +<struct> +<var name="max"> +<number>10</number> +</var> +<var name="cache"> +<number>4</number> +</var> +<var name="order"> +<struct> +<var name="content_113300831086270200"> +<struct> +<var name="CMS_BUILD"> +<string>desc</string> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</data> +</wddxpacket> +WDX; + +var_dump(wddx_deserialize($wddx)); +?> +--EXPECT-- +array(1) { + ["content_queries"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + ["113301888545229100"]=> + array(3) { + ["max"]=> + int(10) + ["cache"]=> + int(4) + ["order"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + ["CMS_BUILD"]=> + string(4) "desc" + } + } + } + } + } +} diff --git a/ext/wddx/tests/bug35410_64bit.phpt b/ext/wddx/tests/bug35410_64bit.phpt new file mode 100644 index 0000000..15377b1 --- /dev/null +++ b/ext/wddx/tests/bug35410_64bit.phpt @@ -0,0 +1,76 @@ +--TEST-- +#35410 (wddx_deserialize() doesn't handle large ints as keys properly) +--SKIPIF-- +<?php + if (!extension_loaded("wddx")) print "skip"; + if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); +?> +--FILE-- +<?php +$wddx = <<<WDX +<wddxpacket version="1.0"> +<header> +<comment>Content Configuration File</comment> +</header> +<data> +<struct> +<var name="content_queries"> +<struct> +<var name="content_113300831086270200"> +<struct> +<var name="113301888545229100"> +<struct> +<var name="max"> +<number>10</number> +</var> +<var name="cache"> +<number>4</number> +</var> +<var name="order"> +<struct> +<var name="content_113300831086270200"> +<struct> +<var name="CMS_BUILD"> +<string>desc</string> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</var> +</struct> +</data> +</wddxpacket> +WDX; + +var_dump(wddx_deserialize($wddx)); +?> +--EXPECT-- +array(1) { + ["content_queries"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + [113301888545229100]=> + array(3) { + ["max"]=> + int(10) + ["cache"]=> + int(4) + ["order"]=> + array(1) { + ["content_113300831086270200"]=> + array(1) { + ["CMS_BUILD"]=> + string(4) "desc" + } + } + } + } + } +} diff --git a/ext/wddx/tests/bug37569.phpt b/ext/wddx/tests/bug37569.phpt new file mode 100644 index 0000000..45cd68a --- /dev/null +++ b/ext/wddx/tests/bug37569.phpt @@ -0,0 +1,784 @@ +--TEST-- +Bug #37569 (WDDX incorrectly encodes high-ascii characters) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php +for ($i = 65; $i < 256; $i++) { + if ($i >= 0xc0) { + $v = chr(0xc3) . chr($i - 64); + } elseif ($i >= 0x80) { + $v = chr(0xc2) . chr($i); + } else { + $v = chr($i); // make it UTF-8 + } + $ret = wddx_serialize_value($v); + echo $ret . "\n"; + var_dump(bin2hex($v), bin2hex(wddx_deserialize($ret)), $v == wddx_deserialize($ret)); +} +?> +--EXPECT-- +<wddxPacket version='1.0'><header/><data><string>A</string></data></wddxPacket> +string(2) "41" +string(2) "41" +bool(true) +<wddxPacket version='1.0'><header/><data><string>B</string></data></wddxPacket> +string(2) "42" +string(2) "42" +bool(true) +<wddxPacket version='1.0'><header/><data><string>C</string></data></wddxPacket> +string(2) "43" +string(2) "43" +bool(true) +<wddxPacket version='1.0'><header/><data><string>D</string></data></wddxPacket> +string(2) "44" +string(2) "44" +bool(true) +<wddxPacket version='1.0'><header/><data><string>E</string></data></wddxPacket> +string(2) "45" +string(2) "45" +bool(true) +<wddxPacket version='1.0'><header/><data><string>F</string></data></wddxPacket> +string(2) "46" +string(2) "46" +bool(true) +<wddxPacket version='1.0'><header/><data><string>G</string></data></wddxPacket> +string(2) "47" +string(2) "47" +bool(true) +<wddxPacket version='1.0'><header/><data><string>H</string></data></wddxPacket> +string(2) "48" +string(2) "48" +bool(true) +<wddxPacket version='1.0'><header/><data><string>I</string></data></wddxPacket> +string(2) "49" +string(2) "49" +bool(true) +<wddxPacket version='1.0'><header/><data><string>J</string></data></wddxPacket> +string(2) "4a" +string(2) "4a" +bool(true) +<wddxPacket version='1.0'><header/><data><string>K</string></data></wddxPacket> +string(2) "4b" +string(2) "4b" +bool(true) +<wddxPacket version='1.0'><header/><data><string>L</string></data></wddxPacket> +string(2) "4c" +string(2) "4c" +bool(true) +<wddxPacket version='1.0'><header/><data><string>M</string></data></wddxPacket> +string(2) "4d" +string(2) "4d" +bool(true) +<wddxPacket version='1.0'><header/><data><string>N</string></data></wddxPacket> +string(2) "4e" +string(2) "4e" +bool(true) +<wddxPacket version='1.0'><header/><data><string>O</string></data></wddxPacket> +string(2) "4f" +string(2) "4f" +bool(true) +<wddxPacket version='1.0'><header/><data><string>P</string></data></wddxPacket> +string(2) "50" +string(2) "50" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Q</string></data></wddxPacket> +string(2) "51" +string(2) "51" +bool(true) +<wddxPacket version='1.0'><header/><data><string>R</string></data></wddxPacket> +string(2) "52" +string(2) "52" +bool(true) +<wddxPacket version='1.0'><header/><data><string>S</string></data></wddxPacket> +string(2) "53" +string(2) "53" +bool(true) +<wddxPacket version='1.0'><header/><data><string>T</string></data></wddxPacket> +string(2) "54" +string(2) "54" +bool(true) +<wddxPacket version='1.0'><header/><data><string>U</string></data></wddxPacket> +string(2) "55" +string(2) "55" +bool(true) +<wddxPacket version='1.0'><header/><data><string>V</string></data></wddxPacket> +string(2) "56" +string(2) "56" +bool(true) +<wddxPacket version='1.0'><header/><data><string>W</string></data></wddxPacket> +string(2) "57" +string(2) "57" +bool(true) +<wddxPacket version='1.0'><header/><data><string>X</string></data></wddxPacket> +string(2) "58" +string(2) "58" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Y</string></data></wddxPacket> +string(2) "59" +string(2) "59" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Z</string></data></wddxPacket> +string(2) "5a" +string(2) "5a" +bool(true) +<wddxPacket version='1.0'><header/><data><string>[</string></data></wddxPacket> +string(2) "5b" +string(2) "5b" +bool(true) +<wddxPacket version='1.0'><header/><data><string>\</string></data></wddxPacket> +string(2) "5c" +string(2) "5c" +bool(true) +<wddxPacket version='1.0'><header/><data><string>]</string></data></wddxPacket> +string(2) "5d" +string(2) "5d" +bool(true) +<wddxPacket version='1.0'><header/><data><string>^</string></data></wddxPacket> +string(2) "5e" +string(2) "5e" +bool(true) +<wddxPacket version='1.0'><header/><data><string>_</string></data></wddxPacket> +string(2) "5f" +string(2) "5f" +bool(true) +<wddxPacket version='1.0'><header/><data><string>`</string></data></wddxPacket> +string(2) "60" +string(2) "60" +bool(true) +<wddxPacket version='1.0'><header/><data><string>a</string></data></wddxPacket> +string(2) "61" +string(2) "61" +bool(true) +<wddxPacket version='1.0'><header/><data><string>b</string></data></wddxPacket> +string(2) "62" +string(2) "62" +bool(true) +<wddxPacket version='1.0'><header/><data><string>c</string></data></wddxPacket> +string(2) "63" +string(2) "63" +bool(true) +<wddxPacket version='1.0'><header/><data><string>d</string></data></wddxPacket> +string(2) "64" +string(2) "64" +bool(true) +<wddxPacket version='1.0'><header/><data><string>e</string></data></wddxPacket> +string(2) "65" +string(2) "65" +bool(true) +<wddxPacket version='1.0'><header/><data><string>f</string></data></wddxPacket> +string(2) "66" +string(2) "66" +bool(true) +<wddxPacket version='1.0'><header/><data><string>g</string></data></wddxPacket> +string(2) "67" +string(2) "67" +bool(true) +<wddxPacket version='1.0'><header/><data><string>h</string></data></wddxPacket> +string(2) "68" +string(2) "68" +bool(true) +<wddxPacket version='1.0'><header/><data><string>i</string></data></wddxPacket> +string(2) "69" +string(2) "69" +bool(true) +<wddxPacket version='1.0'><header/><data><string>j</string></data></wddxPacket> +string(2) "6a" +string(2) "6a" +bool(true) +<wddxPacket version='1.0'><header/><data><string>k</string></data></wddxPacket> +string(2) "6b" +string(2) "6b" +bool(true) +<wddxPacket version='1.0'><header/><data><string>l</string></data></wddxPacket> +string(2) "6c" +string(2) "6c" +bool(true) +<wddxPacket version='1.0'><header/><data><string>m</string></data></wddxPacket> +string(2) "6d" +string(2) "6d" +bool(true) +<wddxPacket version='1.0'><header/><data><string>n</string></data></wddxPacket> +string(2) "6e" +string(2) "6e" +bool(true) +<wddxPacket version='1.0'><header/><data><string>o</string></data></wddxPacket> +string(2) "6f" +string(2) "6f" +bool(true) +<wddxPacket version='1.0'><header/><data><string>p</string></data></wddxPacket> +string(2) "70" +string(2) "70" +bool(true) +<wddxPacket version='1.0'><header/><data><string>q</string></data></wddxPacket> +string(2) "71" +string(2) "71" +bool(true) +<wddxPacket version='1.0'><header/><data><string>r</string></data></wddxPacket> +string(2) "72" +string(2) "72" +bool(true) +<wddxPacket version='1.0'><header/><data><string>s</string></data></wddxPacket> +string(2) "73" +string(2) "73" +bool(true) +<wddxPacket version='1.0'><header/><data><string>t</string></data></wddxPacket> +string(2) "74" +string(2) "74" +bool(true) +<wddxPacket version='1.0'><header/><data><string>u</string></data></wddxPacket> +string(2) "75" +string(2) "75" +bool(true) +<wddxPacket version='1.0'><header/><data><string>v</string></data></wddxPacket> +string(2) "76" +string(2) "76" +bool(true) +<wddxPacket version='1.0'><header/><data><string>w</string></data></wddxPacket> +string(2) "77" +string(2) "77" +bool(true) +<wddxPacket version='1.0'><header/><data><string>x</string></data></wddxPacket> +string(2) "78" +string(2) "78" +bool(true) +<wddxPacket version='1.0'><header/><data><string>y</string></data></wddxPacket> +string(2) "79" +string(2) "79" +bool(true) +<wddxPacket version='1.0'><header/><data><string>z</string></data></wddxPacket> +string(2) "7a" +string(2) "7a" +bool(true) +<wddxPacket version='1.0'><header/><data><string>{</string></data></wddxPacket> +string(2) "7b" +string(2) "7b" +bool(true) +<wddxPacket version='1.0'><header/><data><string>|</string></data></wddxPacket> +string(2) "7c" +string(2) "7c" +bool(true) +<wddxPacket version='1.0'><header/><data><string>}</string></data></wddxPacket> +string(2) "7d" +string(2) "7d" +bool(true) +<wddxPacket version='1.0'><header/><data><string>~</string></data></wddxPacket> +string(2) "7e" +string(2) "7e" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(2) "7f" +string(2) "7f" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c280" +string(4) "c280" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c281" +string(4) "c281" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c282" +string(4) "c282" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c283" +string(4) "c283" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c284" +string(4) "c284" +bool(true) +<wddxPacket version='1.0'><header/><data><string>
</string></data></wddxPacket> +string(4) "c285" +string(4) "c285" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c286" +string(4) "c286" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c287" +string(4) "c287" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c288" +string(4) "c288" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c289" +string(4) "c289" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c28a" +string(4) "c28a" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c28b" +string(4) "c28b" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c28c" +string(4) "c28c" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c28d" +string(4) "c28d" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c28e" +string(4) "c28e" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c28f" +string(4) "c28f" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c290" +string(4) "c290" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c291" +string(4) "c291" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c292" +string(4) "c292" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c293" +string(4) "c293" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c294" +string(4) "c294" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c295" +string(4) "c295" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c296" +string(4) "c296" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c297" +string(4) "c297" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c298" +string(4) "c298" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c299" +string(4) "c299" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c29a" +string(4) "c29a" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c29b" +string(4) "c29b" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c29c" +string(4) "c29c" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c29d" +string(4) "c29d" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c29e" +string(4) "c29e" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c29f" +string(4) "c29f" +bool(true) +<wddxPacket version='1.0'><header/><data><string> </string></data></wddxPacket> +string(4) "c2a0" +string(4) "c2a0" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¡</string></data></wddxPacket> +string(4) "c2a1" +string(4) "c2a1" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¢</string></data></wddxPacket> +string(4) "c2a2" +string(4) "c2a2" +bool(true) +<wddxPacket version='1.0'><header/><data><string>£</string></data></wddxPacket> +string(4) "c2a3" +string(4) "c2a3" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¤</string></data></wddxPacket> +string(4) "c2a4" +string(4) "c2a4" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¥</string></data></wddxPacket> +string(4) "c2a5" +string(4) "c2a5" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¦</string></data></wddxPacket> +string(4) "c2a6" +string(4) "c2a6" +bool(true) +<wddxPacket version='1.0'><header/><data><string>§</string></data></wddxPacket> +string(4) "c2a7" +string(4) "c2a7" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¨</string></data></wddxPacket> +string(4) "c2a8" +string(4) "c2a8" +bool(true) +<wddxPacket version='1.0'><header/><data><string>©</string></data></wddxPacket> +string(4) "c2a9" +string(4) "c2a9" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ª</string></data></wddxPacket> +string(4) "c2aa" +string(4) "c2aa" +bool(true) +<wddxPacket version='1.0'><header/><data><string>«</string></data></wddxPacket> +string(4) "c2ab" +string(4) "c2ab" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¬</string></data></wddxPacket> +string(4) "c2ac" +string(4) "c2ac" +bool(true) +<wddxPacket version='1.0'><header/><data><string></string></data></wddxPacket> +string(4) "c2ad" +string(4) "c2ad" +bool(true) +<wddxPacket version='1.0'><header/><data><string>®</string></data></wddxPacket> +string(4) "c2ae" +string(4) "c2ae" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¯</string></data></wddxPacket> +string(4) "c2af" +string(4) "c2af" +bool(true) +<wddxPacket version='1.0'><header/><data><string>°</string></data></wddxPacket> +string(4) "c2b0" +string(4) "c2b0" +bool(true) +<wddxPacket version='1.0'><header/><data><string>±</string></data></wddxPacket> +string(4) "c2b1" +string(4) "c2b1" +bool(true) +<wddxPacket version='1.0'><header/><data><string>²</string></data></wddxPacket> +string(4) "c2b2" +string(4) "c2b2" +bool(true) +<wddxPacket version='1.0'><header/><data><string>³</string></data></wddxPacket> +string(4) "c2b3" +string(4) "c2b3" +bool(true) +<wddxPacket version='1.0'><header/><data><string>´</string></data></wddxPacket> +string(4) "c2b4" +string(4) "c2b4" +bool(true) +<wddxPacket version='1.0'><header/><data><string>µ</string></data></wddxPacket> +string(4) "c2b5" +string(4) "c2b5" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¶</string></data></wddxPacket> +string(4) "c2b6" +string(4) "c2b6" +bool(true) +<wddxPacket version='1.0'><header/><data><string>·</string></data></wddxPacket> +string(4) "c2b7" +string(4) "c2b7" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¸</string></data></wddxPacket> +string(4) "c2b8" +string(4) "c2b8" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¹</string></data></wddxPacket> +string(4) "c2b9" +string(4) "c2b9" +bool(true) +<wddxPacket version='1.0'><header/><data><string>º</string></data></wddxPacket> +string(4) "c2ba" +string(4) "c2ba" +bool(true) +<wddxPacket version='1.0'><header/><data><string>»</string></data></wddxPacket> +string(4) "c2bb" +string(4) "c2bb" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¼</string></data></wddxPacket> +string(4) "c2bc" +string(4) "c2bc" +bool(true) +<wddxPacket version='1.0'><header/><data><string>½</string></data></wddxPacket> +string(4) "c2bd" +string(4) "c2bd" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¾</string></data></wddxPacket> +string(4) "c2be" +string(4) "c2be" +bool(true) +<wddxPacket version='1.0'><header/><data><string>¿</string></data></wddxPacket> +string(4) "c2bf" +string(4) "c2bf" +bool(true) +<wddxPacket version='1.0'><header/><data><string>À</string></data></wddxPacket> +string(4) "c380" +string(4) "c380" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Á</string></data></wddxPacket> +string(4) "c381" +string(4) "c381" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Â</string></data></wddxPacket> +string(4) "c382" +string(4) "c382" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ã</string></data></wddxPacket> +string(4) "c383" +string(4) "c383" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ä</string></data></wddxPacket> +string(4) "c384" +string(4) "c384" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Å</string></data></wddxPacket> +string(4) "c385" +string(4) "c385" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Æ</string></data></wddxPacket> +string(4) "c386" +string(4) "c386" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ç</string></data></wddxPacket> +string(4) "c387" +string(4) "c387" +bool(true) +<wddxPacket version='1.0'><header/><data><string>È</string></data></wddxPacket> +string(4) "c388" +string(4) "c388" +bool(true) +<wddxPacket version='1.0'><header/><data><string>É</string></data></wddxPacket> +string(4) "c389" +string(4) "c389" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ê</string></data></wddxPacket> +string(4) "c38a" +string(4) "c38a" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ë</string></data></wddxPacket> +string(4) "c38b" +string(4) "c38b" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ì</string></data></wddxPacket> +string(4) "c38c" +string(4) "c38c" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Í</string></data></wddxPacket> +string(4) "c38d" +string(4) "c38d" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Î</string></data></wddxPacket> +string(4) "c38e" +string(4) "c38e" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ï</string></data></wddxPacket> +string(4) "c38f" +string(4) "c38f" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ð</string></data></wddxPacket> +string(4) "c390" +string(4) "c390" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ñ</string></data></wddxPacket> +string(4) "c391" +string(4) "c391" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ò</string></data></wddxPacket> +string(4) "c392" +string(4) "c392" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ó</string></data></wddxPacket> +string(4) "c393" +string(4) "c393" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ô</string></data></wddxPacket> +string(4) "c394" +string(4) "c394" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Õ</string></data></wddxPacket> +string(4) "c395" +string(4) "c395" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ö</string></data></wddxPacket> +string(4) "c396" +string(4) "c396" +bool(true) +<wddxPacket version='1.0'><header/><data><string>×</string></data></wddxPacket> +string(4) "c397" +string(4) "c397" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ø</string></data></wddxPacket> +string(4) "c398" +string(4) "c398" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ù</string></data></wddxPacket> +string(4) "c399" +string(4) "c399" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ú</string></data></wddxPacket> +string(4) "c39a" +string(4) "c39a" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Û</string></data></wddxPacket> +string(4) "c39b" +string(4) "c39b" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ü</string></data></wddxPacket> +string(4) "c39c" +string(4) "c39c" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Ý</string></data></wddxPacket> +string(4) "c39d" +string(4) "c39d" +bool(true) +<wddxPacket version='1.0'><header/><data><string>Þ</string></data></wddxPacket> +string(4) "c39e" +string(4) "c39e" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ß</string></data></wddxPacket> +string(4) "c39f" +string(4) "c39f" +bool(true) +<wddxPacket version='1.0'><header/><data><string>à</string></data></wddxPacket> +string(4) "c3a0" +string(4) "c3a0" +bool(true) +<wddxPacket version='1.0'><header/><data><string>á</string></data></wddxPacket> +string(4) "c3a1" +string(4) "c3a1" +bool(true) +<wddxPacket version='1.0'><header/><data><string>â</string></data></wddxPacket> +string(4) "c3a2" +string(4) "c3a2" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ã</string></data></wddxPacket> +string(4) "c3a3" +string(4) "c3a3" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ä</string></data></wddxPacket> +string(4) "c3a4" +string(4) "c3a4" +bool(true) +<wddxPacket version='1.0'><header/><data><string>å</string></data></wddxPacket> +string(4) "c3a5" +string(4) "c3a5" +bool(true) +<wddxPacket version='1.0'><header/><data><string>æ</string></data></wddxPacket> +string(4) "c3a6" +string(4) "c3a6" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ç</string></data></wddxPacket> +string(4) "c3a7" +string(4) "c3a7" +bool(true) +<wddxPacket version='1.0'><header/><data><string>è</string></data></wddxPacket> +string(4) "c3a8" +string(4) "c3a8" +bool(true) +<wddxPacket version='1.0'><header/><data><string>é</string></data></wddxPacket> +string(4) "c3a9" +string(4) "c3a9" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ê</string></data></wddxPacket> +string(4) "c3aa" +string(4) "c3aa" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ë</string></data></wddxPacket> +string(4) "c3ab" +string(4) "c3ab" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ì</string></data></wddxPacket> +string(4) "c3ac" +string(4) "c3ac" +bool(true) +<wddxPacket version='1.0'><header/><data><string>í</string></data></wddxPacket> +string(4) "c3ad" +string(4) "c3ad" +bool(true) +<wddxPacket version='1.0'><header/><data><string>î</string></data></wddxPacket> +string(4) "c3ae" +string(4) "c3ae" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ï</string></data></wddxPacket> +string(4) "c3af" +string(4) "c3af" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ð</string></data></wddxPacket> +string(4) "c3b0" +string(4) "c3b0" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ñ</string></data></wddxPacket> +string(4) "c3b1" +string(4) "c3b1" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ò</string></data></wddxPacket> +string(4) "c3b2" +string(4) "c3b2" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ó</string></data></wddxPacket> +string(4) "c3b3" +string(4) "c3b3" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ô</string></data></wddxPacket> +string(4) "c3b4" +string(4) "c3b4" +bool(true) +<wddxPacket version='1.0'><header/><data><string>õ</string></data></wddxPacket> +string(4) "c3b5" +string(4) "c3b5" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ö</string></data></wddxPacket> +string(4) "c3b6" +string(4) "c3b6" +bool(true) +<wddxPacket version='1.0'><header/><data><string>÷</string></data></wddxPacket> +string(4) "c3b7" +string(4) "c3b7" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ø</string></data></wddxPacket> +string(4) "c3b8" +string(4) "c3b8" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ù</string></data></wddxPacket> +string(4) "c3b9" +string(4) "c3b9" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ú</string></data></wddxPacket> +string(4) "c3ba" +string(4) "c3ba" +bool(true) +<wddxPacket version='1.0'><header/><data><string>û</string></data></wddxPacket> +string(4) "c3bb" +string(4) "c3bb" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ü</string></data></wddxPacket> +string(4) "c3bc" +string(4) "c3bc" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ý</string></data></wddxPacket> +string(4) "c3bd" +string(4) "c3bd" +bool(true) +<wddxPacket version='1.0'><header/><data><string>þ</string></data></wddxPacket> +string(4) "c3be" +string(4) "c3be" +bool(true) +<wddxPacket version='1.0'><header/><data><string>ÿ</string></data></wddxPacket> +string(4) "c3bf" +string(4) "c3bf" +bool(true) diff --git a/ext/wddx/tests/bug37587.phpt b/ext/wddx/tests/bug37587.phpt new file mode 100644 index 0000000..7780355 --- /dev/null +++ b/ext/wddx/tests/bug37587.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #37587 (var without attribute causes segfault) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php + +var_dump(wddx_deserialize(<<<EOF +<wddxPacket version='1.0'> +<header/> +<data> + <array length='1'> + <var> + <struct> + <var name='test'><string>Hello World</string></var> + </struct> + </var> + </array> +</data> +</wddxPacket> +EOF +)); + +?> +===DONE=== +--EXPECT-- +array(1) { + [0]=> + array(1) { + ["test"]=> + string(11) "Hello World" + } +} +===DONE=== diff --git a/ext/wddx/tests/bug41283.phpt b/ext/wddx/tests/bug41283.phpt new file mode 100644 index 0000000..af716d1 --- /dev/null +++ b/ext/wddx/tests/bug41283.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #41283 (Bug with serializing array key that are doubles or floats) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php +$data = array( + 'somearray' => array('1.1' => 'One 1','1.2' => 'One 2', '1.0' => 'Three') +); + +var_dump(wddx_deserialize(wddx_serialize_vars('data'))); +?> +--EXPECT-- +array(1) { + ["data"]=> + array(1) { + ["somearray"]=> + array(3) { + ["1.1"]=> + string(5) "One 1" + ["1.2"]=> + string(5) "One 2" + ["1.0"]=> + string(5) "Three" + } + } +} diff --git a/ext/wddx/tests/bug41527.phpt b/ext/wddx/tests/bug41527.phpt new file mode 100644 index 0000000..447bfc3 --- /dev/null +++ b/ext/wddx/tests/bug41527.phpt @@ -0,0 +1,22 @@ +--TEST-- +Bug #41527 (WDDX deserialize numeric string array keys) +--SKIPIF-- +<?php if (!extension_loaded("wddx")) print "skip"; ?> +--FILE-- +<?php +$data = array('01' => 'Zero', '+1' => 'Plus sign', ' 1' => 'Space'); + +var_dump(wddx_deserialize(wddx_serialize_vars('data'))); +?> +--EXPECT-- +array(1) { + ["data"]=> + array(3) { + ["01"]=> + string(4) "Zero" + ["+1"]=> + string(9) "Plus sign" + [" 1"]=> + string(5) "Space" + } +} diff --git a/ext/wddx/tests/bug45901.phpt b/ext/wddx/tests/bug45901.phpt new file mode 100644 index 0000000..4084ccb --- /dev/null +++ b/ext/wddx/tests/bug45901.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #45901 (wddx_serialize_value crash with SimpleXMLElement object) +--SKIPIF-- +<?php +if (!extension_loaded("wddx")) print "skip"; +if (!extension_loaded("simplexml")) print "skip SimpleXML not present"; +?> +--FILE-- +<?php + +$xml = new SimpleXMLElement('<data></data>'); +$xml->addChild('test'); +echo wddx_serialize_value($xml, 'Variables') . "\n"; +echo "DONE"; +?> +--EXPECTF-- +<wddxPacket version='1.0'><header><comment>Variables</comment></header><data><struct><var name='php_class_name'><string>SimpleXMLElement</string></var><var name='test'><struct><var name='php_class_name'><string>SimpleXMLElement</string></var></struct></var></struct></data></wddxPacket> +DONE
\ No newline at end of file diff --git a/ext/wddx/tests/bug48562.phpt b/ext/wddx/tests/bug48562.phpt new file mode 100644 index 0000000..ee9f271 --- /dev/null +++ b/ext/wddx/tests/bug48562.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #48562 (Reference recursion causes segfault when used in wddx_serialize_vars()) +--SKIPIF-- +<?php +if (!extension_loaded('wddx')) { + die('skip. wddx not available'); +} +?> +--FILE-- +<?php + +$foo = 'bar'; + +$a['x'] = 'foo'; +$a['x'] = &$a; + +var_dump(wddx_serialize_vars($a)); + +// replace $a - the recursion detection seems to be causing $a to be not an array here, maybe its internally a pointer +// replacing $a with a new array() allows this test to still check for 2 things +// 1. recursion detection in &$a; +// 2. recursion detection in adding $a to itself and then serializing $a +// the one thing the test won't check is using $a as an array after doing &$a; which isn't really a wddx problem. +$a = array(); +$a['x'] = 'foo'; +$a['x'] = $a; + +var_dump(wddx_serialize_vars($a)); + +?> +--EXPECTF-- +Warning: wddx_serialize_vars(): recursion detected in %s on line %d +string(78) "<wddxPacket version='1.0'><header/><data><struct></struct></data></wddxPacket>" +string(120) "<wddxPacket version='1.0'><header/><data><struct><var name='foo'><string>bar</string></var></struct></data></wddxPacket>" diff --git a/ext/wddx/tests/bug52468.phpt b/ext/wddx/tests/bug52468.phpt new file mode 100644 index 0000000..b0d8eb3 --- /dev/null +++ b/ext/wddx/tests/bug52468.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #52468 (wddx_deserialize corrupts integer field value when left empty) +--SKIPIF-- +<?php +if (!extension_loaded('wddx')) { + die('skip. wddx not available'); +} +?> +--FILE-- +<?php + +$message = "<wddxPacket version='1.0'><header><comment>my_command</comment></header><data><struct><var name='handle'><number></number></var></struct></data></wddxPacket>"; + +print_r(wddx_deserialize($message)); +print_r(wddx_deserialize($message)); + +?> +--EXPECT-- +Array +( + [handle] => 0 +) +Array +( + [handle] => 0 +) diff --git a/ext/wddx/tests/wddx.xml b/ext/wddx/tests/wddx.xml new file mode 100644 index 0000000..0085709 --- /dev/null +++ b/ext/wddx/tests/wddx.xml @@ -0,0 +1,60 @@ +<?xml version='1.0'?> +<!DOCTYPE wddxPacket SYSTEM 'wddx_0100.dtd'> +<wddxPacket version='1.0'> +<header/> + <data> + <struct> + <var name='aNull'> + <null/> + </var> + <var name='aString'> + <string>a string</string> + </var> + <var name='aNumber'> + <number>-12.456</number> + </var> + <var name='aDateTime'> + <dateTime>1998-06-12T04:32:12+00</dateTime> + </var> + <var name='aDateTime2'> + <dateTime>1980-06-12T04:32:12+00</dateTime> + </var> + <var name='aDateTime3'> + <dateTime>2040-06-12T04:32:12+00</dateTime> + </var> + <var name='aBoolean'> + <boolean value='true'/> + </var> + <var name='anArray'> + <array length='2'> + <number>10</number> + <string>second element</string> + </array> + </var> + <var name='aBinary'> + <binary length='11'>YmluYXJ5IGRhdGE=</binary> + </var> + <var name='anObject'> + <struct> + <var name='s'> + <string>a string</string> + </var> + <var name='n'> + <number>-12.456</number> + </var> + </struct> + </var> + <var name='aRecordset'> + <recordset rowCount='2' fieldNames='NAME,AGE'> + <field name='NAME'> + <string>John Doe</string> + <string>Jane Doe</string> + </field> + <field name='AGE'> + <number>34</number> + <number>31</number> + </field> + </recordset> + </struct> + </data> +</wddxPacket> |