Drupal ComputedItemListTrait::getValue() 必须兼容 FieldItemList::getValue($include_computed = false)

Drupal ComputedItemListTrait::getValue() must be compatible FieldItemList::getValue($include_computed = false)

嘿,所以我的托管服务提供商放弃了对 php 7 以下任何内容的支持,所以需要将我的 drupal 站点从 8.4 更新到 8.6,这样我就不会中断等

尝试更新 运行 'composer outdated "drupal/*"' 命令时,即使我将 '"drupal/core": "^8.6.1"' 添加到 'require' 部分 'composer.json'

网站基本没问题,但我无法添加任何内容并出现以下错误:

Fatal error: Declaration of Drupal\Core\TypedData\ComputedItemListTrait::getValue() must be compatible with Drupal\Core\Field\FieldItemList::getValue($include_computed = false) in \core\modules\path\src\Plugin\Field\FieldType\PathFieldItemList.php on line 13

这是我的一些 composer.json 其中提到了 drupal

"require": {
    "composer/installers": "^1.0.24",
    "wikimedia/composer-merge-plugin": "^1.4",
    "drupal/core": "^8.6.1"
},
"replace": {
    "drupal/core": "^8.4"
},

所以我总结一下,我什至不确定我的 drupal 是否已更新,但除了我添加内容的地方之外,该网站工作正常我收到 php 错误,说模块与核心不兼容。

该错误看起来像是 PHP 7 兼容性问题,因此我假设您的 Drupal 版本 已更新。

您可以在 logged-in - 报告 > 状态报告(从管理工具栏)或 https://yoursite.com/admin/reports/status

时在状态报告页面上检查您当前的 Drupal 版本

运行 composer require 直接(而不是编辑 composer.json)是确保正确安装适当版本的 Drupal 核心的最佳方式,如下:

$ composer require drupal/core^8.6.1

这将确保 composer.lock 文件在安装适当版本的 Drupal 核心时也得到更新。