Skip to content

Commit d8f6ad2

Browse files
committed
PHPC-629: Fix $binary and $type field in extended JSON
The order of these fields was changed by CDRIVER-1340 (in libbson 1.4.0-beta1).
1 parent b462e2c commit d8f6ad2

File tree

7 files changed

+68
-68
lines changed

7 files changed

+68
-68
lines changed

tests/bson/bson-binary-001.phpt

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -54,36 +54,36 @@ bool(true)
5454
bool(true)
5555
bool(true)
5656
bool(true)
57-
Test#0 { "binary" : { "$type" : "00", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
58-
string(73) "{ "binary" : { "$type" : "00", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
59-
string(73) "{ "binary" : { "$type" : "00", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
57+
Test#0 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "00" } }
58+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "00" } }"
59+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "00" } }"
6060
bool(true)
61-
Test#1 { "binary" : { "$type" : "01", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
62-
string(73) "{ "binary" : { "$type" : "01", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
63-
string(73) "{ "binary" : { "$type" : "01", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
61+
Test#1 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "01" } }
62+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "01" } }"
63+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "01" } }"
6464
bool(true)
65-
Test#2 { "binary" : { "$type" : "02", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
66-
string(73) "{ "binary" : { "$type" : "02", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
67-
string(73) "{ "binary" : { "$type" : "02", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
65+
Test#2 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "02" } }
66+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "02" } }"
67+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "02" } }"
6868
bool(true)
69-
Test#3 { "binary" : { "$type" : "03", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
70-
string(73) "{ "binary" : { "$type" : "03", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
71-
string(73) "{ "binary" : { "$type" : "03", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
69+
Test#3 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "03" } }
70+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "03" } }"
71+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "03" } }"
7272
bool(true)
73-
Test#4 { "binary" : { "$type" : "04", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
74-
string(73) "{ "binary" : { "$type" : "04", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
75-
string(73) "{ "binary" : { "$type" : "04", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
73+
Test#4 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "04" } }
74+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "04" } }"
75+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "04" } }"
7676
bool(true)
77-
Test#5 { "binary" : { "$type" : "05", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
78-
string(73) "{ "binary" : { "$type" : "05", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
79-
string(73) "{ "binary" : { "$type" : "05", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
77+
Test#5 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "05" } }
78+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "05" } }"
79+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "05" } }"
8080
bool(true)
81-
Test#6 { "binary" : { "$type" : "80", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
82-
string(73) "{ "binary" : { "$type" : "80", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
83-
string(73) "{ "binary" : { "$type" : "80", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
81+
Test#6 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "80" } }
82+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "80" } }"
83+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "80" } }"
8484
bool(true)
85-
Test#7 { "binary" : { "$type" : "85", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }
86-
string(73) "{ "binary" : { "$type" : "85", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
87-
string(73) "{ "binary" : { "$type" : "85", "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh" } }"
85+
Test#7 { "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "85" } }
86+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "85" } }"
87+
string(73) "{ "binary" : { "$binary" : "cmFuZG9tIGJpbmFyeSBkYXRh", "$type" : "85" } }"
8888
bool(true)
8989
===DONE===

