如何解决Nette更新到PHP 7.4.6后出现问题
将PHP从版本 7.3 升级到版本 7.4.6 之后。我在Nette中拥有的所有内容都会抛出此消息:
Trying to access array offset on value of type bool
在PHP 7.3中。一切对我都有效(甚至更复杂的项目)。 Checker价格为100%OK根据Nette论坛的建议,我还将 Nette 更新为版本 3.0 ,但是仍然相同。我应该在哪里寻找错误?
Notice
Trying to access array offset on value of type bool search► skip error►
Source file
File: ...\vendor\nette\di\src\DI\ContainerLoader.php:109
99: throw new Nette\IOException("Unable to include '$file'.");
100: }
101: flock($handle,LOCK_UN);
102: }
103:
104:
105: private function isExpired($file,&$updatedMeta = null)
106: {
107: if ($this->autoRebuild) {
108: $meta = @unserialize((string) file_get_contents("$file.meta")); // @ - file may not exist
**109: $orig = $meta[2];**
110: return empty($meta[0])
111: || DependencyChecker::isExpired(...$meta)
112: || ($orig !== $meta[2] && $updatedMeta = serialize($meta));
113: }
Call stack
...\vendor\nette\di\src\DI\ContainerLoader.php:68 source Nette\DI\ContainerLoader->isExpired(arguments)
...\vendor\nette\di\src\DI\ContainerLoader.php:47 source Nette\DI\ContainerLoader->loadFile(arguments)
...\nette\bootstrap\src\Bootstrap\Configurator.php:267 source Nette\DI\ContainerLoader->load(arguments)
...\nette\bootstrap\src\Bootstrap\Configurator.php:242 source Nette\Configurator->loadContainer()
C:\xampp\htdocs\hello-world\app\bootstrap.php:20 source Nette\Configurator->createContainer()
C:\xampp\htdocs\hello-world\www\index.php:3 source require(arguments)
Variables
Exception
Environment
HTTP request
HTTP response
Report generated at 2020/08/23 03:10:12
http://localhost/hello-world/
PHP 7.4.6
Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6
Tracy 2.5.2
Here是错误堆栈的图像。
解决方法
似乎unserialize
函数失败,因此它返回了false
。当尝试使用索引后的行时,它中断了。
查看nette/di
repository,这是nette/di
3.0.1中的fixed。确保您也更新了该依赖关系。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。