File manager - Edit - /opt/cpanel/ea-php74/root/usr/share/tests/pecl/mongodb/tests/bson/bson-document-fromBSON_error-002.phpt
Back
--TEST-- MongoDB\BSON\Document::fromBSON(): BSON decoding exceptions for malformed documents --DESCRIPTION-- This test was adapted from bson-toPHP_error-003.phpt --FILE-- <?php require_once __DIR__ . '/../utils/basic.inc'; $tests = [ pack('Vx', 4), // Empty document with invalid length (too small) pack('Vx', 6), // Empty document with invalid length (too large) ]; foreach ($tests as $bson) { echo throws(function() use ($bson) { MongoDB\BSON\Document::fromBSON($bson); }, MongoDB\Driver\Exception\UnexpectedValueException::class), "\n"; } ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- OK: Got MongoDB\Driver\Exception\UnexpectedValueException Could not read document from BSON reader OK: Got MongoDB\Driver\Exception\UnexpectedValueException Could not read document from BSON reader ===DONE===
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings