首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >HEROKU错误: ArrayAccess继承期间

HEROKU错误: ArrayAccess继承期间
EN

Stack Overflow用户
提问于 2021-12-12 15:08:04
回答 1查看 6.9K关注 0票数 0

这是heroku的日志,我以前版本的代码运行得很完美,但是我更改了一些代码并出现了这个错误。回滚不能解决相同的错误.

代码语言:javascript
复制
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
       - php (8.1.0)
       - ext-mbstring (bundled with php)
       - composer (2.1.14)
       - apache (2.4.51)
       - nginx (1.20.2)
-----> Installing dependencies...

 PHP Fatal error:  During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_3007ab05/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-12-13 02:47:55

我最近也犯了同样的错误。我的本地php版本为8.0.13,运行良好,但当我将其上传到heroku (这里使用的php版本为8.1)时,我得到了错误。

为了解决这个问题,我将composer.json中的php版本指定为与我使用的本地php版本完全相同的版本,如下所示:

代码语言:javascript
复制
{
  "require": {
    "php": "8.0.13"
  }
}

不要忘记更新composer.lock,然后上传到heroku。Heroku将使用这个精确的版本。

我知道不建议为每个https://devcenter.heroku.com/articles/php-support指定确切的版本,但作为一种解决办法,它工作得很好。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70324790

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档