简体   繁体   English

_wdt上的404:Symfony WebProfiler不生成任何配置文件数据

[英]404 on _wdt: Symfony WebProfiler doesn't generate any profile data

Symfony2 fires lots of 404 in developer-mode when i want to enable the web profiler toolbar: 当我想启用Web事件探查器工具栏时,Symfony2在开发人员模式下触发大量404:

GET http://www.domain.dev/_wdt/de040c 404 (Not Found)

So i debugged the ProfilerController and discovered that it fires 404 when there is no profile-data found in filesystem. 因此,我调试了ProfilerController,发现在文件系统中未找到配置文件数据时会触发404。

But with every request to the page there will be new directories created under the directory "app/cache/dev/profiler", but still no files. 但是,对页面的每个请求都会在“ app / cache / dev / profiler”目录下创建新目录,但仍然没有文件。

The file tree under app/cache/dev looks like: app / cache / dev下的文件树如下所示:

在此处输入图片说明

As you can see, the directory "profiler" contains some directories (and it will be growing with every request to the site), but never any files. 如您所见,目录“ profiler”包含一些目录(随着对站点的每次请求,目录都会不断增加),但从未包含任何文件。 There are full write permissions for the nginx and php process, i also configured the cache-directory as an example to use shared memory under /dev/shm to prevent side effects with my host-system (i'm using vagrant for development) Nginx和php进程具有完全的写入权限,我还配置了cache-directory作为示例,以在/ dev / shm下使用共享内存来防止与主机系统产生副作用(我正在使用无所事事的开发工具)

So my question is: why are there no profiler data created, and "who" will be responsible for that? 所以我的问题是:为什么没有创建分析器数据,“谁”将负责?

UPDATE: 更新:

i found out, that in FileProfileStorage.php all profile data will be collected and serialized: 我发现,在FileProfileStorage.php中,所有配置文件数据将被收集并序列化:

// Store profile
$data = array(
    'token' => $profile->getToken(),
    'parent' => $profile->getParentToken(),
    'children' => array_map(function ($p) { return $p->getToken(); }, $profile->getChildren()),
    'data' => $profile->getCollectors(),
    'ip' => $profile->getIp(),
    'method' => $profile->getMethod(),
    'url' => $profile->getUrl(),
    'time' => $profile->getTime(),
);

if (false === file_put_contents($file, serialize($data))) {
    return false;
}

Here an exception will be thrown "Serialization of Closure is not allowed". 此处将引发异常“不允许关闭序列化”。 I still haven't found out which DataCollector will be responsible for using a Closure instead of "real" data. 我仍然没有找到哪个DataCollector负责使用Closure代替“真实”数据。

UPDATE 2: 更新2:

i figured out that the ProfilerExtension of TwigCacheBundle will throw exception here ("Serialization of Closures is not supported") 我发现TwigCacheBundle的ProfilerExtension将在此处引发异常(“不支持闭包序列化”)

Solved it by myself. 由我自己解决。 ProfilerExtension of TwigCacheBundle raised the exception while being on serialization its data for the Web Profiler. TwigCacheBundle的ProfilerExtension在对Web Profiler的数据进行序列化时引发了异常。

I've made a pull request for that . 我已经提出要求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM