【问题标题】:Symony 5 WDT / Profiler toolbar unserialze errorSymfony 5 WDT / Profiler 工具栏反序列化错误
【发布时间】:2021-10-14 22:23:02
【问题描述】:

WDT 总是出现以下错误。分析器工具栏仅显示:加载 Web 调试工具栏时出错。 Symfony 日志如下:

[Web 服务器] Apr 21 22:11:16 |DEBUG | PHP 重新加载 PHP 版本 [网络服务器] Apr 21 22:11:16 |DEBUG | PHP 使用 PHP 版本 8.0.3(来自 $PATH 中的默认版本)

[应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name

【申请】4月21日22:09:39 |INFO |请求匹配的路由“_wdt”。 method="GET" request_uri="https://127.0.0.1:8000/_wdt/737bae" route="_wdt" route_parameters={"_controller":"web_profiler.controller.profiler::toolbarAction","_route":" _wdt","token":"737bae"}

【申请】4月21日22:09:39 |CRITICA|在/media/storage/Clouds/Dropbox/Workspaces/web/txtadventures/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php 处请求未捕获的 PHP 异常 ErrorException:“注意:unserialize():62050 字节的偏移 62001 处出错”第 126 行

[应用] Apr 21 22:09:39 |ERROR |请求未捕获的 PHP 异常 Symfony\Component\HttpKernel\Exception\NotFoundHttpException:“在 /media/storage/Clouds/ 处找不到“GET /favicon.ico”(来自“https://127.0.0.1:8000/”)的路由Dropbox/Workspaces/web/txtadventures/vendor/symfony/http-kernel/EventListener/RouterListener.php 第 136 行

[应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name

[应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name [应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name

[应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name

[应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name

[应用] Apr 21 22:09:39 |DEBUG | DOCTRI SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' UNION ALL SELECT name FROM sqlite_temp_master WHERE type = 'table' ORDER BY name

[Web 服务器] 4 月 21 日 22:11:16 |信息 | PHP监听路径="/usr/bin/php8.0" php="8.0.3" port=35977

[PHP ] [2021 年 4 月 21 日星期三 22:11:16] PHP 8.0.3 开发服务器 (http://127.0.0.1:35977) 已启动

什么都没有改变。该应用程序也是一个干净的项目,仅安装了基础知识。 可下载项目地址:Dropbox

使用 symfony 内置服务器在 PHP 7.4 和 PHP 8.0 中遇到了同样的错误。 任何想法如何解决这个问题。

【问题讨论】:

  • 一些搜索显示这是一个编码问题。您可能必须调试该特定代码行,可能直接在 vendor 中编辑它以查看其中的内容。
  • 我会试试的。问题是,为什么 IT 发生在新的 instsll 上
  • 我遇到了同样的错误。似乎是某些文件的编码问题。我还没有解决方案。
  • 您将不得不编辑 /media/storage/Clouds/Dropbox/Workspaces/web/txtadventures/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php,第 126 行。不知何故,您将不得不记录每个试图被读取的 $file,然后找到具体是哪一个触发了这个起来,然后检查该特定文件。在您发布的日志中,您希望检查字节 62001,但下次运行时可能会有所不同。顺便说一句,您是在 Dropbox 共享上运行这一切吗?如果是这样,可能正在发生同步,您也应该尝试 100% 仅在本地运行。

标签: php symfony


【解决方案1】:

从本质上讲,这似乎是 php 中的一个错误,已在 php-7.4 中修复。

official php issue

与\Serializable接口(serialize()/unserialize()对象方法)和__sleep()/__wakeup魔术方法实现有关。

似乎使用新的魔术方法 __serialize/__unserialize 可以避免这个问题。

在我的情况下,它似乎通过更新到最近的 php-7.4.24 解决了,但我将我的项目使用 \Serializable 重构为 __serialize/__unserialize(在用户对象中),以绝对摆脱官方的潜在问题。

我在此过程中使用的其他资源(或多或少相关):

【讨论】:

  • 谢谢,我会测试一下。
猜你喜欢
  • 2021-08-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-19
  • 2012-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多