【问题标题】:Problem with Nette after update to PHP 7.4.6更新到 PHP 7.4.6 后 Nette 出现问题
【发布时间】:2020-08-23 02:37:00
【问题描述】:

在将 PHP 从版本 7.3 升级到版本 7.4.6 之后。我在 Nette 中拥有的所有东西都会抛出这个消息: Trying to access array offset on value of type bool 在 PHP 7.3 中。一切都对我有用(甚至更复杂的项目)。 Checker 100% 正常。在 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是错误栈的镜像。

【问题讨论】:

    标签: php xampp nette


    【解决方案1】:

    unserialize 函数似乎失败了,所以它返回了false。当它尝试使用索引之后的行时,它就坏了。

    查看nette/di repository,这是nette/di 3.0.1 中的fixed。确保您也更新了该依赖项。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-01
      • 2011-09-03
      • 1970-01-01
      • 1970-01-01
      • 2016-08-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-05
      相关资源
      最近更新 更多