tests/bson/bson-encode-003.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ foreach($tests as $n => $test) {
4848
===DONE===
4949
<?php exit(0); ?>
5050
--EXPECTF--
51-
Test#0 { "stuff" : { "__pclass" : { "$type" : "80", "$binary" : "TXlDbGFzcw==" }, "random" : "class", "0" : "data" } }
51+
Test#0 { "stuff" : { "__pclass" : { "$binary" : "TXlDbGFzcw==", "$type" : "80" }, "random" : "class", "0" : "data" } }
5252
0 : 45 00 00 00 03 73 74 75 66 66 00 39 00 00 00 05 [E....stuff.9....]
5353
10 : 5f 5f 70 63 6c 61 73 73 00 07 00 00 00 80 4d 79 [__pclass......My]
5454
20 : 43 6c 61 73 73 02 72 61 6e 64 6f 6d 00 06 00 00 [Class.random....]
@@ -73,7 +73,7 @@ object(stdClass)#%d (1) {
7373
}
7474
}
7575
}
76-
Test#1 { "stuff" : { "__pclass" : { "$type" : "80", "$binary" : "TXlDbGFzczI=" }, "0" : 1, "1" : 2, "2" : 3 } }
76+
Test#1 { "stuff" : { "__pclass" : { "$binary" : "TXlDbGFzczI=", "$type" : "80" }, "0" : 1, "1" : 2, "2" : 3 } }
7777
0 : 3d 00 00 00 03 73 74 75 66 66 00 31 00 00 00 05 [=....stuff.1....]
7878
10 : 5f 5f 70 63 6c 61 73 73 00 08 00 00 00 80 4d 79 [__pclass......My]
7979
20 : 43 6c 61 73 73 32 10 30 00 01 00 00 00 10 31 00 [Class2.0......1.]
@@ -99,7 +99,7 @@ object(stdClass)#%d (1) {
9999
}
100100
}
101101
}
102-
Test#2 { "stuff" : [ { "__pclass" : { "$type" : "80", "$binary" : "TXlDbGFzcw==" }, "random" : "class", "0" : "data" }, { "__pclass" : { "$type" : "80", "$binary" : "TXlDbGFzczI=" }, "0" : 1, "1" : 2, "2" : 3 } ] }
102+
Test#2 { "stuff" : [ { "__pclass" : { "$binary" : "TXlDbGFzcw==", "$type" : "80" }, "random" : "class", "0" : "data" }, { "__pclass" : { "$binary" : "TXlDbGFzczI=", "$type" : "80" }, "0" : 1, "1" : 2, "2" : 3 } ] }
103103
0 : 81 00 00 00 04 73 74 75 66 66 00 75 00 00 00 03 [.....stuff.u....]
104104
10 : 30 00 39 00 00 00 05 5f 5f 70 63 6c 61 73 73 00 [0.9....__pclass.]
105105
20 : 07 00 00 00 80 4d 79 43 6c 61 73 73 02 72 61 6e [.....MyClass.ran]

tests/bson/bson-encode-004.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ object(Person)#%d (5) {
7575
["secret":protected]=>
7676
string(24) "Hannes confidential info"
7777
}
78-
Test { "0" : { "__pclass" : { "$type" : "80", "$binary" : "UGVyc29u" }, "name" : "Hannes", "age" : 42, "addresses" : [ { "__pclass" : { "$type" : "80", "$binary" : "QWRkcmVzcw==" }, "zip" : 94086, "country" : "USA" }, { "__pclass" : { "$type" : "80", "$binary" : "QWRkcmVzcw==" }, "zip" : 200, "country" : "Iceland" } ], "friends" : [ { "__pclass" : { "$type" : "80", "$binary" : "UGVyc29u" }, "name" : "Jeremy", "age" : 21, "addresses" : [ ], "friends" : [ ] } ] } }
78+
Test { "0" : { "__pclass" : { "$binary" : "UGVyc29u", "$type" : "80" }, "name" : "Hannes", "age" : 42, "addresses" : [ { "__pclass" : { "$binary" : "QWRkcmVzcw==", "$type" : "80" }, "zip" : 94086, "country" : "USA" }, { "__pclass" : { "$binary" : "QWRkcmVzcw==", "$type" : "80" }, "zip" : 200, "country" : "Iceland" } ], "friends" : [ { "__pclass" : { "$binary" : "UGVyc29u", "$type" : "80" }, "name" : "Jeremy", "age" : 21, "addresses" : [ ], "friends" : [ ] } ] } }
7979
0 : 23 01 00 00 03 30 00 1b 01 00 00 05 5f 5f 70 63 [#....0......__pc]
8080
10 : 6c 61 73 73 00 06 00 00 00 80 50 65 72 73 6f 6e [lass......Person]
8181
20 : 02 6e 61 6d 65 00 07 00 00 00 48 61 6e 6e 65 73 [.name.....Hannes]

tests/bson/bson-toJSON-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ foreach ($tests as $value) {
2929
<?php exit(0); ?>
3030
--EXPECT--
3131
{ "_id" : { "$oid" : "56315a7c6118fd1b920270b1" } }
32-
{ "binary" : { "$type" : "00", "$binary" : "Zm9v" } }
32+
{ "binary" : { "$binary" : "Zm9v", "$type" : "00" } }
3333
{ "date" : { "$date" : 1445990400000 } }
3434
{ "timestamp" : { "$timestamp" : { "t" : 1446084619, "i" : 0 } } }
3535
{ "regex" : { "$regex" : "pattern", "$options" : "i" } }

tests/bson/bson-toPHP-001.phpt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ $bUnserializable = base64_encode(BSON_NAMESPACE . '\Unserializable');
2727
$bPersistable = base64_encode(BSON_NAMESPACE . '\Persistable');
2828

2929
$tests = array(
30-
'{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "' . $bMyAbstractDocument . '" } }',
31-
'{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "' . $bMyDocument . '" } }',
32-
'{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "' . $bUnserializable . '" } }',
33-
'{ "foo": "yes", "__pclass": { "$type" : "44", "$binary" : "' . $bPersistable . '" } }',
30+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bMyAbstractDocument . '", "$type": "80" } }',
31+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bMyDocument . '", "$type": "80" } }',
32+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bUnserializable . '", "$type": "80" } }',
33+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bPersistable . '", "$type": "44" } }',
3434
);
3535

3636
foreach ($tests as $test) {
@@ -43,7 +43,7 @@ foreach ($tests as $test) {
4343
===DONE===
4444
<?php exit(0); ?>
4545
--EXPECTF--
46-
{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "TXlBYnN0cmFjdERvY3VtZW50" } }
46+
{ "foo": "yes", "__pclass": { "$binary": "TXlBYnN0cmFjdERvY3VtZW50", "$type": "80" } }
4747
object(stdClass)#%d (2) {
4848
["foo"]=>
4949
string(3) "yes"
@@ -56,7 +56,7 @@ object(stdClass)#%d (2) {
5656
}
5757
}
5858

59-
{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "TXlEb2N1bWVudA==" } }
59+
{ "foo": "yes", "__pclass": { "$binary": "TXlEb2N1bWVudA==", "$type": "80" } }
6060
object(stdClass)#%d (2) {
6161
["foo"]=>
6262
string(3) "yes"
@@ -69,7 +69,7 @@ object(stdClass)#%d (2) {
6969
}
7070
}
7171

