📁 File Manager Pro
v10.0.3 | PHP: 8.2.31
Server: LiteSpeed
2026-07-02 22:33:52
📂
/ (Root)
/
opt
/
alt
/
tests
/
alt-php80-pecl-mongodb_1.18.1-1.el8
/
tests
📍 /opt/alt/tests/alt-php80-pecl-mongodb_1.18.1-1.el8/tests
🔄 Refresh
✏️
Editing: bson-toJSON-002.phpt
Read Only
--TEST-- MongoDB\BSON\toJSON(): Encoding extended JSON types --FILE-- <?php require_once __DIR__ . '/../utils/basic.inc'; $tests = [ [ '_id' => new MongoDB\BSON\ObjectId('56315a7c6118fd1b920270b1') ], [ 'binary' => new MongoDB\BSON\Binary('foo', MongoDB\BSON\Binary::TYPE_GENERIC) ], [ 'date' => new MongoDB\BSON\UTCDateTime(1445990400000) ], [ 'timestamp' => new MongoDB\BSON\Timestamp(1234, 5678) ], [ 'regex' => new MongoDB\BSON\Regex('pattern', 'i') ], [ 'code' => new MongoDB\BSON\Javascript('function() { return 1; }') ], [ 'code_ws' => new MongoDB\BSON\Javascript('function() { return a; }', ['a' => 1]) ], [ 'minkey' => new MongoDB\BSON\MinKey ], [ 'maxkey' => new MongoDB\BSON\MaxKey ], ]; foreach ($tests as $value) { $bson = fromPHP($value); echo toJSON($bson), "\n"; } ?> ===DONE=== <?php exit(0); ?> --EXPECT-- { "_id" : { "$oid" : "56315a7c6118fd1b920270b1" } } { "binary" : { "$binary" : "Zm9v", "$type" : "00" } } { "date" : { "$date" : 1445990400000 } } { "timestamp" : { "$timestamp" : { "t" : 5678, "i" : 1234 } } } { "regex" : { "$regex" : "pattern", "$options" : "i" } } { "code" : { "$code" : "function() { return 1; }" } } { "code_ws" : { "$code" : "function() { return a; }", "$scope" : { "a" : 1 } } } { "minkey" : { "$minKey" : 1 } } { "maxkey" : { "$maxKey" : 1 } } ===DONE===
💾 Save Changes
❌ Cancel