Xhprof / xhgui : xhgui - 要插入的文档包含无效键:键不能包含“.”

Xhprof / xhgui : xhgui - document to insert contains invalid key: keys cannot contain "."

我正在尝试使用 Xhprof 设置 Xhgui。 我遵循了 github 说明 (https://github.com/perftools/xhgui), 但此错误消息不断出现在错误日志中:

"xhgui - document to insert contains invalid key: keys cannot contain ".": "main()==>load..."

看起来 mongoDB 不能在键中使用点,但 Xhgui 正在尝试这样做。

有没有办法在 mongoDB 中禁用此限制?或者修复 Xhgui 中的这个错误?

https://github.com/perftools/xhgui/issues/209#issuecomment-339281276

For anyone experiencing this issue, I was able to make it work by adding the following snippet of code to xhgui/external/header.php right before ignore_user_abort(true); call. Not sure how correct is this and if it could affect anything else, but it did the trick for me.

    $profile = [];
    foreach($data['profile'] as $key => $value) {
        $profile[strtr($key, ['.' => '_'])] = $value;
    }
    $data['profile'] = $profile;