From f34d14280db442e26ff97d52c2949d0872ffe105 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn>
Date: Tue, 15 Feb 2022 11:10:47 +0800
Subject: [PATCH] Fix compatibility with PHP 8.1 (#1324)
* Fix compatibility with PHP 8.1
PHP Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in typecho/var/Widget/Archive.php on line 1292
* Fix login
* Fix write
* Fix manage
* Fix PHP Deprecated
---
admin/login.php | 4 ++--
admin/manage-comments.php | 2 +-
admin/manage-medias.php | 2 +-
admin/manage-pages.php | 2 +-
admin/manage-users.php | 2 +-
admin/write-page.php | 4 ++--
admin/write-post.php | 8 ++++----
var/Typecho/Response.php | 2 +-
var/Widget/Archive.php | 2 +-
var/Widget/User.php | 2 +-
10 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/admin/login.php b/admin/login.php
index 3c49bd3629..e51d5789d2 100644
--- a/admin/login.php
+++ b/admin/login.php
@@ -4,7 +4,7 @@
if ($user->hasLogin()) {
$response->redirect($options->adminUrl);
}
-$rememberName = htmlspecialchars(\Typecho\Cookie::get('__typecho_remember_name'));
+$rememberName = htmlspecialchars(\Typecho\Cookie::get('__typecho_remember_name', ''));
\Typecho\Cookie::delete('__typecho_remember_name');
$bodyClass = 'body-100';
@@ -25,7 +25,7 @@
-
+
- password) == 0): ?> class="hidden">
+
password ?? '') == 0): ?> class="hidden">
内容密码
response->redirect(defined('__TYPECHO_ADMIN__') ? $this->options->loginUrl .
- (0 === strpos($this->request->getReferer(), $this->options->loginUrl) ? '' :
+ (0 === strpos($this->request->getReferer() ?? '', $this->options->loginUrl) ? '' :
'?referer=' . urlencode($this->request->makeUriByRequest())) : $this->options->siteUrl, false);
}
}