File tree Expand file tree Collapse file tree 2 files changed +2
-10
lines changed Expand file tree Collapse file tree 2 files changed +2
-10
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ require_once __DIR__ . '/../utils/tools.php';
8
8
$ doc = ['foo ' => new MongoDB \BSON \Javascript ('function foo(bar) { return bar; } ' )];
9
9
$ json = json_encode ($ doc );
10
10
11
- /* Note: libbson currently does properly handle Javascript types. Conversion of
12
- * BSON to JSON yields a single code string value instead of a document with
13
- * "$code" and "$scope" fields. Likewise, "$code" and "$scope" fields are not
14
- * parsed when converting JSON to BSON. See CDRIVER-1335 for more info. */
15
11
echo toJSON (fromPHP ($ doc )), "\n" ;
16
12
echo $ json , "\n" ;
17
13
var_dump (toPHP (fromJSON ($ json )));
@@ -20,7 +16,7 @@ var_dump(toPHP(fromJSON($json)));
20
16
===DONE===
21
17
<?php exit (0 ); ?>
22
18
--EXPECTF--
23
- { "foo" : " function foo(bar) { return bar; }" }
19
+ { "foo" : { "$code" : " function foo(bar) { return bar; }" } }
24
20
{"foo":{"$code":"function foo(bar) { return bar; }"}}
25
21
object(stdClass)#%d (%d) {
26
22
["foo"]=>
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ require_once __DIR__ . '/../utils/tools.php';
8
8
$ doc = ['foo ' => new MongoDB \BSON \Javascript ('function foo(bar) { return bar; } ' , ['foo ' => 42 ])];
9
9
$ json = json_encode ($ doc );
10
10
11
- /* Note: libbson currently does properly handle Javascript types. Conversion of
12
- * BSON to JSON yields a single code string value instead of a document with
13
- * "$code" and "$scope" fields. Likewise, "$code" and "$scope" fields are not
14
- * parsed when converting JSON to BSON. See CDRIVER-1335 for more info. */
15
11
echo toJSON (fromPHP ($ doc )), "\n" ;
16
12
echo $ json , "\n" ;
17
13
var_dump (toPHP (fromJSON ($ json )));
@@ -20,7 +16,7 @@ var_dump(toPHP(fromJSON($json)));
20
16
===DONE===
21
17
<?php exit (0 ); ?>
22
18
--EXPECTF--
23
- { "foo" : " function foo(bar) { return bar; }" }
19
+ { "foo" : { "$code" : " function foo(bar) { return bar; }" } }
24
20
{"foo":{"$code":"function foo(bar) { return bar; }","$scope":{"foo":42}}}
25
21
object(stdClass)#%d (%d) {
26
22
["foo"]=>
You can’t perform that action at this time.
0 commit comments