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';
88$ doc = ['foo ' => new MongoDB \BSON \Javascript ('function foo(bar) { return bar; } ' )];
99$ json = json_encode ($ doc );
1010
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. */
1511echo toJSON (fromPHP ($ doc )), "\n" ;
1612echo $ json , "\n" ;
1713var_dump (toPHP (fromJSON ($ json )));
@@ -20,7 +16,7 @@ var_dump(toPHP(fromJSON($json)));
2016===DONE===
2117<?php exit (0 ); ?>
2218--EXPECTF--
23- { "foo" : " function foo(bar) { return bar; }" }
19+ { "foo" : { "$code" : " function foo(bar) { return bar; }" } }
2420{"foo":{"$code":"function foo(bar) { return bar; }"}}
2521object(stdClass)#%d (%d) {
2622 ["foo"]=>
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ require_once __DIR__ . '/../utils/tools.php';
88$ doc = ['foo ' => new MongoDB \BSON \Javascript ('function foo(bar) { return bar; } ' , ['foo ' => 42 ])];
99$ json = json_encode ($ doc );
1010
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. */
1511echo toJSON (fromPHP ($ doc )), "\n" ;
1612echo $ json , "\n" ;
1713var_dump (toPHP (fromJSON ($ json )));
@@ -20,7 +16,7 @@ var_dump(toPHP(fromJSON($json)));
2016===DONE===
2117<?php exit (0 ); ?>
2218--EXPECTF--
23- { "foo" : " function foo(bar) { return bar; }" }
19+ { "foo" : { "$code" : " function foo(bar) { return bar; }" } }
2420{"foo":{"$code":"function foo(bar) { return bar; }","$scope":{"foo":42}}}
2521object(stdClass)#%d (%d) {
2622 ["foo"]=>
You can’t perform that action at this time.
0 commit comments