From 0d6f8d2921db827c8ba06bf963d65c5d32b96a80 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Fri, 27 Jan 2023 15:33:34 -0500 Subject: [PATCH] Avoid most deprecation warnings The Feed class sets dynamic properties on Picofeed classes; this will need to be completely rewritten. Version 1.2 of the Laminas XML class also uses a deprecated function, but upgrading it to 1.3 will require PHP 7.3. --- .gitignore | 1 + arsse.php | 2 +- composer.json | 6 +++++- composer.lock | 21 ++++++++++--------- lib/Conf.php | 4 +++- lib/Db/SQLite3/Driver.php | 1 + tests/cases/CLI/TestCLI.php | 2 ++ tests/cases/Database/AbstractTest.php | 4 ++++ tests/cases/Database/SeriesArticle.php | 2 ++ tests/cases/Database/SeriesFeed.php | 2 ++ tests/cases/Database/SeriesLabel.php | 2 ++ tests/cases/Database/SeriesTag.php | 3 +++ tests/cases/Db/SQLite3/TestCreation.php | 2 ++ tests/cases/Db/SQLite3PDO/TestCreation.php | 2 ++ tests/cases/ImportExport/TestImportExport.php | 2 ++ tests/cases/Service/TestDaemon.php | 1 + tests/cases/User/TestUser.php | 2 ++ vendor-bin/phpunit/composer.lock | 12 +++++------ 18 files changed, 52 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 42f0b63..b367592 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /arsse.db* /config.php /.php_cs.cache +/.php-cs-fixer.cache /tests/.phpunit.result.cache # Dependencies diff --git a/arsse.php b/arsse.php index f5f2673..dff59c0 100644 --- a/arsse.php +++ b/arsse.php @@ -13,7 +13,7 @@ require_once BASE."vendor".DIRECTORY_SEPARATOR."autoload.php"; ignore_user_abort(true); ini_set("memory_limit", "-1"); ini_set("max_execution_time", "0"); -// FIXME: This is required because various dependencies have yet to adjust to PHP 8.1 +// NOTE: While running in the wild we don't want to spew deprecation warnings if users are ahead of us in PHP versions error_reporting(\E_ALL & ~\E_DEPRECATED); if (\PHP_SAPI === "cli") { diff --git a/composer.json b/composer.json index a44ac8d..6f53490 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "ext-dom": "*", "nicolus/picofeed": "dev-bugfix", "hosteurope/password-generator": "1.*", - "docopt/docopt": "1.*", + "docopt/docopt": "dev-master", "jkingweb/druuid": "3.*", "guzzlehttp/psr7": "1.*", "laminas/laminas-httphandlerrunner": "1.*" @@ -64,6 +64,10 @@ { "type": "vcs", "url": "https://github.com/rhukster/picoFeed" + }, + { + "type": "vcs", + "url": "https://github.com/docopt/docopt.php" } ] } diff --git a/composer.lock b/composer.lock index 67d713c..a9f44a2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "21a116823c3335992910966f31861811", + "content-hash": "62bf2d6fdc0ccbeb090399f708928a02", "packages": [ { "name": "docopt/docopt", - "version": "1.0.4", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/docopt/docopt.php.git", - "reference": "bf3683a16e09fa1665e493eb4d5a29469e132a4f" + "reference": "5ad491cb9fc072e8bb0497061a09b0efcf25cbcf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/docopt/docopt.php/zipball/bf3683a16e09fa1665e493eb4d5a29469e132a4f", - "reference": "bf3683a16e09fa1665e493eb4d5a29469e132a4f", + "url": "https://api.github.com/repos/docopt/docopt.php/zipball/5ad491cb9fc072e8bb0497061a09b0efcf25cbcf", + "reference": "5ad491cb9fc072e8bb0497061a09b0efcf25cbcf", "shasum": "" }, "require": { @@ -26,13 +26,13 @@ "require-dev": { "phpunit/phpunit": "4.1.*" }, + "default-branch": true, "type": "library", "autoload": { "classmap": [ "src/docopt.php" ] }, - "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -51,10 +51,10 @@ "docs" ], "support": { - "issues": "https://github.com/docopt/docopt.php/issues", - "source": "https://github.com/docopt/docopt.php/tree/1.0.4" + "source": "https://github.com/docopt/docopt.php/tree/master", + "issues": "https://github.com/docopt/docopt.php/issues" }, - "time": "2019-12-03T02:48:46+00:00" + "time": "2022-05-11T23:52:25+00:00" }, { "name": "guzzlehttp/guzzle", @@ -1299,7 +1299,8 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "nicolus/picofeed": 20 + "nicolus/picofeed": 20, + "docopt/docopt": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/lib/Conf.php b/lib/Conf.php index 428e87a..07a8e5d 100644 --- a/lib/Conf.php +++ b/lib/Conf.php @@ -7,13 +7,15 @@ declare(strict_types=1); namespace JKingWeb\Arsse; +use AllowDynamicProperties; use JKingWeb\Arsse\Misc\ValueInfo as Value; /** Class for loading, saving, and querying configuration * * The Conf class serves both as a means of importing and querying configuration information, as well as a source for default parameters when a configuration file does not specify a value. * All public properties are configuration parameters that may be set by the server administrator. */ -class Conf { +#[AllowDynamicProperties] + class Conf { /** @var string Default language to use for logging and errors */ public $lang = "en"; diff --git a/lib/Db/SQLite3/Driver.php b/lib/Db/SQLite3/Driver.php index b4f9129..b23d42b 100644 --- a/lib/Db/SQLite3/Driver.php +++ b/lib/Db/SQLite3/Driver.php @@ -20,6 +20,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver { public const SQLITE_MISMATCH = 20; protected $db; + protected $collator; public function __construct() { // check to make sure required extension is loaded diff --git a/tests/cases/CLI/TestCLI.php b/tests/cases/CLI/TestCLI.php index a17ecbb..67fc4e4 100644 --- a/tests/cases/CLI/TestCLI.php +++ b/tests/cases/CLI/TestCLI.php @@ -21,6 +21,8 @@ use JKingWeb\Arsse\Service\Daemon; /** @covers \JKingWeb\Arsse\CLI */ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { + protected $cli; + public function setUp(): void { parent::setUp(); $this->cli = $this->partialMock(CLI::class); diff --git a/tests/cases/Database/AbstractTest.php b/tests/cases/Database/AbstractTest.php index ef1f0d7..479ad9c 100644 --- a/tests/cases/Database/AbstractTest.php +++ b/tests/cases/Database/AbstractTest.php @@ -29,6 +29,10 @@ abstract class AbstractTest extends \JKingWeb\Arsse\Test\AbstractTest { protected static $drv; protected static $failureReason = ""; protected $primed = false; + protected $data; + protected $user; + protected $checkTables; + protected $series; abstract protected function nextID(string $table): int; diff --git a/tests/cases/Database/SeriesArticle.php b/tests/cases/Database/SeriesArticle.php index efd78e1..197ec55 100644 --- a/tests/cases/Database/SeriesArticle.php +++ b/tests/cases/Database/SeriesArticle.php @@ -15,6 +15,8 @@ use JKingWeb\Arsse\Misc\Date; use JKingWeb\Arsse\Misc\ValueInfo; trait SeriesArticle { + protected $fields; + protected function setUpSeriesArticle(): void { $this->data = [ 'arsse_users' => [ diff --git a/tests/cases/Database/SeriesFeed.php b/tests/cases/Database/SeriesFeed.php index 5cc0d84..bc7224e 100644 --- a/tests/cases/Database/SeriesFeed.php +++ b/tests/cases/Database/SeriesFeed.php @@ -10,6 +10,8 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Test\Result; trait SeriesFeed { + protected $matches; + protected function setUpSeriesFeed(): void { // set up the test data $past = gmdate("Y-m-d H:i:s", strtotime("now - 1 minute")); diff --git a/tests/cases/Database/SeriesLabel.php b/tests/cases/Database/SeriesLabel.php index 4a4fac6..41e3944 100644 --- a/tests/cases/Database/SeriesLabel.php +++ b/tests/cases/Database/SeriesLabel.php @@ -11,6 +11,8 @@ use JKingWeb\Arsse\Database; use JKingWeb\Arsse\Context\Context; trait SeriesLabel { + protected $checkLabels; + protected function setUpSeriesLabel(): void { $this->data = [ 'arsse_users' => [ diff --git a/tests/cases/Database/SeriesTag.php b/tests/cases/Database/SeriesTag.php index 1f2ea9c..5be1217 100644 --- a/tests/cases/Database/SeriesTag.php +++ b/tests/cases/Database/SeriesTag.php @@ -10,6 +10,9 @@ use JKingWeb\Arsse\Arsse; use JKingWeb\Arsse\Database; trait SeriesTag { + protected $checkMembers; + protected $checkTags; + protected function setUpSeriesTag(): void { $this->data = [ 'arsse_users' => [ diff --git a/tests/cases/Db/SQLite3/TestCreation.php b/tests/cases/Db/SQLite3/TestCreation.php index cc4927d..a96dc28 100644 --- a/tests/cases/Db/SQLite3/TestCreation.php +++ b/tests/cases/Db/SQLite3/TestCreation.php @@ -17,6 +17,8 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { protected $data; protected $drv; protected $ch; + protected $files; + protected $path; public function setUp(): void { if (!Driver::requirementsMet()) { diff --git a/tests/cases/Db/SQLite3PDO/TestCreation.php b/tests/cases/Db/SQLite3PDO/TestCreation.php index ea5e9a3..b59f6f6 100644 --- a/tests/cases/Db/SQLite3PDO/TestCreation.php +++ b/tests/cases/Db/SQLite3PDO/TestCreation.php @@ -19,6 +19,8 @@ class TestCreation extends \JKingWeb\Arsse\Test\AbstractTest { protected $data; protected $drv; protected $ch; + protected $files; + protected $path; public function setUp(): void { if (!Driver::requirementsMet()) { diff --git a/tests/cases/ImportExport/TestImportExport.php b/tests/cases/ImportExport/TestImportExport.php index ae0c7a4..2dbac5a 100644 --- a/tests/cases/ImportExport/TestImportExport.php +++ b/tests/cases/ImportExport/TestImportExport.php @@ -15,6 +15,8 @@ use JKingWeb\Arsse\Test\Database; class TestImportExport extends \JKingWeb\Arsse\Test\AbstractTest { protected $drv; protected $proc; + protected $data; + protected $primed; protected $checkTables = [ 'arsse_folders' => ["id", "owner", "parent", "name"], 'arsse_feeds' => ["id", "url", "title"], diff --git a/tests/cases/Service/TestDaemon.php b/tests/cases/Service/TestDaemon.php index b911656..c747803 100644 --- a/tests/cases/Service/TestDaemon.php +++ b/tests/cases/Service/TestDaemon.php @@ -39,6 +39,7 @@ class TestDaemon extends \JKingWeb\Arsse\Test\AbstractTest { 'unwritable' => "", // this file will be chmodded by the test ], ]; + protected $daemon; public function setUp(): void { parent::setUp(); diff --git a/tests/cases/User/TestUser.php b/tests/cases/User/TestUser.php index 0066028..19370c0 100644 --- a/tests/cases/User/TestUser.php +++ b/tests/cases/User/TestUser.php @@ -17,6 +17,8 @@ use JKingWeb\Arsse\User\Driver; /** @covers \JKingWeb\Arsse\User */ class TestUser extends \JKingWeb\Arsse\Test\AbstractTest { + protected $drv; + public function setUp(): void { parent::setUp(); self::setConf(); diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 70001b2..7be719d 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -615,16 +615,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.23", + "version": "9.2.24", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c" + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", - "reference": "9f1f0f9a2fbb680b26d1cf9b61b6eac43a6e4e9c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2cf940ebc6355a9d430462811b5aaa308b174bed", + "reference": "2cf940ebc6355a9d430462811b5aaa308b174bed", "shasum": "" }, "require": { @@ -680,7 +680,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.23" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.24" }, "funding": [ { @@ -688,7 +688,7 @@ "type": "github" } ], - "time": "2022-12-28T12:41:10+00:00" + "time": "2023-01-26T08:26:55+00:00" }, { "name": "phpunit/php-file-iterator",