From 8ff2fe663dd13e03e35bf28102260f6327b64a59 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 16 Feb 2023 01:53:08 +0100 Subject: [PATCH] Fix PHP 7.3 compatibility --- composer.json | 2 +- src/Date.php | 4 ++-- src/Db.php | 4 ++-- src/I18n.php | 6 +++--- src/Log.php | 2 +- src/SentryIntegration.php | 2 +- src/Session.php | 2 +- src/Tpl.php | 18 +++++++++--------- src/Url.php | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index 3d2454b..e9b4a75 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "sepia/po-parser": "^6.0", "sentry/sdk": "^3.3", "ext-pdo": "^7.3", - "ext-json": "^7.3", + "ext-json": "^1.7", "ext-yaml": "^2.0", "league/mime-type-detection": "^1.11" }, diff --git a/src/Date.php b/src/Date.php index 9da0db2..a43401f 100644 --- a/src/Date.php +++ b/src/Date.php @@ -9,14 +9,14 @@ class Date { * @see strftime() * @var string */ - public static string $date_format = "%d/%m/%Y"; + public static $date_format = "%d/%m/%Y"; /** * The datetime format * @see strftime() * @var string */ - public static string $date_time_format = "%d/%m/%Y %H:%M:%S"; + public static $date_time_format = "%d/%m/%Y %H:%M:%S"; /** * Format a timestamp as date/datetime string diff --git a/src/Db.php b/src/Db.php index 3d5b895..b720ae3 100644 --- a/src/Db.php +++ b/src/Db.php @@ -24,13 +24,13 @@ class Db { * Date format as returned by database * @var string */ - protected string $date_format = '%Y-%m-%d'; + protected $date_format = '%Y-%m-%d'; /** * Datetime format as returned by database * @var string */ - protected string $datetime_format = '%Y-%m-%d %H:%M:%S'; + protected $datetime_format = '%Y-%m-%d %H:%M:%S'; /** * Locale for time (as expected by LC_TIME) diff --git a/src/I18n.php b/src/I18n.php index 892d504..66012e6 100644 --- a/src/I18n.php +++ b/src/I18n.php @@ -15,19 +15,19 @@ class I18n { * The core root directory path of translation files * @var string */ - protected static string $core_root_path = __DIR__.'/../locales'; + protected static $core_root_path = __DIR__.'/../locales'; /** * The root directory path of translation files * @var string */ - protected static string $root_path = 'locales'; + protected static $root_path = 'locales'; /** * The default locale * @var string */ - protected static string $default_locale = 'en_US.UTF8'; + protected static $default_locale = 'en_US.UTF8'; /** * Initialize translation system diff --git a/src/Log.php b/src/Log.php index c2cc595..e2eb7ad 100644 --- a/src/Log.php +++ b/src/Log.php @@ -36,7 +36,7 @@ class Log { * Default log level * @var string */ - protected static string $default_level = 'WARNING'; + protected static $default_level = 'WARNING'; /* * Current log level diff --git a/src/SentryIntegration.php b/src/SentryIntegration.php index 91bda43..ec0927d 100644 --- a/src/SentryIntegration.php +++ b/src/SentryIntegration.php @@ -18,7 +18,7 @@ class SentryIntegration { * @see https://www.php.net/manual/fr/errorfunc.constants.php * @var array */ - protected static array $php_error_types = array( + protected static $php_error_types = array( E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR,E_DEPRECATED, ); diff --git a/src/Session.php b/src/Session.php index 010ddeb..11499d0 100644 --- a/src/Session.php +++ b/src/Session.php @@ -11,7 +11,7 @@ class Session { * Session max duration (in seconds, default: 12h) * @var int */ - protected static int $max_duration = 12 * 60 * 60; + protected static $max_duration = 12 * 60 * 60; /** * Initialization diff --git a/src/Tpl.php b/src/Tpl.php index 30a13e1..9faf952 100644 --- a/src/Tpl.php +++ b/src/Tpl.php @@ -13,7 +13,7 @@ class Tpl { * Smarty object * @var \Smarty */ - public static Smarty $smarty; + public static $smarty; /** * Smarty_Security object @@ -25,25 +25,25 @@ class Tpl { * Core Smarty templates directory * @var string */ - public static string $core_templates_directory; + public static $core_templates_directory; /** * Smarty templates directories path with their priority * @var array */ - public static array $templates_directories = array(); + public static $templates_directories = array(); /** * Smarty cache templates directory path * @var string */ - public static string $templates_c_dir; + public static $templates_c_dir; /** * Enable/disable AJAX returned data debugging in logs * @var bool */ - public static bool $_debug_ajax; + public static $_debug_ajax; /** * Core static directory @@ -55,19 +55,19 @@ class Tpl { * Static directories path with their priority * @var array */ - private static array $static_directories = array(); + private static $static_directories = array(); /** * CSS files to load in next displayed page * @var array */ - private static array $css_files = array(); + private static $css_files = array(); /** * JavaScript files to load in next displayed page * @var array */ - private static array $js_files = array(); + private static $js_files = array(); /** * MIME type detector object @@ -508,7 +508,7 @@ class Tpl { * @return bool */ public static function initialized() { - return isset(self :: $smarty); + return self :: $smarty instanceof Smarty; } /** diff --git a/src/Url.php b/src/Url.php index 010f378..971ed25 100644 --- a/src/Url.php +++ b/src/Url.php @@ -48,7 +48,7 @@ class Url { * @see self :: initialization() * @var bool */ - protected static bool $_api_mode; + protected static $_api_mode; /** * Initialization