4

I'm trying to open xdebug profiler output in PhpStorm, but I'm getting an error:

Incorrect profiler snapshot format 
For input string: "fl=(2)"

I can't seem to find any indication as to what could be causing this.

I'm on OSX 10.13.4, PhpStorm version 2018.1, running the process on PHP 5.6.33 with xdebug 2.5.5

Here's my php.ini configuration:

[xdebug]
zend_extension=/usr/local/Cellar/php56/5.6.33_9/lib/php/xdebug.so
xdebug.profiler_enable=1
xdebug.profiler_output_dir=/tmp/debug/
xdebug.profiler_output_name=cachegrind.out.%c
xdebug.profiler_enable_trigger=1
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

The profiler output looks a bit weird I think, for example:

fl=(2)
fn=(5) php::spl_autoload_call
23 80
cfl=(1)
cfn=(4)
calls=1 0 0
23 2045

I don't know what those numbers in parenthesis are there for, but I think this is what's tripping PhpStorm's analyser.

Nicolas
  • 1,256
  • 1
  • 10
  • 22

2 Answers2

2

I think I found the source of the issue, or at least part of it. It looks like it has to do with the script itself. Hard to tell why exactly, maybe because it spins up a daemon process and that could potentially mess with the profiler, not sure. But if I run the profiler on something else it works.

Nicolas
  • 1,256
  • 1
  • 10
  • 22
0

This is my configuration give it a try:

zend_extension=/usr/lib/php5/20090626/xdebug.so
xdebug.idekey=PHPSTORM
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.remote_mode=req
xdebug.remote_autostart=0
xdebug.remote_connect_back=1
xdebug.remote_log = "/tmp/xdebug_cli.log"
xdebug.profiler_enable=1

PHPStorm settings: enter image description here

And remember to enable the listening in phpstorm:

enter image description here

Alessandro.Vegna
  • 1,262
  • 10
  • 19
  • 1
    Listening is enabled, the profiler file is generated, but can't be opened. I can see you don't specify the output directory, where does it go by default? – Nicolas May 11 '18 at 08:55
  • 1
    Do you have installed the chrome extension as well? (https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en) – Alessandro.Vegna May 11 '18 at 08:58
  • 1
    I'm not using web browser, this is a CLI script – Nicolas May 11 '18 at 08:58
  • 2
    Have a look here, seems that you need to upgrade your PHPStorm with the EAP version. https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000048484-Incorrect-profiler-snapshot-format-incorrect-function-parameters – Alessandro.Vegna May 11 '18 at 08:59
  • 2
    As mentioned, I'm using version 2018.1, which is the version that is supposed to contain the fix. – Nicolas May 11 '18 at 09:09