Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F630529
bson-decimal128-jsonserialize-002.phpt
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
598 B
Referenced Files
None
Subscribers
None
bson-decimal128-jsonserialize-002.phpt
View Options
--TEST--
MongoDB\BSON\Decimal128::jsonSerialize() with json_encode()
--FILE--
<?php
require_once __DIR__ . '/../utils/basic.inc';
$doc = ['foo' => new MongoDB\BSON\Decimal128('12389719287312')];
$json = json_encode($doc);
echo toJSON(fromPHP($doc)), "\n";
echo $json, "\n";
var_dump(toPHP(fromJSON($json)));
?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
{ "foo" : { "$numberDecimal" : "12389719287312" } }
{"foo":{"$numberDecimal":"12389719287312"}}
object(stdClass)#%d (%d) {
["foo"]=>
object(MongoDB\BSON\Decimal128)#%d (%d) {
["dec"]=>
string(14) "12389719287312"
}
}
===DONE===
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 15, 9:42 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
152237
Default Alt Text
bson-decimal128-jsonserialize-002.phpt (598 B)
Attached To
Mode
R114 php-mongodb
Attached
Detach File
Event Timeline