Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F619034
packed_bit-002.phpt
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
894 B
Referenced Files
None
Subscribers
None
packed_bit-002.phpt
View Options
--TEST--
Tests of Binary subtype 9, Vectors, with dtype PACKED_BIT: Simple Vector PACKED_BIT
--DESCRIPTION--
Generated by scripts/convert-bson-binary-vector-tests.php
DO NOT EDIT THIS FILE
--FILE--
<?php
require_once __DIR__ . '/../utils/basic.inc';
// Vector [127,7] with padding 0
$vector = array (
0 => 0,
1 => 1,
2 => 1,
3 => 1,
4 => 1,
5 => 1,
6 => 1,
7 => 1,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0,
13 => 1,
14 => 1,
15 => 1,
);
$binary = MongoDB\BSON\Binary::fromVector($vector, \MongoDB\BSON\VectorType::PackedBit);
echo bin2hex((string) MongoDB\BSON\Document::fromPHP(['vector' => $binary])), "\n";
$bson = MongoDB\BSON\Document::fromBSON(hex2bin('1600000005766563746F7200040000000910007F0700'));
var_dump($binary == $bson['vector']);
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
1600000005766563746f7200040000000910007f0700
bool(true)
===DONE===
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 14, 4:13 PM (7 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140124
Default Alt Text
packed_bit-002.phpt (894 B)
Attached To
Mode
R114 php-mongodb
Attached
Detach File
Event Timeline