简体   繁体   English

在 drupal 中将 php 版本从 7.4 升级到 8.1 后出现弃用函数(Graphql 模块)警告

[英]Deprecated function(Graphql module) warning coming after upgrade php vesion from 7.4 to 8.1 in drupal

This error (related to graphql module) is coming in our drupal website after upgrade php 8.1:这个错误(与 graphql 模块相关)在升级 php 8.1 后出现在我们的 drupal 网站中:

Deprecated function: Return type of Drupal\graphql\Plugin\TypePluginManagerAggregator::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in include() (line 5 of /code/web/modules/contrib/graphql/src/Plugin/TypePluginManagerAggregator.php).已弃用 function:Drupal\graphql\Plugin\TypePluginManagerAggregator::getIterator() 的返回类型应该与 IteratorAggregate::getIterator(): Traversable 兼容,或者应该使用 #[\ReturnTypeWillChange] 属性暂时抑制 include 中的通知()(/code/web/modules/contrib/graphql/src/Plugin/TypePluginManagerAggregator.php 的第 5 行)。

when I hite the url domain/update.php/selection.当我点击 url 域/update.php/selection 时。

在此处输入图像描述

Can anyone help me to fix it?任何人都可以帮我解决它吗?

It looks that you are using Drupal GraphQL in version 3.x and you should migrate to 4.x to have compatibility with newer PHP version.看起来您在版本 3.x 中使用 Drupal GraphQL 并且您应该迁移到 4.x 以与更新的 PHP 版本兼容。 The problem is in this file , which had last commit almost 5 years ago...问题出在这个文件中,它最后一次提交是在将近 5 年前......

There is existing issue and pull request about this, but it seems to be inactive a bit.关于此存在现有问题拉取请求,但它似乎有点不活跃。

If you cannot upgrade library, try use a tip from pull request - enforce base graphql library version in composer.json and apply patches - author of that comment says that it worked.如果您无法升级库,请尝试使用拉取请求中的提示 - 在composer.json中强制执行基本 graphql 库版本并应用补丁 - 该评论的作者说它有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM