mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-03-26 01:42:10 +01:00
* Introduce MongoDB\Driver\ServerApi * Accept serverApi driver option * Introduce create_test_manager factory to create manager A centralised entry point is required to inject the API_VERSION env variable later. * Add build variant to test with requireApiVersion=true * Fix wrong configuration for auth variable This changed when migrating from our own scripts to drivers-evergreen-tools and was not updated properly, causing all tests to run with auth disabled. * Declare ZEND_PARSE_PARAMETERS_NONE macro This macro is missing on PHP < 7.3 * Remove duplicated API param storage * Add missing semicolons * Add ZEND_PARSE_PARAMETERS_NON_EX macro * Extract error handling functionality to separate macros * Throw if internal mongoc_server_api_t is already initialised * Use imported namespaces in tools file * Fix type info for reflection * Use American English spelling * Only use typed serialize signature on PHP 8+ * Update PHONGO_PARSE_PARAMETERS_NONE macro for PHP < 7.3 * Remove usage of ZEND_STRL within zend_hash_str_add This causes compile failures on PHP < 7.3 that I have yet to understand. * Fix errors in new PHONGO_PARSE_PARAMETERS macros
93 lines
2.2 KiB
PHP
93 lines
2.2 KiB
PHP
--TEST--
|
|
PHPC-544: Consult SIZEOF_ZEND_LONG for 64-bit integer support
|
|
--SKIPIF--
|
|
<?php if (8 !== PHP_INT_SIZE) { die('skip Only for 64-bit platform'); } ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require_once __DIR__ . '/../utils/basic.inc';
|
|
|
|
$tests = [
|
|
['x' => -2147483648],
|
|
['x' => 2147483647],
|
|
['x' => -4294967294],
|
|
['x' => 4294967294],
|
|
['x' => -4294967295],
|
|
['x' => 4294967295],
|
|
['x' => -9223372036854775807],
|
|
['x' => 9223372036854775807],
|
|
];
|
|
|
|
foreach ($tests as $test) {
|
|
$bson = fromPHP($test);
|
|
/* Note: Although libbson can parse the extended JSON representation for
|
|
* 64-bit integers (i.e. "$numberLong"), it currently prints them as
|
|
* doubles (see: https://jira.mongodb.org/browse/CDRIVER-375). */
|
|
printf("Test %s\n", toJSON($bson));
|
|
hex_dump($bson);
|
|
var_dump(toPHP($bson));
|
|
echo "\n";
|
|
}
|
|
|
|
?>
|
|
===DONE===
|
|
<?php exit(0); ?>
|
|
--EXPECTF--
|
|
Test { "x" : -2147483648 }
|
|
0 : 0c 00 00 00 10 78 00 00 00 00 80 00 [.....x......]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(-2147483648)
|
|
}
|
|
|
|
Test { "x" : 2147483647 }
|
|
0 : 0c 00 00 00 10 78 00 ff ff ff 7f 00 [.....x......]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(2147483647)
|
|
}
|
|
|
|
Test { "x" : -4294967294 }
|
|
0 : 10 00 00 00 12 78 00 02 00 00 00 ff ff ff ff 00 [.....x..........]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(-4294967294)
|
|
}
|
|
|
|
Test { "x" : 4294967294 }
|
|
0 : 10 00 00 00 12 78 00 fe ff ff ff 00 00 00 00 00 [.....x..........]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(4294967294)
|
|
}
|
|
|
|
Test { "x" : -4294967295 }
|
|
0 : 10 00 00 00 12 78 00 01 00 00 00 ff ff ff ff 00 [.....x..........]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(-4294967295)
|
|
}
|
|
|
|
Test { "x" : 4294967295 }
|
|
0 : 10 00 00 00 12 78 00 ff ff ff ff 00 00 00 00 00 [.....x..........]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(4294967295)
|
|
}
|
|
|
|
Test { "x" : -9223372036854775807 }
|
|
0 : 10 00 00 00 12 78 00 01 00 00 00 00 00 00 80 00 [.....x..........]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(-9223372036854775807)
|
|
}
|
|
|
|
Test { "x" : 9223372036854775807 }
|
|
0 : 10 00 00 00 12 78 00 ff ff ff ff ff ff ff 7f 00 [.....x..........]
|
|
object(stdClass)#%d (%d) {
|
|
["x"]=>
|
|
int(9223372036854775807)
|
|
}
|
|
|
|
===DONE===
|