HEX
Server: LiteSpeed
System: Linux server161.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: imagzxcb (1058)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //home/imagzxcb/public_html/db127a/decimal128-5-valid-050.phpt.tar
opt/alt/tests/alt-php84-pecl-mongodb_1.20.0-2.el8/tests/decimal128-5-valid-050.phpt000064400000002354152044715120022437 0ustar00--TEST--
Decimal128: [decq631] fold-down full sequence (Clamped)
--DESCRIPTION--
Generated by scripts/convert-bson-corpus-tests.php

DO NOT EDIT THIS FILE
--FILE--
<?php

require_once __DIR__ . '/../utils/basic.inc';

$canonicalBson = hex2bin('18000000136400000064A7B3B6E00D000000000000FE5F00');
$canonicalExtJson = '{"d" : {"$numberDecimal" : "1.000000000000000000E+6129"}}';
$degenerateExtJson = '{"d" : {"$numberDecimal" : "1E+6129"}}';

// Canonical BSON -> BSON object -> Canonical BSON
echo bin2hex((string) MongoDB\BSON\Document::fromBSON($canonicalBson)), "\n";

// Canonical BSON -> BSON object -> Canonical extJSON
echo json_canonicalize(MongoDB\BSON\Document::fromBSON($canonicalBson)->toCanonicalExtendedJSON()), "\n";

// Canonical extJSON -> BSON object -> Canonical BSON
echo bin2hex((string) MongoDB\BSON\Document::fromJSON($canonicalExtJson)), "\n";

// Degenerate extJSON -> BSON object -> Canonical BSON
echo bin2hex((string) MongoDB\BSON\Document::fromJSON($degenerateExtJson)), "\n";

?>
===DONE===
<?php exit(0); ?>
--EXPECT--
18000000136400000064a7b3b6e00d000000000000fe5f00
{"d":{"$numberDecimal":"1.000000000000000000E+6129"}}
18000000136400000064a7b3b6e00d000000000000fe5f00
18000000136400000064a7b3b6e00d000000000000fe5f00
===DONE===