summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/php_53_compatibility.php17
-rw-r--r--includes/session.php6
2 files changed, 18 insertions, 5 deletions
diff --git a/includes/php_53_compatibility.php b/includes/php_53_compatibility.php
index 2988457391..cdceaded73 100644
--- a/includes/php_53_compatibility.php
+++ b/includes/php_53_compatibility.php
@@ -16,6 +16,21 @@ namespace Webtrees;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * https://php.net/date_default_timezone_get
+ * Prior to PHP 5.4, this function would attempt to guess the timezone,
+ * and emit a warning when it did this. Suppresss the warning.
+ *
+ * @return string
+ */
+function date_default_timezone_get() {
+ $level = error_reporting(0);
+ $timezone = \date_default_timezone_get();
+ error_reporting($level);
+
+ return $timezone;
+}
+
// http://php.net/manual/en/security.magicquotes.disabling.php
if (get_magic_quotes_gpc()) {
$_process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
@@ -73,7 +88,7 @@ if (!defined('PASSWORD_BCRYPT') && crypt("password", $hash) !== $hash) {
}
/**
- * This function was added to PHP in 5.4
+ * https://php.net/http_response_code
*
* @param string|null $code
*
diff --git a/includes/session.php b/includes/session.php
index 4f7dad93f2..194c5ea446 100644
--- a/includes/session.php
+++ b/includes/session.php
@@ -161,10 +161,8 @@ if (version_compare(PHP_VERSION, '5.4', '<')) {
require WT_ROOT . 'vendor/autoload.php';
-// PHP requires a time zone to be set in php.ini
-if (!ini_get('date.timezone')) {
- date_default_timezone_set(@date_default_timezone_get());
-}
+// PHP requires a time zone to be set
+date_default_timezone_set(date_default_timezone_get());
// Use the patchwork/utf8 library to:
// 1) set all PHP defaults to UTF-8