72-
{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "TW9uZ29EQlxCU09OXFVuc2VyaWFsaXphYmxl" } }
72+
{ "foo": "yes", "__pclass": { "$binary": "TW9uZ29EQlxCU09OXFVuc2VyaWFsaXphYmxl", "$type": "80" } }
7373
object(stdClass)#%d (2) {
7474
["foo"]=>
7575
string(3) "yes"
@@ -82,7 +82,7 @@ object(stdClass)#%d (2) {
8282
}
8383
}
8484

85-
{ "foo": "yes", "__pclass": { "$type" : "44", "$binary" : "TW9uZ29EQlxCU09OXFBlcnNpc3RhYmxl" } }
85+
{ "foo": "yes", "__pclass": { "$binary": "TW9uZ29EQlxCU09OXFBlcnNpc3RhYmxl", "$type": "44" } }
8686
object(stdClass)#%d (2) {
8787
["foo"]=>
8888
string(3) "yes"

tests/bson/bson-toPHP-002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ var_dump(toPHP($bson, $typeMap));
5252
===DONE===
5353
<?php exit(0); ?>
5454
--EXPECTF--
55-
Test { "__pclass" : { "$type" : "80", "$binary" : "TXlEb2N1bWVudA==" }, "list" : [ 1, 2, 3 ], "map" : { "foo" : "bar" } }
55+
Test { "__pclass" : { "$binary" : "TXlEb2N1bWVudA==", "$type" : "80" }, "list" : [ 1, 2, 3 ], "map" : { "foo" : "bar" } }
5656
0 : 55 00 00 00 05 5f 5f 70 63 6c 61 73 73 00 0a 00 [U....__pclass...]
5757
10 : 00 00 80 4d 79 44 6f 63 75 6d 65 6e 74 04 6c 69 [...MyDocument.li]
5858
20 : 73 74 00 1a 00 00 00 10 30 00 01 00 00 00 10 31 [st......0......1]

