From a074aceddd1131f7f440673164b261bc67747f15 Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 31 Jul 2024 03:24:54 +0000 Subject: [PATCH] PHP 8.4 fixes. --- public/index.php | 3 --- src/HtmlText.php | 2 +- src/Upload.php | 1 + src/User.php | 1 + src/UserInvite.php | 1 + src/UserSession.php | 1 + src/Zone.php | 1 + src/ZoneEffect.php | 1 + src/ZoneRedirect.php | 1 + src/ZoneTask.php | 1 + src/ZoneView.php | 1 + 11 files changed, 10 insertions(+), 4 deletions(-) diff --git a/public/index.php b/public/index.php index f99b313..8309b26 100644 --- a/public/index.php +++ b/public/index.php @@ -1032,9 +1032,6 @@ if($reqPath === '/auth/register') { } if(!isset($authError)) { - if(!preg_match('#^([a-zA-Z0-9-_]{1,20})$#', $registerUsername)) { - } - try { $createdUser = User::create( $registerUsername, diff --git a/src/HtmlText.php b/src/HtmlText.php index fc8b79a..bb50962 100644 --- a/src/HtmlText.php +++ b/src/HtmlText.php @@ -9,6 +9,6 @@ class HtmlText implements HtmlTypeInterface { } public function asHTML(): string { - return htmlspecialchars($this->text); + return htmlspecialchars($this->text, ENT_COMPAT | ENT_SUBSTITUTE | ENT_HTML5); } } diff --git a/src/Upload.php b/src/Upload.php index f029c54..c627d78 100644 --- a/src/Upload.php +++ b/src/Upload.php @@ -6,6 +6,7 @@ use Exception; class UploadNotFoundException extends Exception {}; class UploadCreationFailedException extends Exception {}; +#[\AllowDynamicProperties] final class Upload { private const ID_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'; diff --git a/src/User.php b/src/User.php index 5f2f9c7..c23ec13 100644 --- a/src/User.php +++ b/src/User.php @@ -9,6 +9,7 @@ class UserCreationInvalidNameException extends Exception {} class UserCreationInvalidPasswordException extends Exception {} class UserCreationInvalidMailException extends Exception {} +#[\AllowDynamicProperties] class User { public function __construct() { } diff --git a/src/UserInvite.php b/src/UserInvite.php index 437f447..7d1dc71 100644 --- a/src/UserInvite.php +++ b/src/UserInvite.php @@ -6,6 +6,7 @@ use Exception; class UserInviteNotFoundException extends Exception {} class UserInviteCreationFailedException extends Exception {} +#[\AllowDynamicProperties] final class UserInvite { private const TOKEN_LENGTH = 16; diff --git a/src/UserSession.php b/src/UserSession.php index 0fb20e4..1081d9b 100644 --- a/src/UserSession.php +++ b/src/UserSession.php @@ -6,6 +6,7 @@ use Exception; final class UserSessionNotFoundException extends Exception {}; final class UserSessionCreatedFailedException extends Exception {}; +#[\AllowDynamicProperties] class UserSession { private const TOKEN_CHARS = 'abcdefghijklmnopqrstuvwxyz-0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ'; private static $instance = null; diff --git a/src/Zone.php b/src/Zone.php index c5d1d5d..45f7475 100644 --- a/src/Zone.php +++ b/src/Zone.php @@ -9,6 +9,7 @@ class ZoneInvalidIdException extends Exception {}; class ZoneInvalidNameException extends Exception {}; class ZoneInvalidTitleException extends Exception {}; +#[\AllowDynamicProperties] final class Zone { private $effects = null; private $passiveMode = false; diff --git a/src/ZoneEffect.php b/src/ZoneEffect.php index 7f8828e..93b8433 100644 --- a/src/ZoneEffect.php +++ b/src/ZoneEffect.php @@ -5,6 +5,7 @@ use Exception; class ZoneEffectClassNotFoundException extends Exception {}; +#[\AllowDynamicProperties] final class ZoneEffect { private const CLASS_NAME = '\\YTKNS\\Effects\\%sEffect'; diff --git a/src/ZoneRedirect.php b/src/ZoneRedirect.php index 9b106ed..17225a8 100644 --- a/src/ZoneRedirect.php +++ b/src/ZoneRedirect.php @@ -1,6 +1,7 @@ zone_id ?? 0; diff --git a/src/ZoneView.php b/src/ZoneView.php index b7e68ea..48d747b 100644 --- a/src/ZoneView.php +++ b/src/ZoneView.php @@ -1,6 +1,7 @@