Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F631649
bson-document-toPHP_error-002.phpt
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
675 B
Referenced Files
None
Subscribers
None
bson-document-toPHP_error-002.phpt
View Options
--TEST--
MongoDB\BSON\Document::toPHP(): exception thrown in Unserializable::bsonUnserialize() propagates (root document)
--FILE--
<?php
require_once __DIR__ . '/../utils/basic.inc';
class ThrowingClass implements MongoDB\BSON\Unserializable
{
public function bsonUnserialize(array $data): void
{
throw new RuntimeException('bsonUnserialize threw');
}
}
$bson = MongoDB\BSON\Document::fromPHP(['foo' => 'bar', 'baz' => 42]);
echo throws(function() use ($bson) {
$bson->toPHP(['root' => ThrowingClass::class]);
}, RuntimeException::class), "\n";
?>
===DONE===
<?php exit(0); ?>
--EXPECT--
OK: Got RuntimeException
bsonUnserialize threw
===DONE===
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sun, Nov 15, 12:27 PM (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
152327
Default Alt Text
bson-document-toPHP_error-002.phpt (675 B)
Attached To
Mode
R114 php-mongodb
Attached
Detach File
Event Timeline