File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ BSON\toPHP(): BSON decoding exceptions for malformed documents
3+ --SKIPIF--
4+ <?php require __DIR__ . "/../utils/basic-skipif.inc " ?>
5+ --FILE--
6+ <?php
7+ require_once __DIR__ . "/../utils/basic.inc " ;
8+
9+ $ tests = array (
10+ pack ('Vx ' , 4 ), // Empty document with invalid length (too small)
11+ pack ('Vx ' , 6 ), // Empty document with invalid length (too large)
12+ );
13+
14+ foreach ($ tests as $ bson ) {
15+ echo throws (function () use ($ bson ) {
16+ toPHP ($ bson );
17+ }, 'MongoDB\Driver\Exception\UnexpectedValueException ' ), "\n" ;
18+ }
19+
20+ ?>
21+ ===DONE===
22+ <?php exit (0 ); ?>
23+ --EXPECTF--
24+ OK: Got MongoDB\Driver\Exception\UnexpectedValueException
25+ Could not read document from BSON reader
26+ OK: Got MongoDB\Driver\Exception\UnexpectedValueException
27+ Could not read document from BSON reader
28+ ===DONE===
You can’t perform that action at this time.
0 commit comments