think-cache插件 使用报错

864328615

Method ReflectionParameter::getClass() is deprecated,求大佬指示下

977 4 0
4个回答

nitron

PHP 8弃用getClass()

  • 864328615 2022-03-07

    等于think-cache 对php要求不能大于8

  • nitron 2022-03-07

    报错信息做好增加上下文, 改起来好改

  • 864328615 2022-03-07

    这插件你写的吗 大佬

  • nitron 2022-03-07

    不是我写的,看下workerman/webman的版本,更新到最近的再试试看,早先一点的版本在PHP8下会有问题

nitron

https://www.workerman.net/q/7863
这个你参考一下

  • 864328615 2022-03-07

    谢谢 我用的都是最新的版本 这问题暂时搁置了,只能等walkor大老做下兼容了

  • nitron 2022-03-07

    这个只能top-think那边做修改了,这是think-cache里依赖的topthink/think-container的问题

  • nitron 2022-03-07

    我刚刚试了下think-cache的安装,依赖的container已经兼容PHP8了,你把依赖升级一下

  • 864328615 2022-03-07

    再次感谢您这么细心的为我解答问题

nitron

不好意思我搞错了,think-container的2.0 Branch是支持PHP8了,但是它的2.0.3的tag依旧是不支持的,这个只能等topthink改了

  • 暂无评论
liziyu

好像是把 ReflectionParameter::getClass() 改为: ReflectionParameter::getType() 就行了。

具体看这里:https://github.com/top-think/framework/commit/df4a07d2f51307a6fabdf75dc5b4b7f8b0ad8af8

  • aimuc 2022-03-08

    复制https://github.com/top-think/framework/blob/6.0/src/think/Container.php 替换Container.php就好了

  • yzh52521 2022-03-08

    "topthink/think-cache": "^2.0.x-dev", 这样就好了

年代过于久远,无法发表回答
🔝