📁 File Manager Pro
v10.0.3 | PHP: 7.4.33
Server: LiteSpeed
2026-07-12 03:42:42
📂
/ (Root)
/
opt
/
alt
/
tests
/
alt-php81-pecl-mongodb_1.18.1-1.el8
/
tests
📍 /opt/alt/tests/alt-php81-pecl-mongodb_1.18.1-1.el8/tests
🔄 Refresh
✏️
Editing: bson-binary-jsonserialize-002.phpt
Read Only
--TEST-- MongoDB\BSON\Binary::jsonSerialize() with json_encode() --FILE-- <?php require_once __DIR__ . '/../utils/basic.inc'; $doc = ['foo' => new MongoDB\BSON\Binary('gargleblaster', 24)]; $json = json_encode($doc); echo toJSON(fromPHP($doc)), "\n"; echo $json, "\n"; var_dump(toPHP(fromJSON($json))); ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- { "foo" : { "$binary" : "Z2FyZ2xlYmxhc3Rlcg==", "$type" : "18" } } {"foo":{"$binary":"Z2FyZ2xlYmxhc3Rlcg==","$type":"18"}} object(stdClass)#%d (%d) { ["foo"]=> object(MongoDB\BSON\Binary)#%d (%d) { ["data"]=> string(13) "gargleblaster" ["type"]=> int(24) } } ===DONE===
💾 Save Changes
❌ Cancel