Page MenuHomePhabricator (Chris)

bson-document-array-access_error-001.phpt
No OneTemporary

Authored By
Unknown
Size
793 B
Referenced Files
None
Subscribers
None

bson-document-array-access_error-001.phpt

--TEST--
MongoDB\BSON\Document array access does not allow writing (dimension object accessors)
--FILE--
<?php
require_once __DIR__ . '/../utils/basic.inc';
$document = MongoDB\BSON\Document::fromPHP([
'foo' => 'bar',
'bar' => 'baz',
'int64' => new MongoDB\BSON\Int64(123),
]);
echo throws(function() use ($document) {
$document['foo'] = 'baz';
}, MongoDB\Driver\Exception\LogicException::class), "\n";
echo throws(function() use ($document) {
unset($document['foo']);
}, MongoDB\Driver\Exception\LogicException::class), "\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got MongoDB\Driver\Exception\LogicException
Cannot write to MongoDB\BSON\Document property
OK: Got MongoDB\Driver\Exception\LogicException
Cannot unset MongoDB\BSON\Document property
===DONE===

File Metadata

Mime Type
application/javascript
Expires
Sun, Nov 15, 12:49 AM (22 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140113
Default Alt Text
bson-document-array-access_error-001.phpt (793 B)

Event Timeline