From a201e10ee024f03fb6aad0ec1069cc4da72a9ac5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 1 Dec 2021 13:37:35 +0300 Subject: [PATCH] Revert "various fixes vor php 8.1 compatibility" This reverts commit 14027ae04e4aee6cf1c3a4ff9a390ec266c0fb09. --- classes/config.php | 2 +- classes/debug.php | 2 +- classes/feeditem/atom.php | 2 +- classes/feedparser.php | 2 +- classes/feeds.php | 2 +- classes/pref/system.php | 2 +- composer.lock | 2 +- lib/jimIcon.php | 2 +- vendor/j4mie/idiorm/idiorm.php | 44 ++++++++++++++-------------------- 9 files changed, 26 insertions(+), 34 deletions(-) diff --git a/classes/config.php b/classes/config.php index 4c8d79ac8..95e2dd3ac 100644 --- a/classes/config.php +++ b/classes/config.php @@ -359,7 +359,7 @@ class Config { if ($check == "version") { - $rv["version"] = date("%y.%m", (int)$timestamp) . "-$commit"; + $rv["version"] = strftime("%y.%m", (int)$timestamp) . "-$commit"; $rv["commit"] = $commit; $rv["timestamp"] = $timestamp; diff --git a/classes/debug.php b/classes/debug.php index 1b9d499e5..e20126b86 100644 --- a/classes/debug.php +++ b/classes/debug.php @@ -88,7 +88,7 @@ class Debug { if (!self::$enabled || self::$loglevel < $level) return false; - $ts = date("%H:%M:%S", time()); + $ts = strftime("%H:%M:%S", time()); if (function_exists('posix_getpid')) { $ts = "$ts/" . posix_getpid(); } diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index cac6d8c54..36a2e91f5 100755 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -70,7 +70,7 @@ class FeedItem_Atom extends FeedItem_Common { * * @return string the rewritten XML or original $content */ - private function rewrite_content_to_base(?string $base = null, ?string $content = '') { + private function rewrite_content_to_base(?string $base = null, string $content) { if (!empty($base) && !empty($content)) { diff --git a/classes/feedparser.php b/classes/feedparser.php index 3821c15d8..6ce69cc89 100644 --- a/classes/feedparser.php +++ b/classes/feedparser.php @@ -201,7 +201,7 @@ class FeedParser { // libxml may have invalid unicode data in error messages function error() : string { - return UConverter::transcode($this->error ?? '', 'UTF-8', 'UTF-8'); + return UConverter::transcode($this->error, 'UTF-8', 'UTF-8'); } /** @return array - WARNING: may return invalid unicode data */ diff --git a/classes/feeds.php b/classes/feeds.php index ebffe3269..a9afb70f2 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -23,7 +23,7 @@ class Feeds extends Handler_Protected { */ private function _format_headlines_list($feed, string $method, string $view_mode, int $limit, bool $cat_view, int $offset, string $override_order, bool $include_children, ?int $check_first_id = null, - ?bool $skip_first_id_check = false, ? string $order_by = ''): array { + bool $skip_first_id_check, string $order_by): array { $disable_cache = false; diff --git a/classes/pref/system.php b/classes/pref/system.php index 806291c72..10f196b55 100644 --- a/classes/pref/system.php +++ b/classes/pref/system.php @@ -138,7 +138,7 @@ class Pref_System extends Handler_Administrative { $sth->execute($errno_values); while ($line = $sth->fetch()) { - foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v ?? ''); } + foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v); } ?> diff --git a/composer.lock b/composer.lock index dbbb1de5a..4dde84cd2 100644 --- a/composer.lock +++ b/composer.lock @@ -21,7 +21,7 @@ "shasum": "" }, "require": { - "php": "^8" + "php": "^7" }, "require-dev": { "friendsofphp/php-cs-fixer": "*", diff --git a/lib/jimIcon.php b/lib/jimIcon.php index eb9a51458..eaa768272 100644 --- a/lib/jimIcon.php +++ b/lib/jimIcon.php @@ -31,7 +31,7 @@ class jimIcon { } if ($a != 127) $this->all_transaprent = 0; - return imagecolorallocatealpha($img, $r, $g, $b, (int) $a); + return imagecolorallocatealpha($img, $r, $g, $b, $a); } // Given a string with the contents of an .ICO, diff --git a/vendor/j4mie/idiorm/idiorm.php b/vendor/j4mie/idiorm/idiorm.php index 74fc7fcc7..2b1f38ca0 100644 --- a/vendor/j4mie/idiorm/idiorm.php +++ b/vendor/j4mie/idiorm/idiorm.php @@ -2209,24 +2209,24 @@ // --- ArrayAccess --- // // --------------------- // - public function offsetExists(mixed $offset): bool { - return array_key_exists($offset, $this->_data); + public function offsetExists($key) { + return array_key_exists($key, $this->_data); } - public function offsetGet(mixed $offset): mixed { - return $this->get($offset); + public function offsetGet($key) { + return $this->get($key); } - public function offsetSet(mixed $offset, mixed $value): void { - if(is_null($offset)) { + public function offsetSet($key, $value) { + if(is_null($key)) { throw new InvalidArgumentException('You must specify a key/array index.'); } - $this->set($offset, $value); + $this->set($key, $value); } - public function offsetUnset(mixed $offset): void { - unset($this->_data[$offset]); - unset($this->_dirty_fields[$offset]); + public function offsetUnset($key) { + unset($this->_data[$key]); + unset($this->_dirty_fields[$key]); } // --------------------- // @@ -2445,7 +2445,7 @@ * Get the number of records in the result set * @return int */ - public function count(): int { + public function count() { return count($this->_results); } @@ -2454,7 +2454,7 @@ * over the result set. * @return \ArrayIterator */ - public function getIterator(): Traversable { + public function getIterator() { return new ArrayIterator($this->_results); } @@ -2463,7 +2463,7 @@ * @param int|string $offset * @return bool */ - public function offsetExists(mixed $offset): bool { + public function offsetExists($offset) { return isset($this->_results[$offset]); } @@ -2472,33 +2472,25 @@ * @param int|string $offset * @return mixed */ - public function offsetGet(mixed $offset): mixed { + public function offsetGet($offset) { return $this->_results[$offset]; } /** * ArrayAccess - * @param mixed $offset + * @param int|string $offset * @param mixed $value */ - public function offsetSet(mixed $offset, mixed $value): void { + public function offsetSet($offset, $value) { $this->_results[$offset] = $value; } /** * ArrayAccess - * @param mixed $offset + * @param int|string $offset */ - public function offsetUnset(mixed $offset): void { + public function offsetUnset($offset) { unset($this->_results[$offset]); - } - - public function __serialize() { - return $this->serialize(); - } - - public function __unserialize($data) { - $this->unserialize($data); } /**