Revert "various fixes vor php 8.1 compatibility"

This reverts commit 14027ae04e.
This commit is contained in:
Andrew Dolgov 2021-12-01 13:37:35 +03:00
parent aaebe55456
commit a201e10ee0
9 changed files with 26 additions and 34 deletions

View File

@ -359,7 +359,7 @@ class Config {
if ($check == "version") { if ($check == "version") {
$rv["version"] = date("%y.%m", (int)$timestamp) . "-$commit"; $rv["version"] = strftime("%y.%m", (int)$timestamp) . "-$commit";
$rv["commit"] = $commit; $rv["commit"] = $commit;
$rv["timestamp"] = $timestamp; $rv["timestamp"] = $timestamp;

View File

@ -88,7 +88,7 @@ class Debug {
if (!self::$enabled || self::$loglevel < $level) return false; 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')) { if (function_exists('posix_getpid')) {
$ts = "$ts/" . posix_getpid(); $ts = "$ts/" . posix_getpid();
} }

View File

@ -70,7 +70,7 @@ class FeedItem_Atom extends FeedItem_Common {
* *
* @return string the rewritten XML or original $content * @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)) { if (!empty($base) && !empty($content)) {

View File

@ -201,7 +201,7 @@ class FeedParser {
// libxml may have invalid unicode data in error messages // libxml may have invalid unicode data in error messages
function error() : string { function error() : string {
return UConverter::transcode($this->error ?? '', 'UTF-8', 'UTF-8'); return UConverter::transcode($this->error, 'UTF-8', 'UTF-8');
} }
/** @return array<string> - WARNING: may return invalid unicode data */ /** @return array<string> - WARNING: may return invalid unicode data */

View File

@ -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, 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, 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; $disable_cache = false;

View File

@ -138,7 +138,7 @@ class Pref_System extends Handler_Administrative {
$sth->execute($errno_values); $sth->execute($errno_values);
while ($line = $sth->fetch()) { while ($line = $sth->fetch()) {
foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v ?? ''); } foreach ($line as $k => $v) { $line[$k] = htmlspecialchars($v); }
?> ?>
<tr> <tr>
<td class='errno'> <td class='errno'>

2
composer.lock generated
View File

@ -21,7 +21,7 @@
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^8" "php": "^7"
}, },
"require-dev": { "require-dev": {
"friendsofphp/php-cs-fixer": "*", "friendsofphp/php-cs-fixer": "*",

View File

@ -31,7 +31,7 @@ class jimIcon {
} }
if ($a != 127) if ($a != 127)
$this->all_transaprent = 0; $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, // Given a string with the contents of an .ICO,

View File

@ -2209,24 +2209,24 @@
// --- ArrayAccess --- // // --- ArrayAccess --- //
// --------------------- // // --------------------- //
public function offsetExists(mixed $offset): bool { public function offsetExists($key) {
return array_key_exists($offset, $this->_data); return array_key_exists($key, $this->_data);
} }
public function offsetGet(mixed $offset): mixed { public function offsetGet($key) {
return $this->get($offset); return $this->get($key);
} }
public function offsetSet(mixed $offset, mixed $value): void { public function offsetSet($key, $value) {
if(is_null($offset)) { if(is_null($key)) {
throw new InvalidArgumentException('You must specify a key/array index.'); throw new InvalidArgumentException('You must specify a key/array index.');
} }
$this->set($offset, $value); $this->set($key, $value);
} }
public function offsetUnset(mixed $offset): void { public function offsetUnset($key) {
unset($this->_data[$offset]); unset($this->_data[$key]);
unset($this->_dirty_fields[$offset]); unset($this->_dirty_fields[$key]);
} }
// --------------------- // // --------------------- //
@ -2445,7 +2445,7 @@
* Get the number of records in the result set * Get the number of records in the result set
* @return int * @return int
*/ */
public function count(): int { public function count() {
return count($this->_results); return count($this->_results);
} }
@ -2454,7 +2454,7 @@
* over the result set. * over the result set.
* @return \ArrayIterator * @return \ArrayIterator
*/ */
public function getIterator(): Traversable { public function getIterator() {
return new ArrayIterator($this->_results); return new ArrayIterator($this->_results);
} }
@ -2463,7 +2463,7 @@
* @param int|string $offset * @param int|string $offset
* @return bool * @return bool
*/ */
public function offsetExists(mixed $offset): bool { public function offsetExists($offset) {
return isset($this->_results[$offset]); return isset($this->_results[$offset]);
} }
@ -2472,35 +2472,27 @@
* @param int|string $offset * @param int|string $offset
* @return mixed * @return mixed
*/ */
public function offsetGet(mixed $offset): mixed { public function offsetGet($offset) {
return $this->_results[$offset]; return $this->_results[$offset];
} }
/** /**
* ArrayAccess * ArrayAccess
* @param mixed $offset * @param int|string $offset
* @param mixed $value * @param mixed $value
*/ */
public function offsetSet(mixed $offset, mixed $value): void { public function offsetSet($offset, $value) {
$this->_results[$offset] = $value; $this->_results[$offset] = $value;
} }
/** /**
* ArrayAccess * ArrayAccess
* @param mixed $offset * @param int|string $offset
*/ */
public function offsetUnset(mixed $offset): void { public function offsetUnset($offset) {
unset($this->_results[$offset]); unset($this->_results[$offset]);
} }
public function __serialize() {
return $this->serialize();
}
public function __unserialize($data) {
$this->unserialize($data);
}
/** /**
* Serializable * Serializable
* @return string * @return string