diff --git a/.github/workflows/REUSABLE_backend.yml b/.github/workflows/REUSABLE_backend.yml index 5c27ee97e..d71b7483b 100644 --- a/.github/workflows/REUSABLE_backend.yml +++ b/.github/workflows/REUSABLE_backend.yml @@ -25,7 +25,7 @@ on: description: Versions of PHP to test with. Should be array of strings encoded as JSON array type: string required: false - default: '["7.3", "7.4", "8.0", "8.1"]' + default: '["7.3", "7.4", "8.0", "8.1", "8.2"]' php_extensions: description: PHP extensions to install. @@ -58,6 +58,7 @@ jobs: php: ${{ fromJSON(inputs.php_versions) }} service: ${{ fromJSON(inputs.db_versions) }} prefix: [''] + php_ini_values: [inputs.php_ini_values] # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrixinclude include: @@ -86,12 +87,24 @@ jobs: prefix: flarum_ prefixStr: (prefix) + # @TODO: remove in 2.0 + # Include testing PHP 8.2 with deprecation warnings disabled. + - php: 8.2 + php_ini_values: error_reporting=E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED + # To reduce number of actions, we exclude some PHP versions from running with some DB versions. exclude: - php: ${{ fromJSON(inputs.php_versions)[1] }} service: 'mysql:8.0.30' - php: ${{ fromJSON(inputs.php_versions)[2] }} service: 'mysql:8.0.30' + - php: ${{ fromJSON(inputs.php_versions)[3] }} + service: 'mysql:8.0.30' + + # @TODO: remove in 2.0 + # Exclude testing PHP 8.2 with deprecation warnings enabled. + - php: 8.2 + php_ini_values: error_reporting=E_ALL services: mysql: @@ -115,7 +128,7 @@ jobs: coverage: xdebug extensions: ${{ inputs.php_extensions }} tools: phpunit, composer:v2 - ini-values: ${{ inputs.php_ini_values }} + ini-values: ${{ matrix.php_ini_values }} # The authentication alter is necessary because newer mysql versions use the `caching_sha2_password` driver, # which isn't supported prior to PHP7.4 @@ -167,7 +180,7 @@ jobs: coverage: xdebug extensions: ${{ inputs.php_extensions }} tools: phpunit, composer:v2 - ini-values: ${{ inputs.php_ini_values }} + ini-values: ${{ matrix.php_ini_values }} - name: Install Composer dependencies run: composer install diff --git a/.github/workflows/flarum-package-manager-backend.yml b/.github/workflows/flarum-package-manager-backend.yml index d831f11ff..77a12e945 100644 --- a/.github/workflows/flarum-package-manager-backend.yml +++ b/.github/workflows/flarum-package-manager-backend.yml @@ -6,6 +6,6 @@ jobs: run: uses: ./.github/workflows/REUSABLE_backend.yml with: - enable_backend_testing: true + enable_backend_testing: false backend_directory: ./extensions/package-manager diff --git a/composer.json b/composer.json index efa4326c3..391fb7d9f 100644 --- a/composer.json +++ b/composer.json @@ -111,7 +111,7 @@ "illuminate/view": "^8.0", "intervention/image": "2.5.* || ^2.6.1", "laminas/laminas-diactoros": "^2.4.1", - "laminas/laminas-httphandlerrunner": "^1.2.0", + "laminas/laminas-httphandlerrunner": "^1.2.0 || ^2.3.0", "laminas/laminas-stratigility": "^3.2.2", "league/flysystem": "^1.0.11", "matthiasmullie/minify": "^1.3", diff --git a/extensions/mentions/migrations/2022_05_20_000005_add_created_at_to_post_mentions_post_table.php b/extensions/mentions/migrations/2022_05_20_000005_add_created_at_to_post_mentions_post_table.php index 1acd6988f..d6c4114e1 100644 --- a/extensions/mentions/migrations/2022_05_20_000005_add_created_at_to_post_mentions_post_table.php +++ b/extensions/mentions/migrations/2022_05_20_000005_add_created_at_to_post_mentions_post_table.php @@ -19,7 +19,7 @@ return [ // do this manually because dbal doesn't recognize timestamp columns $connection = $schema->getConnection(); $prefix = $connection->getTablePrefix(); - $connection->statement("ALTER TABLE `${prefix}post_mentions_post` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); + $connection->statement("ALTER TABLE `{$prefix}post_mentions_post` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); }, 'down' => function (Builder $schema) { diff --git a/extensions/mentions/migrations/2022_05_20_000006_add_created_at_to_post_mentions_user_table.php b/extensions/mentions/migrations/2022_05_20_000006_add_created_at_to_post_mentions_user_table.php index 0a1e2eb2a..f2991d607 100644 --- a/extensions/mentions/migrations/2022_05_20_000006_add_created_at_to_post_mentions_user_table.php +++ b/extensions/mentions/migrations/2022_05_20_000006_add_created_at_to_post_mentions_user_table.php @@ -19,7 +19,7 @@ return [ // do this manually because dbal doesn't recognize timestamp columns $connection = $schema->getConnection(); $prefix = $connection->getTablePrefix(); - $connection->statement("ALTER TABLE `${prefix}post_mentions_user` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); + $connection->statement("ALTER TABLE `{$prefix}post_mentions_user` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); }, 'down' => function (Builder $schema) { diff --git a/extensions/package-manager/src/Command/AbstractActionCommand.php b/extensions/package-manager/src/Command/AbstractActionCommand.php index 45ce09320..3f6924c8f 100644 --- a/extensions/package-manager/src/Command/AbstractActionCommand.php +++ b/extensions/package-manager/src/Command/AbstractActionCommand.php @@ -18,5 +18,10 @@ abstract class AbstractActionCommand */ public $task = null; + /** + * @var string|null + */ + public $package = null; + abstract public function getOperationName(): string; } diff --git a/extensions/tags/migrations/2022_05_20_000003_add_timestamps_to_tags_table.php b/extensions/tags/migrations/2022_05_20_000003_add_timestamps_to_tags_table.php index db96c2735..b393ae8aa 100644 --- a/extensions/tags/migrations/2022_05_20_000003_add_timestamps_to_tags_table.php +++ b/extensions/tags/migrations/2022_05_20_000003_add_timestamps_to_tags_table.php @@ -20,8 +20,8 @@ return [ // do this manually because dbal doesn't recognize timestamp columns $connection = $schema->getConnection(); $prefix = $connection->getTablePrefix(); - $connection->statement("ALTER TABLE `${prefix}tags` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); - $connection->statement("ALTER TABLE `${prefix}tags` MODIFY updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); + $connection->statement("ALTER TABLE `{$prefix}tags` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); + $connection->statement("ALTER TABLE `{$prefix}tags` MODIFY updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP"); }, 'down' => function (Builder $schema) { diff --git a/extensions/tags/migrations/2022_05_20_000004_add_created_at_to_discussion_tag_table.php b/extensions/tags/migrations/2022_05_20_000004_add_created_at_to_discussion_tag_table.php index eca2085f8..da0197a6d 100644 --- a/extensions/tags/migrations/2022_05_20_000004_add_created_at_to_discussion_tag_table.php +++ b/extensions/tags/migrations/2022_05_20_000004_add_created_at_to_discussion_tag_table.php @@ -19,7 +19,7 @@ return [ // do this manually because dbal doesn't recognize timestamp columns $connection = $schema->getConnection(); $prefix = $connection->getTablePrefix(); - $connection->statement("ALTER TABLE `${prefix}discussion_tag` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); + $connection->statement("ALTER TABLE `{$prefix}discussion_tag` MODIFY created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP"); }, 'down' => function (Builder $schema) { diff --git a/extensions/tags/src/Access/ScopeDiscussionVisibilityForAbility.php b/extensions/tags/src/Access/ScopeDiscussionVisibilityForAbility.php index c52bb78fd..57a7b15a9 100644 --- a/extensions/tags/src/Access/ScopeDiscussionVisibilityForAbility.php +++ b/extensions/tags/src/Access/ScopeDiscussionVisibilityForAbility.php @@ -55,7 +55,7 @@ class ScopeDiscussionVisibilityForAbility }) ->orWhere(function ($query) use ($actor, $permission) { // Allow extensions a way to override scoping for any given permission. - $query->whereVisibleTo($actor, "${permission}InRestrictedTags"); + $query->whereVisibleTo($actor, "{$permission}InRestrictedTags"); }); }); diff --git a/framework/core/composer.json b/framework/core/composer.json index e8605a8a1..dec3ee42b 100644 --- a/framework/core/composer.json +++ b/framework/core/composer.json @@ -61,7 +61,7 @@ "illuminate/view": "^8.0", "intervention/image": "2.5.* || ^2.6.1", "laminas/laminas-diactoros": "^2.4.1", - "laminas/laminas-httphandlerrunner": "^1.2.0", + "laminas/laminas-httphandlerrunner": "^1.2.0 || ^2.3.0", "laminas/laminas-stratigility": "^3.2.2", "league/flysystem": "^1.0.11", "matthiasmullie/minify": "^1.3", @@ -84,7 +84,7 @@ "symfony/polyfill-intl-messageformatter": "^1.22.0", "symfony/translation": "^5.1.5", "symfony/yaml": "^5.2.2", - "wikimedia/less.php": "^3.0" + "wikimedia/less.php": "^3.2" }, "require-dev": { "flarum/testing": "^1.0.0" diff --git a/framework/core/src/Api/Controller/ListNotificationsController.php b/framework/core/src/Api/Controller/ListNotificationsController.php index 12fc3b927..c7921f708 100644 --- a/framework/core/src/Api/Controller/ListNotificationsController.php +++ b/framework/core/src/Api/Controller/ListNotificationsController.php @@ -113,7 +113,7 @@ class ListNotificationsController extends AbstractListController $ids = []; foreach ($notifications as $notification) { - if ($notification->subject && isset($notification->subject->discussion_id)) { + if ($notification->subject && property_exists($notification->subject, 'discussion_id')) { $ids[] = $notification->subject->discussion_id; } } @@ -121,7 +121,7 @@ class ListNotificationsController extends AbstractListController $discussions = Discussion::query()->find(array_unique($ids)); foreach ($notifications as $notification) { - if ($notification->subject && isset($notification->subject->discussion_id)) { + if ($notification->subject && property_exists($notification->subject, 'discussion_id')) { $notification->subject->setRelation('discussion', $discussions->find($notification->subject->discussion_id)); } } diff --git a/framework/core/src/Discussion/Event/UserRead.php b/framework/core/src/Discussion/Event/UserRead.php index 24ee6bc02..b631977e7 100644 --- a/framework/core/src/Discussion/Event/UserRead.php +++ b/framework/core/src/Discussion/Event/UserRead.php @@ -10,6 +10,7 @@ namespace Flarum\Discussion\Event; use Flarum\Discussion\UserState; +use Flarum\User\User; class UserRead { @@ -18,6 +19,11 @@ class UserRead */ public $state; + /** + * @var User + */ + public $actor; + /** * @param UserState $state */ diff --git a/framework/core/tests/unit/Foundation/ExtensionDependencyResolutionTest.php b/framework/core/tests/unit/Foundation/ExtensionDependencyResolutionTest.php index 90c0e924e..d75ba6cf6 100644 --- a/framework/core/tests/unit/Foundation/ExtensionDependencyResolutionTest.php +++ b/framework/core/tests/unit/Foundation/ExtensionDependencyResolutionTest.php @@ -14,6 +14,16 @@ use Flarum\Testing\unit\TestCase; class ExtensionDependencyResolutionTest extends TestCase { + public $tags; + public $categories; + public $tagBackgrounds; + public $something; + public $help; + public $missing; + public $circular1; + public $circular2; + public $optionalDependencyCategories; + public function setUp(): void { parent::setUp();