class_exists():不推荐将 null 传递给字符串类型的参数 #1 ($class)
我有这个新安装的 Yii2 Advanced,想知道你们中是否有人在从前端登录后遇到过这个错误?
您采取了什么解决方案来解决这个问题?
下面是我的composer.json
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.6.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap4": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.1.0",
"yiisoft/yii2-gii": "~2.2.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/codeception": "^4.0",
"codeception/module-asserts": "^1.0",
"codeception/module-yii2": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/verify": "~0.5.0 || ~1.1.0",
"symfony/browser-kit": ">=2.7 <=4.2.4"
},
"config": {
"process-timeout": 1800,
"fxp-asset": {
"enabled": false
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
I had this newly installed Yii2 advanced and want to know if anyone of you ever encountered this error after login from the frontend?
What solution did you do to solve this issue?
Below is my composer.json
{
"name": "yiisoft/yii2-app-advanced",
"description": "Yii 2 Advanced Project Template",
"keywords": ["yii2", "framework", "advanced", "project template"],
"homepage": "http://www.yiiframework.com/",
"type": "project",
"license": "BSD-3-Clause",
"support": {
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "stable",
"require": {
"php": ">=5.6.0",
"yiisoft/yii2": "~2.0.14",
"yiisoft/yii2-bootstrap4": "~2.0.0",
"yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0"
},
"require-dev": {
"yiisoft/yii2-debug": "~2.1.0",
"yiisoft/yii2-gii": "~2.2.0",
"yiisoft/yii2-faker": "~2.0.0",
"codeception/codeception": "^4.0",
"codeception/module-asserts": "^1.0",
"codeception/module-yii2": "^1.0",
"codeception/module-filesystem": "^1.0",
"codeception/verify": "~0.5.0 || ~1.1.0",
"symfony/browser-kit": ">=2.7 <=4.2.4"
},
"config": {
"process-timeout": 1800,
"fxp-asset": {
"enabled": false
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从 php 8.1 开始,您不能在 class_exists 函数中放置空值。
要解决这个问题,在文件 \vendor\yiisoft\yii2-debug\src\panels\UserPanel.php 中将第 90/91 行替换
为
这不是一个好的解决方案,因为我们正在编辑 yii 的源代码,但可以工作:)
Yii 2.0.46 版本可能会修复这个问题
it looks like as of php 8.1 you can't put null values in the class_exists function.
To fix that issue, in file \vendor\yiisoft\yii2-debug\src\panels\UserPanel.php replace line 90/91
with
It's not good solution because we are editing the source code of yii, but works :)
It is possible that version 2.0.46 of Yii will fix this
看来 Yii2 不兼容 PHP 8.1 版本。
我不得不在我的 macbook 中恢复到 PHP 7.4 版本
It seems that Yii2 is not compatible with PHP version 8.1.
I had to go back to version 7.4 of PHP in my macbook
https://github.com/yiisoft/yii2-debug/issues/482
https://github.com/yiisoft/yii2-debug/issues/482