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

982 Views Asked by At

I'm trying to setup Xhgui with Xhprof. I followed the github instructions (https://github.com/perftools/xhgui), but this error message keeps appearing in error logs :

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

Looks like mongoDB can't use dots in keys, but yet Xhgui is trying to do that.

Is there a way do disable this limitation in mongoDB ? Or to fix this bug in Xhgui ?

1

There are 1 best solutions below

1
On BEST ANSWER

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;