tests/bson/bson-toPHP-003.phpt

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ $testGroups = array(
5959
'{ "foo": "no", "array" : [ 5, 6 ] }',
6060
'{ "foo": "no", "obj" : { "embedded" : 3.14 } }',
6161
'{ "foo": "yes", "__pclass": "MyClass" }',
62-
'{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "' . $bMyClass . '" } }',
63-
'{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "' . $bYourClass . '" } }',
64-
'{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "' . $bOurClass . '" } }',
65-
'{ "foo": "yes", "__pclass": { "$type" : "44", "$binary" : "' . $bYourClass . '" } }',
62+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bMyClass . '", "$type": "80" } }',
63+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bYourClass . '", "$type": "80" } }',
64+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bOurClass . '", "$type": "80" } }',
65+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bYourClass . '", "$type": "44" } }',
6666
),
6767
),
6868
array(
@@ -76,7 +76,7 @@ $testGroups = array(
7676
'name' => 'DOES NOT IMPLEMENT UNSERIALIZABLE',
7777
'typemap' => array('root' => 'MyClass'),
7878
'tests' => array(
79-
'{ "foo": "yes", "__pclass": { "$type": "80", "$binary": "' . $bMyClass . '" } }',
79+
'{ "foo": "yes", "__pclass": { "$binary": "' . $bMyClass . '", "$type": "80" } }',
8080
),
8181
),
8282
array(
@@ -90,24 +90,24 @@ $testGroups = array(
9090
'name' => 'IS NOT A CONCRETE CLASS VIA PCLASS',
9191
'typemap' => array('root' => 'YourClass'),
9292
'tests' => array(
93-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bInterface . '" } }',
93+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bInterface . '", "$type": "80" } }',
9494
),
9595
),
9696
array(
9797
'name' => 'PCLASS OVERRIDES TYPEMAP (1)',
9898
'typemap' => array('root' => 'YourClass'),
9999
'tests' => array(
100-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bMyClass . '" } }',
101-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bOurClass . '" } }',
102-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bTheirClass . '" } }',
103-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bYourClass . '" } }',
100+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bMyClass . '", "$type": "80" } }',
101+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bOurClass . '", "$type": "80" } }',
102+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bTheirClass . '", "$type": "80" } }',
103+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bYourClass . '", "$type": "80" } }',
104104
),
105105
),
106106
array(
107107
'name' => 'PCLASS OVERRIDES TYPEMAP (2)',
108108
'typemap' => array('root' => 'OurClass'),
109109
'tests' => array(
110-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bTheirClass . '" } }',
110+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bTheirClass . '", "$type": "80" } }',
111111
),
112112
),
113113
array(
@@ -118,16 +118,16 @@ $testGroups = array(
118118
'{ "foo": "no", "array" : [ 5, 6 ] }',
119119
'{ "foo": "no", "obj" : { "embedded" : 3.14 } }',
120120
'{ "foo": "yes", "__pclass": "MyClass" }',
121-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bMyClass . '" } }',
122-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bOurClass . '" } }',
121+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bMyClass . '", "$type": "80" } }',
122+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bOurClass . '", "$type": "80" } }',
123123
),
124124
),
125125
array(
126126
'name' => 'OBJECTS AS STDCLASS',
127127
'typemap' => array('root' => 'object', 'document' => 'object'),
128128
'tests' => array(
129-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bMyClass . '" } }',
130-
'{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "' . $bOurClass . '" } }',
129+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bMyClass . '", "$type": "80" } }',
130+
'{ "foo": "yes", "__pclass" : { "$binary": "' . $bOurClass . '", "$type": "80" } }',
131131
),
132132
),
133133
);
@@ -197,7 +197,7 @@ object(stdClass)#%d (2) {
197197
string(7) "MyClass"
198198
}
199199

200-
{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "TXlDbGFzcw==" } }
200+
{ "foo": "yes", "__pclass": { "$binary": "TXlDbGFzcw==", "$type": "80" } }
201201
object(stdClass)#%d (2) {
202202
["foo"]=>
203203
string(3) "yes"
@@ -210,7 +210,7 @@ object(stdClass)#%d (2) {
210210
}
211211
}
212212

213-
{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "WW91ckNsYXNz" } }
213+
{ "foo": "yes", "__pclass": { "$binary": "WW91ckNsYXNz", "$type": "80" } }
214214
object(stdClass)#%d (2) {
215215
["foo"]=>
216216
string(3) "yes"
@@ -223,7 +223,7 @@ object(stdClass)#%d (2) {
223223
}
224224
}
225225

226-
{ "foo": "yes", "__pclass": { "$type" : "80", "$binary" : "T3VyQ2xhc3M=" } }
226+
{ "foo": "yes", "__pclass": { "$binary": "T3VyQ2xhc3M=", "$type": "80" } }
227227
object(OurClass)#%d (3) {
228228
["foo"]=>
229229
string(3) "yes"
@@ -238,7 +238,7 @@ object(OurClass)#%d (3) {
238238
bool(true)
239239
}
240240

241-
{ "foo": "yes", "__pclass": { "$type" : "44", "$binary" : "WW91ckNsYXNz" } }
241+
{ "foo": "yes", "__pclass": { "$binary": "WW91ckNsYXNz", "$type": "44" } }
242242
object(stdClass)#%d (2) {
243243
["foo"]=>
244244
string(3) "yes"
@@ -260,7 +260,7 @@ Class MissingClass does not exist
260260

261261
=== DOES NOT IMPLEMENT UNSERIALIZABLE ===
262262

