summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
authoradvect <advect@gmail.com>2010-10-30 16:06:50 +0900
committeradvect <advect@gmail.com>2010-10-30 16:06:50 +0900
commitbad69fd3977fca94d643a88d819badaca4839fd5 (patch)
tree87ca7d41a9d66fdef51e5b035d39ba44d62380c7 /php
parentb4ae6bf82c8bcd6012c805a2206fcb81ad39dd0b (diff)
downloadmsgpack-python-bad69fd3977fca94d643a88d819badaca4839fd5.tar.gz
php: fiexed unpacker
Diffstat (limited to 'php')
-rw-r--r--php/ChangeLog4
-rw-r--r--php/msgpack.c2
-rw-r--r--php/msgpack_class.c35
-rw-r--r--php/package.xml62
-rw-r--r--php/php-msgpack.spec1
-rw-r--r--php/php_msgpack.h2
-rw-r--r--php/tests/009.phpt28
-rw-r--r--php/tests/009b.phpt28
-rw-r--r--php/tests/024.phpt11
-rw-r--r--php/tests/024b.phpt11
-rw-r--r--php/tests/026.phpt52
-rw-r--r--php/tests/026b.phpt52
-rw-r--r--php/tests/028.phpt544
-rw-r--r--php/tests/028b.phpt544
-rw-r--r--php/tests/042.phpt2
-rw-r--r--php/tests/060.phpt12
-rw-r--r--php/tests/060b.phpt12
-rw-r--r--php/tests/061.phpt12
-rw-r--r--php/tests/061b.phpt12
-rw-r--r--php/tests/064.phpt315
-rw-r--r--php/tests/064b.phpt321
-rw-r--r--php/tests/065.phpt320
-rw-r--r--php/tests/065b.phpt326
-rw-r--r--php/tests/066.phpt70
-rw-r--r--php/tests/067.phpt74
-rw-r--r--php/tests/070.phpt12
-rw-r--r--php/tests/070b.phpt12
-rw-r--r--php/tests/071.phpt12
-rw-r--r--php/tests/071b.phpt12
-rw-r--r--php/tests/072.phpt12
-rw-r--r--php/tests/072b.phpt12
-rw-r--r--php/tests/073.phpt12
-rw-r--r--php/tests/073b.phpt12
33 files changed, 2206 insertions, 742 deletions
diff --git a/php/ChangeLog b/php/ChangeLog
index 3cee3b6..3eb64e7 100644
--- a/php/ChangeLog
+++ b/php/ChangeLog
@@ -1,5 +1,9 @@
msgpack extension changelog
+Version 0.3.1
+-------------
+ * Fix class MessagePackUnpacker.
+
Version 0.3.0
-------------
* Change msgpack_unpack.c (used template)
diff --git a/php/msgpack.c b/php/msgpack.c
index 5d4f926..3b375ba 100644
--- a/php/msgpack.c
+++ b/php/msgpack.c
@@ -113,7 +113,7 @@ zend_module_entry msgpack_module_entry = {
NULL,
ZEND_MINFO(msgpack),
#if ZEND_MODULE_API_NO >= 20010901
- MSGPACK_VERSION,
+ MSGPACK_EXTENSION_VERSION,
#endif
STANDARD_MODULE_PROPERTIES
};
diff --git a/php/msgpack_class.c b/php/msgpack_class.c
index 5cfff8d..ce008d9 100644
--- a/php/msgpack_class.c
+++ b/php/msgpack_class.c
@@ -19,6 +19,7 @@ typedef struct {
msgpack_unpack_t mp;
php_unserialize_data_t var_hash;
long php_only;
+ zend_bool finished;
} php_msgpack_unpacker_t;
#if ZEND_MODULE_API_NO >= 20060613
@@ -348,6 +349,7 @@ static ZEND_METHOD(msgpack_unpacker, __construct)
unpacker->buffer.a = 0;
unpacker->retval = NULL;
unpacker->offset = 0;
+ unpacker->finished = 0;
template_init(&unpacker->mp);
@@ -460,6 +462,22 @@ static ZEND_METHOD(msgpack_unpacker, execute)
{
ALLOC_INIT_ZVAL(unpacker->retval);
}
+ else if (unpacker->finished)
+ {
+ zval_ptr_dtor(&unpacker->retval);
+
+ msgpack_unserialize_var_destroy(&unpacker->var_hash);
+
+
+ ALLOC_INIT_ZVAL(unpacker->retval);
+
+ template_init(&unpacker->mp);
+
+ msgpack_unserialize_var_init(&unpacker->var_hash);
+
+ (&unpacker->mp)->user.var_hash =
+ (php_unserialize_data_t *)&unpacker->var_hash;
+ }
(&unpacker->mp)->user.retval = (zval *)unpacker->retval;
MSGPACK_G(error_display) = 0;
@@ -483,6 +501,7 @@ static ZEND_METHOD(msgpack_unpacker, execute)
{
case MSGPACK_UNPACK_EXTRA_BYTES:
case MSGPACK_UNPACK_SUCCESS:
+ unpacker->finished = 1;
RETURN_TRUE;
default:
RETURN_FALSE;
@@ -493,7 +512,16 @@ static ZEND_METHOD(msgpack_unpacker, data)
{
MSGPACK_UNPACKER_OBJECT;
- RETURN_ZVAL(unpacker->retval, 1, 1);
+ if (unpacker->retval != NULL)
+ {
+ ZVAL_ZVAL(return_value, unpacker->retval, 1, 0);
+
+ MSGPACK_METHOD(msgpack_unpacker, reset, NULL, getThis());
+
+ return;
+ }
+
+ RETURN_FALSE;
}
static ZEND_METHOD(msgpack_unpacker, reset)
@@ -513,6 +541,7 @@ static ZEND_METHOD(msgpack_unpacker, reset)
unpacker->buffer.len = 0;
unpacker->buffer.a = 0;
unpacker->offset = 0;
+ unpacker->finished = 0;
if (buffer.len > 0)
{
@@ -530,12 +559,12 @@ static ZEND_METHOD(msgpack_unpacker, reset)
msgpack_unserialize_var_destroy(&unpacker->var_hash);
+ template_init(&unpacker->mp);
+
msgpack_unserialize_var_init(&unpacker->var_hash);
(&unpacker->mp)->user.var_hash =
(php_unserialize_data_t *)&unpacker->var_hash;
-
- msgpack_unserialize_init(&((&unpacker->mp)->user));
}
void msgpack_init_class()
diff --git a/php/package.xml b/php/package.xml
index 6172a4c..803aa97 100644
--- a/php/package.xml
+++ b/php/package.xml
@@ -10,11 +10,11 @@
<email>advect@gmail.com</email>
<active>yes</active>
</lead>
- <date>2010-09-28</date>
- <time>17:40:09</time>
+ <date>2010-10-26</date>
+ <time>13:44:47</time>
<version>
- <release>0.3.0</release>
- <api>0.3.0</api>
+ <release>0.3.1</release>
+ <api>0.3.1</api>
</version>
<stability>
<release>beta</release>
@@ -27,14 +27,14 @@
<file md5sum="12b9d8867e5fde4af426c134283e2082" name="LICENSE" role="doc" />
<file md5sum="8daeb22744f11b57da9d0966608e2fc1" name="README" role="doc" />
<file md5sum="52329b794aab67446540c4c2b5537076" name="config.m4" role="src" />
- <file md5sum="4f27f70df327b81e9392cdbb9ddcb03b" name="msgpack.c" role="src" />
- <file md5sum="f6c6a226db5fb12064e89626220fed62" name="msgpack_class.c" role="src" />
+ <file md5sum="dc485aa81a31fc9f42b2b42b3554b41b" name="msgpack.c" role="src" />
+ <file md5sum="2a27ea5a6c13c65802dcd715e00c4646" name="msgpack_class.c" role="src" />
<file md5sum="f58d228c0b7ace35fc85178f1aa2fb22" name="msgpack_class.h" role="src" />
<file md5sum="177fdfa077b5d23bc22553ad6e051ec2" name="msgpack_pack.c" role="src" />
<file md5sum="eae6797621ca53f8a7b0c2d9cb8a4d21" name="msgpack_pack.h" role="src" />
<file md5sum="1a832b3cbc1d41a2ec1a68584339c868" name="msgpack_unpack.c" role="src" />
<file md5sum="ed466f04f0608165701a5273a587de1c" name="msgpack_unpack.h" role="src" />
- <file md5sum="896b8986bbdfe2af7f6898efd2b82f90" name="php_msgpack.h" role="src" />
+ <file md5sum="61bcd8356b18d070efae7c490d00ded5" name="php_msgpack.h" role="src" />
<file md5sum="82079e9a298ecdda2122757ddfbf576e" name="msgpack/pack_define.h" role="src" />
<file md5sum="3f77e3df310b5c40a11ce7fee9cd6424" name="msgpack/pack_template.h" role="src" />
<file md5sum="09510085da29090ea0f3919c2e708f46" name="msgpack/unpack_define.h" role="src" />
@@ -49,8 +49,8 @@
<file md5sum="e0488f07f26c74d1c918634c39555d6e" name="tests/006.phpt" role="test" />
<file md5sum="9574605f18eef124b55ede353d255511" name="tests/007.phpt" role="test" />
<file md5sum="dc3584b04311da2a627c6a271a782d2c" name="tests/008.phpt" role="test" />
- <file md5sum="7804070722539804a91d0bd2c831d802" name="tests/009.phpt" role="test" />
- <file md5sum="2621e92078703654fc414fb084816c9d" name="tests/009b.phpt" role="test" />
+ <file md5sum="72fdd3007ec537174e1a0418c2e289d9" name="tests/009.phpt" role="test" />
+ <file md5sum="1fad34de86c39785c2928f93db79fee6" name="tests/009b.phpt" role="test" />
<file md5sum="ddb421cd083baaca3ce3a5263f731dcd" name="tests/010.phpt" role="test" />
<file md5sum="6a24b3b12778e2935722c97c95c9e393" name="tests/012.phpt" role="test" />
<file md5sum="377f261d48b4f7fc78689aae481ac952" name="tests/013.phpt" role="test" />
@@ -65,14 +65,14 @@
<file md5sum="40e429c52cbff763df7a7cdc27c2df2c" name="tests/021.phpt" role="test" />
<file md5sum="23a30dd1eca67eaaf5b640d2153c8c5f" name="tests/022.phpt" role="test" />
<file md5sum="2ccb3302060dbd9395879e215c9b2072" name="tests/023.phpt" role="test" />
- <file md5sum="ff8767e0976fcfee9c885d5a737d0f7c" name="tests/024.phpt" role="test" />
- <file md5sum="b2705eb1bbbe1c08e20f4b7217756248" name="tests/024b.phpt" role="test" />
+ <file md5sum="9c8a79da44818eb545aeec7e37e208b3" name="tests/024.phpt" role="test" />
+ <file md5sum="44e691093efc5f4dd93e512bf15df9f5" name="tests/024b.phpt" role="test" />
<file md5sum="5c2921e615f38d922cff04689aa61b7d" name="tests/025.phpt" role="test" />
- <file md5sum="7dd1ec82dfe82ee44f60ec520c7fd0e1" name="tests/026.phpt" role="test" />
- <file md5sum="225e04ca20c5db3becdb0f7577bcfd18" name="tests/026b.phpt" role="test" />
+ <file md5sum="1af2f7e41cee1553b2bdecbccf6dd574" name="tests/026.phpt" role="test" />
+ <file md5sum="0d4bbab97b4b6a288c5d140ab6ba5b4c" name="tests/026b.phpt" role="test" />
<file md5sum="445c65386d71ed17e1180a3fd6e608d7" name="tests/027.phpt" role="test" />
- <file md5sum="c10653ad3dcf8256d3c10fe717b2ad04" name="tests/028.phpt" role="test" />
- <file md5sum="b090a261b6539d4ba2d4275d0ba57c3f" name="tests/028b.phpt" role="test" />
+ <file md5sum="f9a2b53540d751f8d2e918758e964968" name="tests/028.phpt" role="test" />
+ <file md5sum="355cbc6cebfdd4dbd4c47ae1a8947826" name="tests/028b.phpt" role="test" />
<file md5sum="f380a42cf429a8fb72c50f9d38228109" name="tests/029.phpt" role="test" />
<file md5sum="7de90bedec2c170da12144bb3399dfe5" name="tests/030.phpt" role="test" />
<file md5sum="7ca67b854f69837658cc741ce42b8ed8" name="tests/031.phpt" role="test" />
@@ -82,22 +82,28 @@
<file md5sum="661553a8ccd9b83c95772dd9ad68d82b" name="tests/035.phpt" role="test" />
<file md5sum="2418498403672bfce1087c4b4d277d1d" name="tests/040.phpt" role="test" />
<file md5sum="011672f35987ed8e52b7c9afde98bb8d" name="tests/041.phpt" role="test" />
- <file md5sum="ac28799e22762ff27e331aa060a792ad" name="tests/042.phpt" role="test" />
+ <file md5sum="1073706e82b72a1c845d09273d95b256" name="tests/042.phpt" role="test" />
<file md5sum="57478f4e95bd000bf73a8331e9e19cba" name="tests/050.phpt" role="test" />
- <file md5sum="c34e0f1af0f9b79dc045d9839d36603c" name="tests/060.phpt" role="test" />
- <file md5sum="591715d0a8437e44e02af2ec55a82a34" name="tests/060b.phpt" role="test" />
- <file md5sum="e42dba2b4d02b74dad7f776a44c8e2fe" name="tests/061.phpt" role="test" />
- <file md5sum="75ca37fe17423cddac6ddde324d6b1ec" name="tests/061b.phpt" role="test" />
+ <file md5sum="3067fa10e2d27c2823b648d0452c8c46" name="tests/060.phpt" role="test" />
+ <file md5sum="b42eb220260d4fe1e840d314b53a1add" name="tests/060b.phpt" role="test" />
+ <file md5sum="c1e8716a879b568185e7eb38ee7dc76c" name="tests/061.phpt" role="test" />
+ <file md5sum="0d9597d63ca6fcb5040e0994049766b1" name="tests/061b.phpt" role="test" />
<file md5sum="187689f3d1d8fe3636ea7d6188e7e559" name="tests/062.phpt" role="test" />
<file md5sum="9c91266595d01080b813fb2a056fca82" name="tests/063.phpt" role="test" />
- <file md5sum="18c088d2ee24af0caa758ffbe92321c9" name="tests/070.phpt" role="test" />
- <file md5sum="2f89e6a4efe59bc9491aa77af31e65fd" name="tests/070b.phpt" role="test" />
- <file md5sum="c82b42c39192fd9dcc6ddcf61e7c6c63" name="tests/071.phpt" role="test" />
- <file md5sum="a2f836fa16af5f01819fd2529a783803" name="tests/071b.phpt" role="test" />
- <file md5sum="ca1f561229e54efd2bebc99378d1dac1" name="tests/072.phpt" role="test" />
- <file md5sum="02c2644ba84bb1d78fa66e7706460edc" name="tests/072b.phpt" role="test" />
- <file md5sum="e725faa855f9760fce4815944d439c0b" name="tests/073.phpt" role="test" />
- <file md5sum="96b234f889dd6d391db24a21eac55cf6" name="tests/073b.phpt" role="test" />
+ <file md5sum="3bd5fc0384a9628064ae34886de6dcab" name="tests/064.phpt" role="test" />
+ <file md5sum="7077fa1fbf3290e8fdf8d963fd2c7d97" name="tests/064b.phpt" role="test" />
+ <file md5sum="c0ba5f5b4d8c7751a4643cd9946fe9da" name="tests/065.phpt" role="test" />
+ <file md5sum="1b3763cd9ed063eb733c5e18d726273e" name="tests/065b.phpt" role="test" />
+ <file md5sum="bad0c2dee56d9f7a8dd0161ed863915e" name="tests/066.phpt" role="test" />
+ <file md5sum="d15e923a2bca68f5fb7e285da725c248" name="tests/067.phpt" role="test" />
+ <file md5sum="337d4cd9d5fe8f903ab093131028a7e7" name="tests/070.phpt" role="test" />
+ <file md5sum="39fcd79bf09d3edb0c66c301ec5c9095" name="tests/070b.phpt" role="test" />
+ <file md5sum="f36922baf1228fbb306b1a1104d5b1d2" name="tests/071.phpt" role="test" />
+ <file md5sum="c75ab77ffcd25d21d31a3889b2f6fa3f" name="tests/071b.phpt" role="test" />
+ <file md5sum="0ffca7b01df0131c7093c870f30afd60" name="tests/072.phpt" role="test" />
+ <file md5sum="82c166252f9b775316b22e0082b6354e" name="tests/072b.phpt" role="test" />
+ <file md5sum="4050391dae2825de90a836828ac21ea9" name="tests/073.phpt" role="test" />
+ <file md5sum="0dc3daedec3e152ec08db132e28c6015" name="tests/073b.phpt" role="test" />
<file md5sum="50ef1b19cea2b81bcb7cf3f3ff1d040b" name="tests/080.phpt" role="test" />
<file md5sum="5ee3dfab84acdee232622aae101ec146" name="tests/081.phpt" role="test" />
<file md5sum="c7f9bb84e313d1d675318373938c026a" name="tests/082.phpt" role="test" />
diff --git a/php/php-msgpack.spec b/php/php-msgpack.spec
index 6a98288..7609ca4 100644
--- a/php/php-msgpack.spec
+++ b/php/php-msgpack.spec
@@ -12,7 +12,6 @@ Packager: advect <advect@gmail.com>
Provides: php-pecl-msgpack
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: php-devel
-Requires: msgpack
%if 0%{?php_zend_api}
Requires: php(zend-abi) = %{php_zend_api}
Requires: php(api) = %{php_core_api}
diff --git a/php/php_msgpack.h b/php/php_msgpack.h
index 61badea..0791deb 100644
--- a/php/php_msgpack.h
+++ b/php/php_msgpack.h
@@ -2,7 +2,7 @@
#ifndef PHP_MSGPACK_H
#define PHP_MSGPACK_H
-#define MSGPACK_EXTENSION_VERSION "0.3.0"
+#define MSGPACK_EXTENSION_VERSION "0.3.1"
#include "ext/standard/php_smart_str.h"
diff --git a/php/tests/009.phpt b/php/tests/009.phpt
index 9992988..a1534c9 100644
--- a/php/tests/009.phpt
+++ b/php/tests/009.phpt
@@ -2,8 +2,8 @@
Check for reference serialization
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -74,13 +74,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
@@ -91,13 +85,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
@@ -107,13 +95,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/009b.phpt b/php/tests/009b.phpt
index 7765d62..10e7259 100644
--- a/php/tests/009b.phpt
+++ b/php/tests/009b.phpt
@@ -2,8 +2,8 @@
Check for reference serialization
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -74,7 +74,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
@@ -85,7 +91,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
@@ -95,7 +107,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/024.phpt b/php/tests/024.phpt
index 9b185f7..97db2a7 100644
--- a/php/tests/024.phpt
+++ b/php/tests/024.phpt
@@ -2,8 +2,8 @@
Recursive objects
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -160,11 +160,6 @@ object(Obj4)#%d (2) {
[%r"?a"?:("Obj4":)?private"?%r]=>
int(100)
[%r"?obj"?:("Obj4":)?private"?%r]=>
- object(Obj4)#%d (2) {
- [%r"?a"?:("Obj4":)?private"?%r]=>
- int(100)
- [%r"?obj"?:("Obj4":)?private"?%r]=>
- *RECURSION*
- }
+ *RECURSION*
}
OK
diff --git a/php/tests/024b.phpt b/php/tests/024b.phpt
index 7c691be..c7612d7 100644
--- a/php/tests/024b.phpt
+++ b/php/tests/024b.phpt
@@ -2,8 +2,8 @@
Recursive objects
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -160,6 +160,11 @@ object(Obj4)#%d (2) {
[%r"?a"?:("Obj4":)?private"?%r]=>
int(100)
[%r"?obj"?:("Obj4":)?private"?%r]=>
- *RECURSION*
+ object(Obj4)#%d (2) {
+ [%r"?a"?:("Obj4":)?private"?%r]=>
+ int(100)
+ [%r"?obj"?:("Obj4":)?private"?%r]=>
+ *RECURSION*
+ }
}
OK
diff --git a/php/tests/026.phpt b/php/tests/026.phpt
index c243ef5..383289d 100644
--- a/php/tests/026.phpt
+++ b/php/tests/026.phpt
@@ -3,8 +3,8 @@ Cyclic array test
--INI--
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -62,17 +62,7 @@ array(2) {
string(1) "e"
}
["f"]=>
- &array(2) {
- ["a"]=>
- array(2) {
- ["b"]=>
- string(1) "c"
- ["d"]=>
- string(1) "e"
- }
- ["f"]=>
- *RECURSION*
- }
+ *RECURSION*
}
}
OK
@@ -84,17 +74,7 @@ array(1) {
[1]=>
int(2)
[2]=>
- array(1) {
- ["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
array(1) {
@@ -107,17 +87,7 @@ array(1) {
[2]=>
array(1) {
["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- int(2)
- [2]=>
- array(1) {
- ["foo"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
@@ -131,17 +101,7 @@ array(1) {
[2]=>
array(1) {
["foo"]=>
- &array(3) {
- [0]=>
- int(1)
- [1]=>
- string(1) "b"
- [2]=>
- array(1) {
- ["foo"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/026b.phpt b/php/tests/026b.phpt
index f7a3381..9eef7cb 100644
--- a/php/tests/026b.phpt
+++ b/php/tests/026b.phpt
@@ -3,8 +3,8 @@ Cyclic array test
--INI--
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -62,7 +62,17 @@ array(2) {
string(1) "e"
}
["f"]=>
- *RECURSION*
+ &array(2) {
+ ["a"]=>
+ array(2) {
+ ["b"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "e"
+ }
+ ["f"]=>
+ *RECURSION*
+ }
}
}
OK
@@ -74,7 +84,17 @@ array(1) {
[1]=>
int(2)
[2]=>
- *RECURSION*
+ array(1) {
+ ["foo"]=>
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ *RECURSION*
+ }
+ }
}
}
array(1) {
@@ -87,7 +107,17 @@ array(1) {
[2]=>
array(1) {
["foo"]=>
- *RECURSION*
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ array(1) {
+ ["foo"]=>
+ *RECURSION*
+ }
+ }
}
}
}
@@ -101,7 +131,17 @@ array(1) {
[2]=>
array(1) {
["foo"]=>
- *RECURSION*
+ &array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ string(1) "b"
+ [2]=>
+ array(1) {
+ ["foo"]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/028.phpt b/php/tests/028.phpt
index 00db675..1d326ce 100644
--- a/php/tests/028.phpt
+++ b/php/tests/028.phpt
@@ -2,8 +2,8 @@
Serialize object into session, full set
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -107,281 +107,29 @@ array(3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
object(Bar)#4 (3) {
["d1"]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d3"?:protected"?%r]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
[%r"?d2"?:protected"?%r]=>
object(Bar)#4 (3) {
["d1"]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d3"?:protected"?%r]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
["d3"]=>
object(Bar)#4 (3) {
["d1"]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d3"?:protected"?%r]=>
- object(Foo)#3 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- [%r"?d2"?:protected"?%r]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- ["d3"]=>
- object(Bar)#4 (3) {
- ["d1"]=>
- *RECURSION*
- [%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
- [%r"?d3"?:protected"?%r]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
["test"]=>
@@ -391,281 +139,29 @@ array(3) {
["d1"]=>
object(Foo)#6 (3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d2"?:protected"?%r]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
["d3"]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
[%r"?d2"?:("Bar":)?private"?%r]=>
object(Foo)#6 (3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d2"?:protected"?%r]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
["d3"]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
[%r"?d3"?:protected"?%r]=>
object(Foo)#6 (3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
[%r"?d2"?:protected"?%r]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
["d3"]=>
- object(Bar)#5 (3) {
- ["d1"]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d2"?:("Bar":)?private"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- [%r"?d3"?:protected"?%r]=>
- object(Foo)#6 (3) {
- [%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
- [%r"?d2"?:protected"?%r]=>
- *RECURSION*
- ["d3"]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/028b.phpt b/php/tests/028b.phpt
index 7331a57..0efba18 100644
--- a/php/tests/028b.phpt
+++ b/php/tests/028b.phpt
@@ -2,8 +2,8 @@
Serialize object into session, full set
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -107,29 +107,281 @@ array(3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
object(Bar)#4 (3) {
["d1"]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
[%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
[%r"?d3"?:protected"?%r]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
}
[%r"?d2"?:protected"?%r]=>
object(Bar)#4 (3) {
["d1"]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
[%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
[%r"?d3"?:protected"?%r]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
}
["d3"]=>
object(Bar)#4 (3) {
["d1"]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
[%r"?d2"?:("Bar":)?private"?%r]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
[%r"?d3"?:protected"?%r]=>
- *RECURSION*
+ object(Foo)#3 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:protected"?%r]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ ["d3"]=>
+ object(Bar)#4 (3) {
+ ["d1"]=>
+ *RECURSION*
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d3"?:protected"?%r]=>
+ *RECURSION*
+ }
+ }
}
}
["test"]=>
@@ -139,29 +391,281 @@ array(3) {
["d1"]=>
object(Foo)#6 (3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
[%r"?d2"?:protected"?%r]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
["d3"]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
}
[%r"?d2"?:("Bar":)?private"?%r]=>
object(Foo)#6 (3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
[%r"?d2"?:protected"?%r]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
["d3"]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
}
[%r"?d3"?:protected"?%r]=>
object(Foo)#6 (3) {
[%r"?d1"?:("Foo":)?private"?%r]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
[%r"?d2"?:protected"?%r]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
["d3"]=>
- *RECURSION*
+ object(Bar)#5 (3) {
+ ["d1"]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d2"?:("Bar":)?private"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ [%r"?d3"?:protected"?%r]=>
+ object(Foo)#6 (3) {
+ [%r"?d1"?:("Foo":)?private"?%r]=>
+ *RECURSION*
+ [%r"?d2"?:protected"?%r]=>
+ *RECURSION*
+ ["d3"]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/042.phpt b/php/tests/042.phpt
index 2ba73ac..83e8bc7 100644
--- a/php/tests/042.phpt
+++ b/php/tests/042.phpt
@@ -3,7 +3,7 @@ Closure
--SKIPIF--
<?php
if (version_compare(PHP_VERSION, '5.3.0') < 0) {
- echo "skip closures only for PHP 5.3.0+";
+ echo "skip closures only for PHP 5.3.0 or newer";
}
--FILE--
<?php
diff --git a/php/tests/060.phpt b/php/tests/060.phpt
index 649d788..3ea97eb 100644
--- a/php/tests/060.phpt
+++ b/php/tests/060.phpt
@@ -2,8 +2,8 @@
Check for buffered streaming unserialization
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -240,13 +240,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/060b.phpt b/php/tests/060b.phpt
index 0b947c8..a2e50bc 100644
--- a/php/tests/060b.phpt
+++ b/php/tests/060b.phpt
@@ -2,8 +2,8 @@
Check for buffered streaming unserialization
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -240,7 +240,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/061.phpt b/php/tests/061.phpt
index 7ecc0c9..2b42d31 100644
--- a/php/tests/061.phpt
+++ b/php/tests/061.phpt
@@ -2,8 +2,8 @@
Check for unbuffered streaming unserialization
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -245,13 +245,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/061b.phpt b/php/tests/061b.phpt
index efb3a9b..21706db 100644
--- a/php/tests/061b.phpt
+++ b/php/tests/061b.phpt
@@ -2,8 +2,8 @@
Check for unbuffered streaming unserialization
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -245,7 +245,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/064.phpt b/php/tests/064.phpt
new file mode 100644
index 0000000..a7a2f3b
--- /dev/null
+++ b/php/tests/064.phpt
@@ -0,0 +1,315 @@
+--TEST--
+Check for buffered streaming unserialization (single)
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
+}
+--FILE--
+<?php
+if(!extension_loaded('msgpack')) {
+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
+}
+
+$unpacker = new MessagePackUnpacker();
+
+function test($type, $variable, $test = null) {
+ $serialized = msgpack_serialize($variable);
+
+ global $unpacker;
+
+ $length = strlen($serialized);
+
+ for ($i = 0; $i < $length;) {
+ $len = rand(1, 10);
+ $str = substr($serialized, $i, $len);
+
+ $unpacker->feed($str);
+ if ($unpacker->execute())
+ {
+ $unserialized = $unpacker->data();
+ var_dump($unserialized);
+ $unpacker->reset();
+ }
+
+ $i += $len;
+ }
+
+ if (!is_bool($test))
+ {
+ echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+ else
+ {
+ echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+}
+
+test('null', null);
+
+test('bool: true', true);
+test('bool: false', false);
+
+test('zero: 0', 0);
+test('small: 1', 1);
+test('small: -1', -1);
+test('medium: 1000', 1000);
+test('medium: -1000', -1000);
+test('large: 100000', 100000);
+test('large: -100000', -100000);
+
+test('double: 123.456', 123.456);
+
+test('empty: ""', "");
+test('string: "foobar"', "foobar");
+
+test('array', array(), false);
+test('array(1, 2, 3)', array(1, 2, 3), false);
+test('array(array(1, 2, 3), arr...', array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)), false);
+
+test('array("foo", "foo", "foo")', array("foo", "foo", "foo"), false);
+test('array("one" => 1, "two" => 2))', array("one" => 1, "two" => 2), false);
+test('array("kek" => "lol", "lol" => "kek")', array("kek" => "lol", "lol" => "kek"), false);
+test('array("" => "empty")', array("" => "empty"), false);
+
+$a = array('foo');
+test('array($a, $a)', array($a, $a), false);
+test('array(&$a, &$a)', array(&$a, &$a), false);
+
+$a = array(null);
+$b = array(&$a);
+$a[0] = &$b;
+
+test('cyclic', $a, true);
+
+$a = array(
+ 'a' => array(
+ 'b' => 'c',
+ 'd' => 'e'
+ ),
+ 'f' => array(
+ 'g' => 'h'
+ )
+ );
+
+test('array', $a, false);
+
+class Obj {
+ public $a;
+ protected $b;
+ private $c;
+
+ function __construct($a, $b, $c) {
+ $this->a = $a;
+ $this->b = $b;
+ $this->c = $c;
+ }
+}
+
+test('object', new Obj(1, 2, 3), false);
+
+test('object', array(new Obj(1, 2, 3), new Obj(4, 5, 6)), false);
+
+$o = new Obj(1, 2, 3);
+
+test('object', array(&$o, &$o), false);
+--EXPECTF--
+NULL
+OK
+bool(true)
+OK
+bool(false)
+OK
+int(0)
+OK
+int(1)
+OK
+int(-1)
+OK
+int(1000)
+OK
+int(-1000)
+OK
+int(100000)
+OK
+int(-100000)
+OK
+float(123.456)
+OK
+string(0) ""
+OK
+string(6) "foobar"
+OK
+array(0) {
+}
+OK
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+OK
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+}
+OK
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "foo"
+ [2]=>
+ string(3) "foo"
+}
+OK
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+OK
+array(2) {
+ ["kek"]=>
+ string(3) "lol"
+ ["lol"]=>
+ string(3) "kek"
+}
+OK
+array(1) {
+ [""]=>
+ string(5) "empty"
+}
+OK
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
+}
+OK
+array(2) {
+ ["a"]=>
+ array(2) {
+ ["b"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "e"
+ }
+ ["f"]=>
+ array(1) {
+ ["g"]=>
+ string(1) "h"
+ }
+}
+OK
+object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+}
+OK
+array(2) {
+ [0]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(4)
+ [%r"?b"?:protected"?%r]=>
+ int(5)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(6)
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+}
+OK
diff --git a/php/tests/064b.phpt b/php/tests/064b.phpt
new file mode 100644
index 0000000..aba7a2d
--- /dev/null
+++ b/php/tests/064b.phpt
@@ -0,0 +1,321 @@
+--TEST--
+Check for buffered streaming unserialization (single)
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
+}
+--FILE--
+<?php
+if(!extension_loaded('msgpack')) {
+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
+}
+
+$unpacker = new MessagePackUnpacker();
+
+function test($type, $variable, $test = null) {
+ $serialized = msgpack_serialize($variable);
+
+ global $unpacker;
+
+ $length = strlen($serialized);
+
+ for ($i = 0; $i < $length;) {
+ $len = rand(1, 10);
+ $str = substr($serialized, $i, $len);
+
+ $unpacker->feed($str);
+ if ($unpacker->execute())
+ {
+ $unserialized = $unpacker->data();
+ var_dump($unserialized);
+ $unpacker->reset();
+ }
+
+ $i += $len;
+ }
+
+ if (!is_bool($test))
+ {
+ echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+ else
+ {
+ echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+}
+
+test('null', null);
+
+test('bool: true', true);
+test('bool: false', false);
+
+test('zero: 0', 0);
+test('small: 1', 1);
+test('small: -1', -1);
+test('medium: 1000', 1000);
+test('medium: -1000', -1000);
+test('large: 100000', 100000);
+test('large: -100000', -100000);
+
+test('double: 123.456', 123.456);
+
+test('empty: ""', "");
+test('string: "foobar"', "foobar");
+
+test('array', array(), false);
+test('array(1, 2, 3)', array(1, 2, 3), false);
+test('array(array(1, 2, 3), arr...', array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)), false);
+
+test('array("foo", "foo", "foo")', array("foo", "foo", "foo"), false);
+test('array("one" => 1, "two" => 2))', array("one" => 1, "two" => 2), false);
+test('array("kek" => "lol", "lol" => "kek")', array("kek" => "lol", "lol" => "kek"), false);
+test('array("" => "empty")', array("" => "empty"), false);
+
+$a = array('foo');
+test('array($a, $a)', array($a, $a), false);
+test('array(&$a, &$a)', array(&$a, &$a), false);
+
+$a = array(null);
+$b = array(&$a);
+$a[0] = &$b;
+
+test('cyclic', $a, true);
+
+$a = array(
+ 'a' => array(
+ 'b' => 'c',
+ 'd' => 'e'
+ ),
+ 'f' => array(
+ 'g' => 'h'
+ )
+ );
+
+test('array', $a, false);
+
+class Obj {
+ public $a;
+ protected $b;
+ private $c;
+
+ function __construct($a, $b, $c) {
+ $this->a = $a;
+ $this->b = $b;
+ $this->c = $c;
+ }
+}
+
+test('object', new Obj(1, 2, 3), false);
+
+test('object', array(new Obj(1, 2, 3), new Obj(4, 5, 6)), false);
+
+$o = new Obj(1, 2, 3);
+
+test('object', array(&$o, &$o), false);
+--EXPECTF--
+NULL
+OK
+bool(true)
+OK
+bool(false)
+OK
+int(0)
+OK
+int(1)
+OK
+int(-1)
+OK
+int(1000)
+OK
+int(-1000)
+OK
+int(100000)
+OK
+int(-100000)
+OK
+float(123.456)
+OK
+string(0) ""
+OK
+string(6) "foobar"
+OK
+array(0) {
+}
+OK
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+OK
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+}
+OK
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "foo"
+ [2]=>
+ string(3) "foo"
+}
+OK
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+OK
+array(2) {
+ ["kek"]=>
+ string(3) "lol"
+ ["lol"]=>
+ string(3) "kek"
+}
+OK
+array(1) {
+ [""]=>
+ string(5) "empty"
+}
+OK
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+OK
+array(2) {
+ ["a"]=>
+ array(2) {
+ ["b"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "e"
+ }
+ ["f"]=>
+ array(1) {
+ ["g"]=>
+ string(1) "h"
+ }
+}
+OK
+object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+}
+OK
+array(2) {
+ [0]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(4)
+ [%r"?b"?:protected"?%r]=>
+ int(5)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(6)
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+}
+OK
diff --git a/php/tests/065.phpt b/php/tests/065.phpt
new file mode 100644
index 0000000..c37ca12
--- /dev/null
+++ b/php/tests/065.phpt
@@ -0,0 +1,320 @@
+--TEST--
+Check for unbuffered streaming unserialization (single)
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
+}
+--FILE--
+<?php
+if(!extension_loaded('msgpack')) {
+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
+}
+
+$unpacker = new MessagePackUnpacker();
+
+function test($type, $variable, $test = null) {
+ $serialized = msgpack_serialize($variable);
+
+ global $unpacker;
+
+ $length = strlen($serialized);
+
+ $str = "";
+ $offset = 0;
+
+ for ($i = 0; $i < $length;) {
+ $len = rand(1, 10);
+ $str .= substr($serialized, $i, $len);
+
+ if ($unpacker->execute($str, $offset))
+ {
+ $unserialized = $unpacker->data();
+ var_dump($unserialized);
+
+ $unpacker->reset();
+ $str = "";
+ $offset = 0;
+ }
+
+ $i += $len;
+ }
+
+ if (!is_bool($test))
+ {
+ echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+ else
+ {
+ echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+}
+
+test('null', null);
+
+test('boo:l true', true);
+test('bool: true', false);
+
+test('zero: 0', 0);
+test('small: 1', 1);
+test('small: -1', -1);
+test('medium: 1000', 1000);
+test('medium: -1000', -1000);
+test('large: 100000', 100000);
+test('large: -100000', -100000);
+
+test('double: 123.456', 123.456);
+
+test('empty: ""', "");
+test('string: "foobar"', "foobar");
+
+test('empty: array', array(), false);
+test('empty: array(1, 2, 3)', array(1, 2, 3), false);
+test('empty: array(array(1, 2, 3), arr...', array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)), false);
+
+test('array("foo", "foo", "foo")', array("foo", "foo", "foo"), false);
+test('array("one" => 1, "two" => 2))', array("one" => 1, "two" => 2), false);
+test('array("kek" => "lol", "lol" => "kek")', array("kek" => "lol", "lol" => "kek"), false);
+test('array("" => "empty")', array("" => "empty"), false);
+
+$a = array('foo');
+test('array($a, $a)', array($a, $a), false);
+test('array(&$a, &$a)', array(&$a, &$a), false);
+
+$a = array(null);
+$b = array(&$a);
+$a[0] = &$b;
+
+test('cyclic', $a, true);
+
+$a = array(
+ 'a' => array(
+ 'b' => 'c',
+ 'd' => 'e'
+ ),
+ 'f' => array(
+ 'g' => 'h'
+ )
+ );
+
+test('array', $a, false);
+
+class Obj {
+ public $a;
+ protected $b;
+ private $c;
+
+ function __construct($a, $b, $c) {
+ $this->a = $a;
+ $this->b = $b;
+ $this->c = $c;
+ }
+}
+
+test('object', new Obj(1, 2, 3), false);
+
+test('object', array(new Obj(1, 2, 3), new Obj(4, 5, 6)), false);
+
+$o = new Obj(1, 2, 3);
+
+test('object', array(&$o, &$o), false);
+--EXPECTF--
+NULL
+OK
+bool(true)
+OK
+bool(false)
+OK
+int(0)
+OK
+int(1)
+OK
+int(-1)
+OK
+int(1000)
+OK
+int(-1000)
+OK
+int(100000)
+OK
+int(-100000)
+OK
+float(123.456)
+OK
+string(0) ""
+OK
+string(6) "foobar"
+OK
+array(0) {
+}
+OK
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+OK
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+}
+OK
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "foo"
+ [2]=>
+ string(3) "foo"
+}
+OK
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+OK
+array(2) {
+ ["kek"]=>
+ string(3) "lol"
+ ["lol"]=>
+ string(3) "kek"
+}
+OK
+array(1) {
+ [""]=>
+ string(5) "empty"
+}
+OK
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
+}
+OK
+array(2) {
+ ["a"]=>
+ array(2) {
+ ["b"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "e"
+ }
+ ["f"]=>
+ array(1) {
+ ["g"]=>
+ string(1) "h"
+ }
+}
+OK
+object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+}
+OK
+array(2) {
+ [0]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(4)
+ [%r"?b"?:protected"?%r]=>
+ int(5)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(6)
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+}
+OK
diff --git a/php/tests/065b.phpt b/php/tests/065b.phpt
new file mode 100644
index 0000000..c623d9a
--- /dev/null
+++ b/php/tests/065b.phpt
@@ -0,0 +1,326 @@
+--TEST--
+Check for unbuffered streaming unserialization (single)
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
+}
+--FILE--
+<?php
+if(!extension_loaded('msgpack')) {
+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
+}
+
+$unpacker = new MessagePackUnpacker();
+
+function test($type, $variable, $test = null) {
+ $serialized = msgpack_serialize($variable);
+
+ global $unpacker;
+
+ $length = strlen($serialized);
+
+ $str = "";
+ $offset = 0;
+
+ for ($i = 0; $i < $length;) {
+ $len = rand(1, 10);
+ $str .= substr($serialized, $i, $len);
+
+ if ($unpacker->execute($str, $offset))
+ {
+ $unserialized = $unpacker->data();
+ var_dump($unserialized);
+
+ $unpacker->reset();
+ $str = "";
+ $offset = 0;
+ }
+
+ $i += $len;
+ }
+
+ if (!is_bool($test))
+ {
+ echo $unserialized === $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+ else
+ {
+ echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
+ }
+}
+
+test('null', null);
+
+test('boo:l true', true);
+test('bool: true', false);
+
+test('zero: 0', 0);
+test('small: 1', 1);
+test('small: -1', -1);
+test('medium: 1000', 1000);
+test('medium: -1000', -1000);
+test('large: 100000', 100000);
+test('large: -100000', -100000);
+
+test('double: 123.456', 123.456);
+
+test('empty: ""', "");
+test('string: "foobar"', "foobar");
+
+test('empty: array', array(), false);
+test('empty: array(1, 2, 3)', array(1, 2, 3), false);
+test('empty: array(array(1, 2, 3), arr...', array(array(1, 2, 3), array(4, 5, 6), array(7, 8, 9)), false);
+
+test('array("foo", "foo", "foo")', array("foo", "foo", "foo"), false);
+test('array("one" => 1, "two" => 2))', array("one" => 1, "two" => 2), false);
+test('array("kek" => "lol", "lol" => "kek")', array("kek" => "lol", "lol" => "kek"), false);
+test('array("" => "empty")', array("" => "empty"), false);
+
+$a = array('foo');
+test('array($a, $a)', array($a, $a), false);
+test('array(&$a, &$a)', array(&$a, &$a), false);
+
+$a = array(null);
+$b = array(&$a);
+$a[0] = &$b;
+
+test('cyclic', $a, true);
+
+$a = array(
+ 'a' => array(
+ 'b' => 'c',
+ 'd' => 'e'
+ ),
+ 'f' => array(
+ 'g' => 'h'
+ )
+ );
+
+test('array', $a, false);
+
+class Obj {
+ public $a;
+ protected $b;
+ private $c;
+
+ function __construct($a, $b, $c) {
+ $this->a = $a;
+ $this->b = $b;
+ $this->c = $c;
+ }
+}
+
+test('object', new Obj(1, 2, 3), false);
+
+test('object', array(new Obj(1, 2, 3), new Obj(4, 5, 6)), false);
+
+$o = new Obj(1, 2, 3);
+
+test('object', array(&$o, &$o), false);
+--EXPECTF--
+NULL
+OK
+bool(true)
+OK
+bool(false)
+OK
+int(0)
+OK
+int(1)
+OK
+int(-1)
+OK
+int(1000)
+OK
+int(-1000)
+OK
+int(100000)
+OK
+int(-100000)
+OK
+float(123.456)
+OK
+string(0) ""
+OK
+string(6) "foobar"
+OK
+array(0) {
+}
+OK
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+OK
+array(3) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(3) {
+ [0]=>
+ int(4)
+ [1]=>
+ int(5)
+ [2]=>
+ int(6)
+ }
+ [2]=>
+ array(3) {
+ [0]=>
+ int(7)
+ [1]=>
+ int(8)
+ [2]=>
+ int(9)
+ }
+}
+OK
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "foo"
+ [2]=>
+ string(3) "foo"
+}
+OK
+array(2) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ int(2)
+}
+OK
+array(2) {
+ ["kek"]=>
+ string(3) "lol"
+ ["lol"]=>
+ string(3) "kek"
+}
+OK
+array(1) {
+ [""]=>
+ string(5) "empty"
+}
+OK
+array(2) {
+ [0]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+ [1]=>
+ &array(1) {
+ [0]=>
+ string(3) "foo"
+ }
+}
+OK
+array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
+ }
+ }
+}
+OK
+array(2) {
+ ["a"]=>
+ array(2) {
+ ["b"]=>
+ string(1) "c"
+ ["d"]=>
+ string(1) "e"
+ }
+ ["f"]=>
+ array(1) {
+ ["g"]=>
+ string(1) "h"
+ }
+}
+OK
+object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+}
+OK
+array(2) {
+ [0]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ object(Obj)#%d (3) {
+ ["a"]=>
+ int(4)
+ [%r"?b"?:protected"?%r]=>
+ int(5)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(6)
+ }
+}
+OK
+array(2) {
+ [0]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+ [1]=>
+ &object(Obj)#%d (3) {
+ ["a"]=>
+ int(1)
+ [%r"?b"?:protected"?%r]=>
+ int(2)
+ [%r"?c"?:("Obj":)?private"?%r]=>
+ int(3)
+ }
+}
+OK
diff --git a/php/tests/066.phpt b/php/tests/066.phpt
new file mode 100644
index 0000000..d2e430d
--- /dev/null
+++ b/php/tests/066.phpt
@@ -0,0 +1,70 @@
+--TEST--
+Extra bytes buffered streaming unserialization (single)
+--SKIPIF--
+--FILE--
+<?php
+if(!extension_loaded('msgpack')) {
+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
+}
+
+$unpacker = new MessagePackUnpacker();
+
+function test($type, $variable, $test = null) {
+ global $unpacker;
+
+ foreach ($variable as $var)
+ {
+ $serialized = pack('H*', $var);
+
+ $length = strlen($serialized);
+
+ for ($i = 0; $i < $length;) {
+ $len = rand(1, 10);
+ $str = substr($serialized, $i, $len);
+
+ $unpacker->feed($str);
+
+ while (true) {
+ if ($unpacker->execute()) {
+ $unserialized = $unpacker->data();
+ var_dump($unserialized);
+ $unpacker->reset();
+ } else {
+ break;
+ }
+ }
+ $i += $len;
+ }
+ }
+}
+
+test('array(1, 2, 3)', array('9301020392'));
+test('array(1, 2, 3), array(3, 9), 4', array('9301020392', '030904'));
+--EXPECTF--
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(9)
+ }
+}
+int(4)
diff --git a/php/tests/067.phpt b/php/tests/067.phpt
new file mode 100644
index 0000000..96c1442
--- /dev/null
+++ b/php/tests/067.phpt
@@ -0,0 +1,74 @@
+--TEST--
+Extra bytes unbuffered streaming unserialization (single)
+--SKIPIF--
+--FILE--
+<?php
+if(!extension_loaded('msgpack')) {
+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
+}
+
+$unpacker = new MessagePackUnpacker();
+
+function test($type, $variable, $test = null) {
+ global $unpacker;
+
+ $str = "";
+ $offset = 0;
+
+ foreach ($variable as $var)
+ {
+ $serialized = pack('H*', $var);
+
+ $length = strlen($serialized);
+
+ for ($i = 0; $i < $length;) {
+ $len = rand(1, 10);
+ $str .= substr($serialized, $i, $len);
+
+ while (true) {
+ if ($unpacker->execute($str, $offset)) {
+ $unserialized = $unpacker->data();
+ var_dump($unserialized);
+
+ $unpacker->reset();
+ $str = substr($str, $offset);
+ $offset = 0;
+ } else {
+ break;
+ }
+ }
+ $i += $len;
+ }
+ }
+}
+
+test('array(1, 2, 3)', array('9301020392'));
+test('array(1, 2, 3), array(3, 9), 4', array('9301020392', '030904'));
+--EXPECTF--
+array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+}
+array(2) {
+ [0]=>
+ array(3) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ }
+ [1]=>
+ array(2) {
+ [0]=>
+ int(3)
+ [1]=>
+ int(9)
+ }
+}
+int(4)
diff --git a/php/tests/070.phpt b/php/tests/070.phpt
index 893023b..affcc72 100644
--- a/php/tests/070.phpt
+++ b/php/tests/070.phpt
@@ -2,8 +2,8 @@
Check for alias functions
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -224,13 +224,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/070b.phpt b/php/tests/070b.phpt
index 109ddc1..0aaa4e7 100644
--- a/php/tests/070b.phpt
+++ b/php/tests/070b.phpt
@@ -2,8 +2,8 @@
Check for alias functions
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -224,7 +224,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/071.phpt b/php/tests/071.phpt
index 431303b..20041d4 100644
--- a/php/tests/071.phpt
+++ b/php/tests/071.phpt
@@ -2,8 +2,8 @@
Check for class methods
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -226,13 +226,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/071b.phpt b/php/tests/071b.phpt
index 770d06e..f663073 100644
--- a/php/tests/071b.phpt
+++ b/php/tests/071b.phpt
@@ -2,8 +2,8 @@
Check for class methods
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -226,7 +226,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/072.phpt b/php/tests/072.phpt
index ea79a56..0f89e0a 100644
--- a/php/tests/072.phpt
+++ b/php/tests/072.phpt
@@ -2,8 +2,8 @@
Check for class methods unpacker
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -266,13 +266,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/072b.phpt b/php/tests/072b.phpt
index c7b0c3c..05fe41e 100644
--- a/php/tests/072b.phpt
+++ b/php/tests/072b.phpt
@@ -2,8 +2,8 @@
Check for class methods unpacker
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -266,7 +266,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}
diff --git a/php/tests/073.phpt b/php/tests/073.phpt
index d3a7637..f6a91a6 100644
--- a/php/tests/073.phpt
+++ b/php/tests/073.phpt
@@ -2,8 +2,8 @@
Check for class unpacker
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
- echo "skip tests in PHP 5.3.2 and lower";
+if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
+ echo "skip tests in PHP 5.3.3 or newer";
}
--FILE--
<?php
@@ -267,13 +267,7 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- &array(1) {
- [0]=>
- &array(1) {
- [0]=>
- *RECURSION*
- }
- }
+ *RECURSION*
}
}
}
diff --git a/php/tests/073b.phpt b/php/tests/073b.phpt
index 131a534..065a2aa 100644
--- a/php/tests/073b.phpt
+++ b/php/tests/073b.phpt
@@ -2,8 +2,8 @@
Check for class unpacker
--SKIPIF--
<?php
-if (version_compare(PHP_VERSION, '5.3.2') <= 0) {
- echo "skip tests in PHP 5.3.3";
+if (version_compare(PHP_VERSION, '5.3.3') >= 0) {
+ echo "skip tests in PHP 5.3.2 or older";
}
--FILE--
<?php
@@ -267,7 +267,13 @@ array(1) {
[0]=>
&array(1) {
[0]=>
- *RECURSION*
+ &array(1) {
+ [0]=>
+ &array(1) {
+ [0]=>
+ *RECURSION*
+ }
+ }
}
}
}