mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-03-26 01:42:10 +01:00
This is necessary, because without it, the check for whether SSL is enabled fails, as the phpinfo() output buffer that it uses gets aborted with:: [2018/12/11 16:35:00.441] 099+ date/time support => enabled [2018/12/11 16:35:00.441] 100+ "Olson" Timezone Database Version => 2015.5 [2018/12/11 16:35:00.441] 101+ Timezone Database => internal [2018/12/11 16:35:00.441] 102+ skip E_WARNING: phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. @ /data/mci/d58ba616b6660bdc1a013e7e0584a4dd/src/tests/utils/tools.php:74
28 lines
795 B
PHP
28 lines
795 B
PHP
<?php
|
|
|
|
require_once __DIR__ . '/basic.inc';
|
|
require_once __DIR__ . '/skipif.php';
|
|
|
|
if ( ! extension_loaded('mongodb')) {
|
|
exit('skip mongodb extension is not loaded');
|
|
}
|
|
|
|
/* Force date.timezone to be "UTC" */
|
|
date_default_timezone_set("UTC");
|
|
|
|
set_error_handler(function($errno, $errstr, $errfile, $errline) {
|
|
exit(sprintf('skip %s: %s @ %s:%d', errno_as_string($errno), $errstr, $errfile, $errline));
|
|
});
|
|
|
|
set_exception_handler(function($e) {
|
|
exit(sprintf('skip %s(%d): %s @ %s:%d', get_class($e), $e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine()));
|
|
});
|
|
|
|
register_shutdown_function(function() {
|
|
$lastError = error_get_last();
|
|
|
|
if ($lastError !== null) {
|
|
exit(sprintf('skip %s: %s', errno_as_string($lastError['type']), $lastError['message']));
|
|
}
|
|
});
|