263-
{ "foo": "yes", "__pclass": { "$type": "80", "$binary": "TXlDbGFzcw==" } }
263+
{ "foo": "yes", "__pclass": { "$binary": "TXlDbGFzcw==", "$type": "80" } }
264264
Class MyClass does not implement MongoDB\BSON\Unserializable
265265

266266

@@ -272,7 +272,7 @@ Class %SBSON\Unserializable is not instantiatable
272272

273273
=== IS NOT A CONCRETE CLASS VIA PCLASS ===
274274

275-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "TW9uZ29EQlxCU09OXFVuc2VyaWFsaXphYmxl" } }
275+
{ "foo": "yes", "__pclass" : { "$binary": "TW9uZ29EQlxCU09OXFVuc2VyaWFsaXphYmxl", "$type": "80" } }
276276
object(YourClass)#%d (3) {
277277
["foo"]=>
278278
string(3) "yes"
@@ -290,7 +290,7 @@ object(YourClass)#%d (3) {
290290

291291
=== PCLASS OVERRIDES TYPEMAP (1) ===
292292

293-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "TXlDbGFzcw==" } }
293+
{ "foo": "yes", "__pclass" : { "$binary": "TXlDbGFzcw==", "$type": "80" } }
294294
object(YourClass)#%d (3) {
295295
["foo"]=>
296296
string(3) "yes"
@@ -305,7 +305,7 @@ object(YourClass)#%d (3) {
305305
bool(true)
306306
}
307307

308-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "T3VyQ2xhc3M=" } }
308+
{ "foo": "yes", "__pclass" : { "$binary": "T3VyQ2xhc3M=", "$type": "80" } }
309309
object(OurClass)#%d (3) {
310310
["foo"]=>
311311
string(3) "yes"
@@ -320,7 +320,7 @@ object(OurClass)#%d (3) {
320320
bool(true)
321321
}
322322

323-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "VGhlaXJDbGFzcw==" } }
323+
{ "foo": "yes", "__pclass" : { "$binary": "VGhlaXJDbGFzcw==", "$type": "80" } }
324324
object(TheirClass)#%d (3) {
325325
["foo"]=>
326326
string(3) "yes"
@@ -335,7 +335,7 @@ object(TheirClass)#%d (3) {
335335
bool(true)
336336
}
337337

338-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "WW91ckNsYXNz" } }
338+
{ "foo": "yes", "__pclass" : { "$binary": "WW91ckNsYXNz", "$type": "80" } }
339339
object(YourClass)#%d (3) {
340340
["foo"]=>
341341
string(3) "yes"
@@ -353,7 +353,7 @@ object(YourClass)#%d (3) {
353353

354354
=== PCLASS OVERRIDES TYPEMAP (2) ===
355355

356-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "VGhlaXJDbGFzcw==" } }
356+
{ "foo": "yes", "__pclass" : { "$binary": "VGhlaXJDbGFzcw==", "$type": "80" } }
357357
object(TheirClass)#%d (3) {
358358
["foo"]=>
359359
string(3) "yes"
@@ -411,7 +411,7 @@ array(2) {
411411
string(7) "MyClass"
412412
}
413413

414-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "TXlDbGFzcw==" } }
414+
{ "foo": "yes", "__pclass" : { "$binary": "TXlDbGFzcw==", "$type": "80" } }
415415
array(2) {
416416
["foo"]=>
417417
string(3) "yes"
@@ -424,7 +424,7 @@ array(2) {
424424
}
425425
}
426426

427-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "T3VyQ2xhc3M=" } }
427+
{ "foo": "yes", "__pclass" : { "$binary": "T3VyQ2xhc3M=", "$type": "80" } }
428428
array(2) {
429429
["foo"]=>
430430
string(3) "yes"
@@ -440,7 +440,7 @@ array(2) {
440440

441441
=== OBJECTS AS STDCLASS ===
442442

443-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "TXlDbGFzcw==" } }
443+
{ "foo": "yes", "__pclass" : { "$binary": "TXlDbGFzcw==", "$type": "80" } }
444444
object(stdClass)#%d (2) {
445445
["foo"]=>
446446
string(3) "yes"
@@ -453,7 +453,7 @@ object(stdClass)#%d (2) {
453453
}
454454
}
455455

456-
{ "foo": "yes", "__pclass" : { "$type": "80", "$binary": "T3VyQ2xhc3M=" } }
456+
{ "foo": "yes", "__pclass" : { "$binary": "T3VyQ2xhc3M=", "$type": "80" } }
457457
object(stdClass)#%d (2) {
458458
["foo"]=>
459459
string(3) "yes"

0 commit comments

Comments
 (0)