国产+高潮+在线,国产 av 仑乱内谢,www国产亚洲精品久久,51国产偷自视频区视频,成人午夜精品网站在线观看

webman在PHP8.1環(huán)境下安裝TP-ORM啟動報錯

leader

PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of think\Container::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 /www/wwwroot/webman/vendor/topthink/think-container/src/Container.php:567

截圖

6284 5 2
5個回答

liziyu

7.4妥當(dāng)

  • leader 2022-04-07

    新項目想用新環(huán)境

Tinywan

你這是 think-container 這個依賴包不支持 8.1 。TP-ORM 是支持 8.1的

截圖

  • leader 2022-04-07

    think-container可以移除嗎 會影響TP-ORM嗎

  • Tinywan 2022-04-07

    可以移除,TP-ORM不依賴與think-container

  • leader 2022-04-07

    謝謝大佬,剛看了下think-cache依賴think-container

  • Tinywan 2022-04-07

    我這邊用的8.1.1是沒問題的

  • leader 2022-04-07

    我本地環(huán)境8.1.4 測試TP-ORM同樣報錯

  • Tinywan 2022-04-07

    composer info 看看版本號是多少

  • Tinywan 2022-04-07

    我這邊是 topthink/think-orm v2.0.53 think orm

  • leader 2022-04-07

    topthink/think-helper v3.1.6 The ThinkPHP6 Helper Package
    topthink/think-orm v2.0.12 think orm
    webman/think-orm v1.0.1
    workerman/webman-framework v1.3.9 High performance HTTP Service Framework.

  • leader 2022-04-07

    我這邊composer update已經(jīng)是最新的了

liziyu

這就是不喜歡composer的地方,把祖祖孫孫全部拉下來了。沒辦法!~

  • Tinywan 2022-04-07

    所有的包管理都一樣,最起碼比node好一點(diǎn),那個是真心的大

banro512

thinkphp-container 不兼容 php8.1 導(dǎo)致的

在 PHP 8.1 之前,任何擴(kuò)展ArrayAccess接口的類都不需要添加返回類型
從 PHP 8.1 及更高版本開始,缺少返回類型的聲明會導(dǎo)致棄用通知:

解決方法,打開 \vendor\topthink\think-container\src\Container.php,搜索

offsetExists($key)改為 offsetExists($key):bool
offsetSet($key, $value)改為 offsetSet($key, $value):void
offsetGet($key) 改為 offsetGet($key):mixed
offsetUnset($key)改為 offsetUnset($key):void
getIterator()改為 getIterator():IteratorAggregate
count()改為 count():int

Tinywan

兼容8.1 需要版本大于等于 v2.0.46 版本才會兼容,你這個topthink/think-orm v2.0.12 think ormv2.0.12 就是不兼容的。兼容8.1:https://github.com/top-think/think-orm/commit/c422dbaa80671f120c0fef2acfe28ecb7dd1b794

截圖

  • banro512 2022-04-08

    他這個不是 orm的問題,是 安裝think-cache 時需要使用think-container ,這個 contrainer里的幾個寫法沒有設(shè)置返回類型

  • Tinywan 2022-04-08

    所以讓他卸載這個依賴包,單獨(dú)安裝就沒問題了

年代過于久遠(yuǎn),無法發(fā)表回答
??